Hi Am struck with the following problem and was hoping for the guidance.

I am mocking an Isession

-------------------------------------------------------

 static ContainerBuilder BaseSetupForMoq(EmptyInterceptor testInterceptor = 
null )
        {

            var containerBuilder = new ContainerBuilder();

            {

         var testrep= new MockedHibernate();

                containerBuilder.Register(c => testrep.SessionOpen())
                    .As<ISession>()
                    .InstancePerRequest();
            }


-------------------------------------------
  public ISession SessionOpen()
        {
          
            var session= new Mock<ISession>();
            session.Setup(x => x.Query<User>()).Returns(User);
            return session.Object;
        }

the line of code 'session.Setup(x => x.Query<User>()).Returns(User);'  is 
throwing error
*Expression references a method that does not belong to the mocked object: 
x => x.Query<User>()*


Now i have researched and found out that extension methods such as Query<> 
cannot be mocked and a wrapper should be used. But that approach also 
didn;t worked.

Would really appreciate if I can be helped here.


-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to