예제 #1
0
        public void IndexPropertyWhenRefTypeAndNotFoundReturnNull()
        {
            IWithIndexers with = MockRepository.Mock <IWithIndexers>();

            with.ExpectProperty(x => x["", 3]);
            Assert.Null(with["", 2]);
        }
예제 #2
0
        public void IndexPropertyWhenValueTypeAndNotFoundThrows()
        {
            IWithIndexers with = MockRepository.Mock <IWithIndexers>();

            with.ExpectProperty(x => x[1]);

            Assert.Throws <InvalidOperationException>(
                () => GC.KeepAlive(with[1]));
        }
예제 #3
0
        public void IndexPropertyWhenRefTypeAndNotFoundReturnNull()
        {
            IWithIndexers with = MockRepository.Mock <IWithIndexers>();

            with.SetUnexpectedBehavior(UnexpectedCallBehaviors.BaseOrDefault);

            with.ExpectProperty(x => x["", 3]);
            Assert.Null(with["", 2]);
        }
예제 #4
0
        public void IndexPropertyWhenValueTypeAndNotFoundThrows()
        {
            IWithIndexers with = MockRepository.Mock <IWithIndexers>();

            with.SetUnexpectedBehavior(UnexpectedCallBehaviors.BaseOrDefault);

            with.ExpectProperty(x => x[1]);

            Assert.Throws <InvalidOperationException>(
                () => GC.KeepAlive(with[1]));
        }