Hi,
You're right, this is a bug. I'm investigating it and hope to provide a fix soon.
As a first workaround you can replace the initialization of scope with:
var scope = Isolate.Fake.Instance<Uri>(Members.CallOriginal, ConstructorWillBe.Called, "Folder/", UriKind.Relative);
This is the same as initializing the instance by itself, but Isolator is introduced with the instance as early.
As a second workaround, you can split the the first fake statement:
[TestMethod, Isolated]
public void Test()
{
// ARRANGE
var scope = new Uri("Folder/", UriKind.Relative);
Assert.AreEqual("Folder/", scope.ToString());
var something = new SomeClass();
var fakeSomething = Isolate.Fake.Instance<ISomething>();
Isolate.WhenCalled(() => something.Something).WillReturn(fakeSomething);
// ACT
Isolate.WhenCalled(() => fakeSomething.Scope).WillReturn(scope);
// ASSERT
Assert.AreEqual("Folder/", scope.ToString());
}
I'll update on this thread when a fix is available.
Regards,
Elisha,
Typemock Support