c# - How Can I assert /verify a Moq Protected Method? -


I have a personal method that should return the truth. I am using Newsent and MOQ so I have:

  [testfiexture] Public class customer credentials {var customermoc = new fake & lt; ICustomer & gt; () CustomerMock.Protected () .setup & lt; Bool & gt; ("CanTestPrivateMethod"). Return (true); // How can I tell it now since I can not be a customer? Verify // Verify does not exist}  

There is nothing on Google that tells you how to test it. As you can see, I can set up one for this but can not emphasize.

Am I not clear? Thanks a lot.

You do not want to test a method on a duplicate, to test the method on the example of the actual class Want to The way to go to a class is to use an accelerator, note that VS For them, you can also make AssemblyVisibleTo in your test project in the AssemblyInfo.cs file, for an internal method, you can make them available automatically, or you can "roll your roll" using the reflection. [TextFixture] Public Category CustomerTestFixture {var customer = new customer (); Var Accessor = New Customer_Avestor (new private object (customer)); Assign Istru (Accessor Canest Pvt. Method); }

When you mimic an object, it means that the object is being used as a dependency for the actual class under testing. Therefore, enough value is enough to be able to set the counterfeit object back. You are making a claim on the class that uses dependencies, not on the counterfeit class. The verification step ensures that under the test, your class has asked for the methods of counterfeit goods as per your expectations.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -