示例#1
0
        public void MockClassWithParametrizedCtor()
        {
            ParametrizedCtor pc = mocks.StrictMock(typeof(ParametrizedCtor), 3, "Hello") as ParametrizedCtor;

            Assert.Equal(3, pc.Int);
            Assert.Equal("Hello", pc.String);
            pc.Add(0, 1);
            LastCall.On(pc).Return(10);
            mocks.Replay(pc);
            Assert.Equal(10, pc.Add(0, 1));
            mocks.Verify(pc);
        }
示例#2
0
        public void MockClassWithParametrizedCtor()
        {
            ParametrizedCtor pc = MockRepository.Partial <ParametrizedCtor>(3, "Hello");

            Assert.Equal(3, pc.Int);
            Assert.Equal("Hello", pc.String);

            pc.Expect(x => x.Add(0, 1))
            .Return(10);

            Assert.Equal(10, pc.Add(0, 1));
            pc.VerifyAllExpectations();
        }