示例#1
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();
        }
示例#3
0
        public void MockAbsPropertySetter()
        {
            AbsCls ac = MockRepository.Mock <AbsCls>();

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

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

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

            Assert.Equal(45, ac.Method());
            ac.VerifyAllExpectations();
        }
示例#5
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();
        }