public void Create_referenced_instance_happy_path() { var mocks = new MockRepository(); var buildSession = mocks.StrictMock<BuildSession>(); var returnedValue = new ConcreteReferenced(); string theReferenceKey = "theReferenceKey"; var instance = new ReferencedInstance(theReferenceKey); using (mocks.Record()) { Expect.Call(buildSession.CreateInstance(typeof (IReferenced), theReferenceKey)).Return(returnedValue); } using (mocks.Playback()) { Assert.AreSame(returnedValue, instance.Build(typeof (IReferenced), buildSession)); } }
public void Create_referenced_instance_happy_path() { var mocks = new MockRepository(); var buildSession = mocks.StrictMock <BuildSession>(); var returnedValue = new ConcreteReferenced(); string theReferenceKey = "theReferenceKey"; var instance = new ReferencedInstance(theReferenceKey); using (mocks.Record()) { Expect.Call(buildSession.CreateInstance(typeof(IReferenced), theReferenceKey)).Return(returnedValue); } using (mocks.Playback()) { Assert.AreSame(returnedValue, instance.Build(typeof(IReferenced), buildSession)); } }