예제 #1
0
        public void NonNegative_PreAndPostconditionMethod_ThrowsIfArgNegative()
        {
            var demo = new NonNegativeConsumer();

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

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

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