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

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

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

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

            with.SetUnexpectedBehavior(UnexpectedCallBehaviors.BaseOrDefault);

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