public void CreateObject_Generic() { var typeID = new AssembledTypeID(typeof(RequestedType), new object[0]); _reflectionServiceMock.Expect(mock => mock.GetTypeIDForRequestedType(typeof(RequestedType))).Return(typeID); var assembledInstance = new AssembledType(); _reflectionServiceMock .Expect( mock => mock.InstantiateAssembledType( // Use strongly typed Equals overload. Arg <AssembledTypeID> .Matches(id => id.Equals(typeID)), Arg.Is(ParamList.Empty), Arg.Is(false))) .Return(assembledInstance); var result = _pipeline.Create <RequestedType>(); Assert.That(result, Is.SameAs(assembledInstance)); }
public void CreateObject_Generic() { var typeID = new AssembledTypeID(typeof(RequestedType), new object[0]); _reflectionServiceMock.Setup(mock => mock.GetTypeIDForRequestedType(typeof(RequestedType))).Returns(typeID).Verifiable(); var assembledInstance = new AssembledType(); _reflectionServiceMock .Setup( mock => mock.InstantiateAssembledType( // Use strongly typed Equals overload. It.Is <AssembledTypeID> (id => id.Equals(typeID)), ParamList.Empty, false)) .Returns(assembledInstance) .Verifiable(); var result = _pipeline.Create <RequestedType>(); Assert.That(result, Is.SameAs(assembledInstance)); }