public void Write(Because because)
        {
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.Write("{0} ", because.TestDescription);
            string       result = because.Passed ? "passed" : "failed";
            ConsoleColor color  = because.Passed ? ConsoleColor.Green : ConsoleColor.Red;

            Console.ForegroundColor = color;
            Console.WriteLine("{0} ", result);
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.Write("\tbecause ");

            if (because.Passed)
            {
                Assertion[] passedAssertions = because.Assertions;
                WritePassedAssertions(passedAssertions);
            }
            else
            {
                Assertion[] failed = (from assertion in because.Assertions
                                      where !assertion.Passed
                                      select assertion).ToArray();
                Console.ForegroundColor = ConsoleColor.Red;
                WriteFailedAssertions(failed);
            }

            Console.WriteLine();
            Console.ResetColor();
        }
Beispiel #2
0
 internal TestContext(SetupContext setupContext, string testDescription)
 {
     this.setupContext  = setupContext;
     this.because       = new Because(testDescription, setupContext);
     this.testMethod    = (o) => { };
     this.altTestMethod = (o, c) => { };
     this.outputAction  = (o) => o;
 }
Beispiel #3
0
 public AssertionWrapper(Because because, object wrapped, string name = null)
 {
     this.Value   = wrapped;
     this.Because = because;
     this.Name    = string.IsNullOrEmpty(name) ? "the value": name;
 }