public void CanMockGenericClass() { MockRepository mocks = new MockRepository(); GenericTestClass <string> t = (GenericTestClass <string>)mocks.StrictMock(typeof(GenericTestClass <string>)); Expect.Call(t.Method("foo")).Return(42); mocks.ReplayAll(); Assert.Equal(42, t.Method("foo")); mocks.VerifyAll(); }
public void CanMockGenericClass() { GenericTestClass <string> t = MockRepository.Mock <GenericTestClass <string> >(); t.Expect(x => x.Method("foo")) .Return(42); Assert.Equal(42, t.Method("foo")); t.VerifyAllExpectations(); }
public void CanMockGenericClass() { GenericTestClass <string> t = MockRepository.Mock <GenericTestClass <string> >(); t.SetUnexpectedBehavior(UnexpectedCallBehaviors.BaseOrDefault); t.Expect(x => x.Method("foo")) .Return(42); Assert.Equal(42, t.Method("foo")); t.VerifyAllExpectations(); }