Hello,
I am using JustMock with visual studio 2015 (just mock Q3 2015: 2015.3.929.5).
I am getting method not found error when I mocked private method and asserting on private method call as following
public class Foo
{
private void DoPrivate()
{
//Do something
}
}
Following is test method
[TestMethod]
public void ShouldInvokeNonPublicMember()
{
Foo foo = new Foo();
bool called = false;
// Arrange
Mock.NonPublic.Arrange(foo, "DoPrivate").DoInstead(() => called = true);
// Act
foo.DoPublic();
// Assert
Assert.IsTrue(called);
}
Here assert is always failing since DoInstead get not get triggered and method DoPrivate does not get called.
I also tried with Mock.NonPublic.Arrange(foo, "DoPrivate").DoNothing().MustBeCalled(); After asserting this throws error as "DoPrivate()" method not found.
Please suggest.
Thanks,
Prasad