public void MockAbstractMethod()
        {
            AbsCls ac = (AbsCls)mocks.StrictMock(typeof(AbsCls));

            Expect.Call(ac.Method()).Return(45);
            mocks.ReplayAll();
            Assert.Equal(45, ac.Method());
        }
        public void MockAbsPropertySetter()
        {
            AbsCls ac = (AbsCls)mocks.StrictMock(typeof(AbsCls));

            Expect.Call(ac.AbPropSet = "n");
            mocks.ReplayAll();
            ac.AbPropSet = "n";
        }
        public void MockAbsPropertyGetter()
        {
            AbsCls ac = (AbsCls)mocks.StrictMock(typeof(AbsCls));

            Expect.Call(ac.AbPropGet).Return("n");
            mocks.ReplayAll();
            Assert.Equal("n", ac.AbPropGet);
        }
示例#4
0
        public void MockAbsPropertySetter()
        {
            AbsCls ac = MockRepository.Mock <AbsCls>();

            ac.Expect(x => x.AbPropSet = "n");

            ac.AbPropSet = "n";
            ac.VerifyAllExpectations();
        }
        public void ProxyAnAbstractClass()
        {
            ProxyGenerator   generator   = new ProxyGenerator();
            LoginInterceptor interceptor = new LoginInterceptor();
            AbsCls           ac          = (AbsCls)generator.CreateClassProxy(typeof(AbsCls), interceptor, false);

            ac.Method();

            Assert.AreEqual("Method", interceptor.Methods[0]);
        }
        public void MockAbsProp()
        {
            AbsCls ac = (AbsCls)mocks.StrictMock(typeof(AbsCls));

            Expect.Call(ac.AbProp = "n");
            Expect.Call(ac.AbProp).Return("u");
            mocks.ReplayAll();
            ac.AbProp = "n";
            Assert.Equal("u", ac.AbProp);
        }
示例#7
0
        public void MockAbstractMethod()
        {
            AbsCls ac = MockRepository.Mock <AbsCls>();

            ac.Expect(x => x.Method())
            .Return(45);

            Assert.Equal(45, ac.Method());
            ac.VerifyAllExpectations();
        }
示例#8
0
        public void MockAbsPropertyGetter()
        {
            AbsCls ac = MockRepository.Partial <AbsCls>();

            ac.Expect(x => x.AbPropGet)
            .Return("n");

            Assert.Equal("n", ac.AbPropGet);
            ac.VerifyAllExpectations();
        }
        public void MockAbsPropertySetter()
        {
            AbsCls ac = MockRepository.Mock <AbsCls>();

            ac.SetUnexpectedBehavior(UnexpectedCallBehaviors.BaseOrDefault);

            ac.Expect(x => x.AbPropSet = "n");

            ac.AbPropSet = "n";
            ac.VerifyAllExpectations();
        }
        public void MockAbstractMethod()
        {
            AbsCls ac = MockRepository.Mock <AbsCls>();

            ac.SetUnexpectedBehavior(UnexpectedCallBehaviors.BaseOrDefault);

            ac.Expect(x => x.Method())
            .Return(45);

            Assert.Equal(45, ac.Method());
            ac.VerifyAllExpectations();
        }
        public void MockAbsPropertyGetter()
        {
            AbsCls ac = MockRepository.Partial <AbsCls>();

            ac.SetUnexpectedBehavior(UnexpectedCallBehaviors.BaseOrDefault);

            ac.Expect(x => x.AbPropGet)
            .Return("n");

            Assert.Equal("n", ac.AbPropGet);
            ac.VerifyAllExpectations();
        }
示例#12
0
        public void MockAbsProp()
        {
            AbsCls ac = MockRepository.Mock <AbsCls>();

            ac.Expect(x => x.AbProp = "n");
            ac.Expect(x => x.AbProp)
            .Return("u");

            ac.AbProp = "n";
            Assert.Equal("u", ac.AbProp);
            ac.VerifyAllExpectations();
        }
        public void MockAbsProp()
        {
            AbsCls ac = MockRepository.Mock <AbsCls>();

            ac.SetUnexpectedBehavior(UnexpectedCallBehaviors.BaseOrDefault);

            ac.Expect(x => x.AbProp = "n");
            ac.Expect(x => x.AbProp)
            .Return("u");

            ac.AbProp = "n";
            Assert.Equal("u", ac.AbProp);
            ac.VerifyAllExpectations();
        }