For future reference:
Unfortunately, arranging a return value on a constructor interception is not possible with
JustMock.Mock.Arrange(() => new DirectoryInfo(@"testRoot\DrivesData\TestFamily")).Returns(fakeDirectoryInfo);)
If you don't need to differentiate instances you can use something like:
Mock.Arrange(() => new DirectoryInfo(passedString)).DoNothing();
And on the arrange calls use the .IgnoreInstance()
method. This should result in a call like:
Mock.Arrange(() => fakeDirectoryInfo.EnumerateDirectories()).IgnoreInstance().Returns(new DirectoryInfo[] { });