Thank you for contacting Telerik support.
From your first ticket, I could see that inside the "FileInfoDeleteMember()" you are creating a new instance of FileInfo(). Having this, you will need to apply future mocking to your test method, so that you could be able to catch the new
instance of FileInfo. You could read more about future mocking here
. Now, the correct arrange should look like this:
FileInfo(Arg.AnyString).Delete()).IgnoreInstance().DoInstead(() => called =
However, while reproducing your issue, I came to an unexpected bug in JustMock. It seems that the above line could not create the correct mock for your class. We have scheduled the fixing of this issue for the near future.
As a workaround, I was able to write the following test, which is behaving as expected:
var called =
var mlc =
var fi =
Mock.Arrange(() => fi.Delete()).IgnoreArguments().IgnoreInstance().DoInstead(() => called =
Here, I am creating an instance of the FileInfo, with default arguments. After this, I arrange its Delete() method to "DoInstead(called = true)", while I am aplying the future mocking "IgnoreInstance()" and also arranging that, the arguments should be ignored "IgnoreArguments()".
I hope this helps. As for the fix of the original syntax, expect its implementation in the next public release of JustMock.
Please contact us again, if there is anything else we could help you with, concerning JustMock.
the Telerik team
Share what you think about JustTrace & JustMock with us, so we can become even better! You can use the built-in feedback tool inside JustTrace, our forums
, or our JustTrace