The code below fails. I was expecting the reference to be swapped; however according to this old post:
viewtopic.php?p=5268 reference swapping wasn't available in 2009, but they where considering it for future release. Is there a way to swap references? I'm on version 7.2.1.0
public class TestType
{
public string Name { get; set; }
}
[Test, Isolated]
public void Test()
{
var t1 = Isolate.Fake.Instance<TestType>();
Isolate.WhenCalled(()=>t1.Name).WillReturn("somevalue");
Isolate.Swap.NextInstance<TestType>().With(t1);
var t2 = new TestType();
Assert.AreEqual("somevalue",t2.Name);
Assert.AreEqual(t2.Name,t1.Name);
Assert.AreEqual(t1,t1);
Assert.AreEqual(t2, t2);
Assert.AreEqual(t1, t2); //why does this line fail. Shouldn't they be the same object.
}
Thanks Much,
MB