static public DoesNotContain ( string expected, string actual ) : void | ||
expected | string | The expected string |
actual | string | The string to be examined |
Результат | void |
public virtual void Log_WithParams_automatically_generates_custom_formatter_for_array() { var writer = new StringWriter(); var myInts = new[] { 2222, 3333, 4444 }; using (Log.Events().Subscribe(e => writer.Write(e.ToLogString()))) { Log.WithParams(() => new { myInts }).Write("a message"); } var output = writer.ToString(); StringAssert.Contains("2222", output); StringAssert.Contains("3333", output); StringAssert.Contains("4444", output); StringAssert.DoesNotContain(myInts.ToString(), output); }
public void Parameter_logging_can_be_disabled_per_class() { var log = new StringWriter(); Extension <Boundaries> .DisableFor <InheritedWidget>(); using (Log.Events().Subscribe(e => log.Write(e.ToLogString()))) { var w = new Widget(); var iw = new InheritedWidget(); w.DoStuff("should be in log"); iw.DoStuff("should not be in log"); } StringAssert.Contains("should be in log", log.ToString()); StringAssert.DoesNotContain("should not be in log", log.ToString()); }
public virtual void Log_with_params_can_be_disabled_globally() { Extension <Params> .Disable(); var writer = new StringWriter(); var someGuid = Guid.NewGuid(); using (Log.Events().Subscribe(e => writer.Write(e.ToLogString()))) { Log.WithParams(() => new { someGuid }).Write("a message"); } var output = writer.ToString(); StringAssert.DoesNotContain("someGuid", output); StringAssert.DoesNotContain(someGuid.ToLogString(), output); }