Exemplo n.º 1
0
        public void Passing0And4ToYesNo123OrOtherIntMatcherExampleHandledCorrectly()
        {
            var result = UnionMatcherExamples.YesNo123OrOtherIntMatcherExample(new Union <int, bool>(0)) +
                         UnionMatcherExamples.YesNo123OrOtherIntMatcherExample(new Union <int, bool>(4));

            AreEqual("int=0int=4", result);
        }
Exemplo n.º 2
0
        public void ElseExampleStillMatchesCorrectly()
        {
            var result = UnionMatcherExamples.ElseExample(new Union <int, bool>(0)) +
                         UnionMatcherExamples.ElseExample(new Union <int, bool>(false));

            AreEqual("0false", result);
        }
Exemplo n.º 3
0
        public void ElseExampleHandlesElseCorrectly()
        {
            var result = UnionMatcherExamples.ElseExample(new Union <int, bool>(1)) +
                         UnionMatcherExamples.ElseExample(new Union <int, bool>(true));

            AreEqual("????", result);
        }
Exemplo n.º 4
0
        public void Passing12And3ToYesNo123OrOtherIntMatcherExampleHandledCorrectly()
        {
            var result = UnionMatcherExamples.YesNo123OrOtherIntMatcherExample(new Union <int, bool>(1)) +
                         UnionMatcherExamples.YesNo123OrOtherIntMatcherExample(new Union <int, bool>(2)) +
                         UnionMatcherExamples.YesNo123OrOtherIntMatcherExample(new Union <int, bool>(3));

            AreEqual("1 in range 1-32 in range 1-33 in range 1-3", result);
        }
Exemplo n.º 5
0
        public void SinglePositiveOddDigitAndTrueReporterHandlesEvenNumbers()
        {
            var result = UnionMatcherExamples.SinglePositiveOddDigitAndTrueReporter(new Union <int, bool>(2)) +
                         UnionMatcherExamples.SinglePositiveOddDigitAndTrueReporter(new Union <int, bool>(4)) +
                         UnionMatcherExamples.SinglePositiveOddDigitAndTrueReporter(new Union <int, bool>(6));

            AreEqual("2 isn't odd4 isn't odd6 isn't odd", result);
        }
Exemplo n.º 6
0
 public void SinglePositiveOddDigitAndTruePrinterHandlesFalse()
 {
     using (var sw = new StringWriter())
     {
         Console.SetOut(sw);
         UnionMatcherExamples.SinglePositiveOddDigitAndTruePrinter(new Union <int, bool>(false));
         AreEqual(ExpectedBuilder(new[] { "False isn't true or single odd digit." }), sw.ToString());
     }
 }
Exemplo n.º 7
0
 public void SinglePositiveOddDigitAndTruePrinterHandlesTrue()
 {
     using (var sw = new StringWriter())
     {
         Console.SetOut(sw);
         UnionMatcherExamples.SinglePositiveOddDigitAndTruePrinter(new Union <int, bool>(true));
         AreEqual(ExpectedBuilder(new[] { "Found true" }), sw.ToString());
     }
 }
Exemplo n.º 8
0
        public void SinglePositiveOddDigitAndTrueReporterPrints1357And9Correctly()
        {
            var result = UnionMatcherExamples.SinglePositiveOddDigitAndTrueReporter(new Union <int, bool>(1)) +
                         UnionMatcherExamples.SinglePositiveOddDigitAndTrueReporter(new Union <int, bool>(3)) +
                         UnionMatcherExamples.SinglePositiveOddDigitAndTrueReporter(new Union <int, bool>(5)) +
                         UnionMatcherExamples.SinglePositiveOddDigitAndTrueReporter(new Union <int, bool>(7)) +
                         UnionMatcherExamples.SinglePositiveOddDigitAndTrueReporter(new Union <int, bool>(9));

            AreEqual("13579", result);
        }
Exemplo n.º 9
0
        public void SinglePositiveOddDigitAndTruePrinterHandlesEvenNumbers()
        {
            using (var sw = new StringWriter())
            {
                Console.SetOut(sw);

                UnionMatcherExamples.SinglePositiveOddDigitAndTruePrinter(new Union <int, bool>(2));
                UnionMatcherExamples.SinglePositiveOddDigitAndTruePrinter(new Union <int, bool>(4));
                UnionMatcherExamples.SinglePositiveOddDigitAndTruePrinter(new Union <int, bool>(6));

                AreEqual(ExpectedBuilder(new[] { "2 isn't odd", "4 isn't odd", "6 isn't odd" }), sw.ToString());
            }
        }
Exemplo n.º 10
0
        public void SinglePositiveOddDigitAndTruePrinterPrints1357And9Correctly()
        {
            using (var sw = new StringWriter())
            {
                Console.SetOut(sw);

                UnionMatcherExamples.SinglePositiveOddDigitAndTruePrinter(new Union <int, bool>(1));
                UnionMatcherExamples.SinglePositiveOddDigitAndTruePrinter(new Union <int, bool>(3));
                UnionMatcherExamples.SinglePositiveOddDigitAndTruePrinter(new Union <int, bool>(5));
                UnionMatcherExamples.SinglePositiveOddDigitAndTruePrinter(new Union <int, bool>(7));
                UnionMatcherExamples.SinglePositiveOddDigitAndTruePrinter(new Union <int, bool>(9));

                AreEqual(ExpectedBuilder(new[] { "1", "3", "5", "7", "9" }), sw.ToString());
            }
        }
Exemplo n.º 11
0
        public void SinglePositiveOddDigitAndTrueReporterHandles10()
        {
            var result = UnionMatcherExamples.SinglePositiveOddDigitAndTrueReporter(new Union <int, bool>(10));

            AreEqual("10 isn't 1 digit", result);
        }
Exemplo n.º 12
0
        public void SinglePositiveOddDigitAndTrueReporterHandlesNegative()
        {
            var result = UnionMatcherExamples.SinglePositiveOddDigitAndTrueReporter(new Union <int, bool>(-20));

            AreEqual("-20 isn't positive", result);
        }
Exemplo n.º 13
0
        public void SinglePositiveOddDigitAndTrueReporterHandlesTrue()
        {
            var result = UnionMatcherExamples.SinglePositiveOddDigitAndTrueReporter(new Union <int, bool>(true));

            AreEqual("Found true", result);
        }
Exemplo n.º 14
0
        public void PassingFalseToYesNo123OrOtherIntMatcherExampleReturnsNo()
        {
            var result = UnionMatcherExamples.YesNo123OrOtherIntMatcherExample(new Union <int, bool>(false));

            AreEqual("No", result);
        }
Exemplo n.º 15
0
        public void PassingTrueToYesNo123OrOtherIntMatcherExampleReturnsYes()
        {
            var result = UnionMatcherExamples.YesNo123OrOtherIntMatcherExample(new Union <int, bool>(true));

            AreEqual("Yes", result);
        }
Exemplo n.º 16
0
        public void PassingInAnIntToBoolOrIntMatcherExampleReturnsBool()
        {
            var result = UnionMatcherExamples.BoolOrIntMatcherExample(new Union <int, bool>(true));

            AreEqual("bool=True", result);
        }
Exemplo n.º 17
0
        public void PassingInAnIntToBoolOrIntMatcherExampleReturnsAnInt()
        {
            var result = UnionMatcherExamples.BoolOrIntMatcherExample(new Union <int, bool>(2));

            AreEqual("int=2", result);
        }
Exemplo n.º 18
0
        public void SinglePositiveOddDigitAndTrueReporterHandlesFalse()
        {
            var result = UnionMatcherExamples.SinglePositiveOddDigitAndTrueReporter(new Union <int, bool>(false));

            AreEqual("False isn't true or single odd digit.", result);
        }