private static void AddLogging(string message) { Console.ForegroundColor = ConsoleColor.Gray; Console.Clear(); Console.WriteLine(message); var input = Console.ReadLine(); if (input == null) { return; } if (input.ToUpperInvariant() == "L") { Bouncer.AddAfterInvokeAction(x => { var c = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine( @"LOG: " + x.RuleType.Name + @" => " + x.Result + @" for " + x.ValueName + @" ... " + x.Message); Console.ForegroundColor = c; }); } }
public void AfterInvokeTest01() { var ok = true; var isNotNull = new IsNotNullRule <object>(); // we will have one failing test, so "&= false" should set this variable to "false" Bouncer.AddAfterInvokeAction(x => { ok &= x.Result; }); try { new CheckData <object>(() => null).Assert(isNotNull); } catch (Exception) { } Assert.IsFalse(ok); }
public void AfterInvokeTest02() { var ok = false; // we should have one successfull test, so "|= x.Result" should set the variable to true Bouncer.AddAfterInvokeAction(x => { ok |= x.Result; }); var isNotNull = new IsNotNullRule <object>(); try { new CheckData <object>(() => this).Assert(isNotNull); } catch (Exception) { } Assert.IsTrue(ok); }