Esempio n. 1
0
        public void IndexPropertyWhenRefTypeAndNotFoundReturnNull()
        {
            IWithIndexers with = MockRepository.Mock <IWithIndexers>();

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

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

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

            with.SetUnexpectedBehavior(UnexpectedCallBehaviors.BaseOrDefault);

            with.ExpectProperty(x => x["", 3]);
            Assert.Null(with["", 2]);
        }
Esempio n. 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]));
        }