Esempio n. 1
0
        public void NonNegative_PreAndPostconditionMethod_ThrowsIfArgNegative()
        {
            var demo = new NonNegativeConsumer();

            Assert.Throws <PreconditionException>(() =>
                                                  demo.PreAndPostconditionMethod(-1));
        }
Esempio n. 2
0
        public void NonNegative_PreAndPostconditionMethod_DoesNotThrowIfArgAndResultPositive()
        {
            var demo = new NonNegativeConsumer();

            Assert.DoesNotThrow(() =>
                                demo.PreAndPostconditionMethod(1));
        }
Esempio n. 3
0
        public void NonNegative_PreAndPostconditionMethod_ThrowsIfResultNegative()
        {
            var           demo          = new NonNegativeConsumer();
            Func <string> textGenerator = () => null;

            Assert.Throws <PostconditionException>(() =>
                                                   demo.PreAndPostconditionMethod(0));
        }