Exemple #1
0
        public void NonPositive_PreAndPostconditionMethod_ThrowsIfArgPositive()
        {
            var demo = new NonPositiveConsumer();

            Assert.Throws <PreconditionException>(() =>
                                                  demo.PreAndPostconditionMethod(1));
        }
Exemple #2
0
        public void NonPositive_PreAndPostconditionMethod_DoesNotThrowIfArgAndResultNegative()
        {
            var demo = new NonPositiveConsumer();

            Assert.DoesNotThrow(() =>
                                demo.PreAndPostconditionMethod(-1));
        }
Exemple #3
0
        public void NonPositive_PreAndPostconditionMethod_ThrowsIfResultPositive()
        {
            var           demo          = new NonPositiveConsumer();
            Func <string> textGenerator = () => null;

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