public void Fail() { var listener = new TestDefaultTraceListener(); listener.Fail("FAIL"); Assert.Contains("FAIL", listener.Output); }
public void Fail_WithoutWriteLineOverride() { var listener = new TestDefaultTraceListener(); listener.ShouldOverrideWriteLine = false; listener.Fail("FAIL"); Assert.False(listener.Output.Contains("FAIL")); }
public void Fail_LogFileDirectoryNotFound() { // Exception should be handled by DefaultTraceListener.WriteLine so no need to assert. var listener = new TestDefaultTraceListener(); listener.LogFileName = $"{Guid.NewGuid().ToString("N")}\\LogFile.txt"; listener.ShouldOverrideWriteLine = false; listener.Fail("FAIL"); }
public void Fail_WithLogFile() { var listener = new TestDefaultTraceListener(); string pathToLogFile = GetTestFilePath(); listener.LogFileName = pathToLogFile; listener.ShouldOverrideWriteLine = false; listener.Fail("FAIL"); Assert.True(File.Exists(pathToLogFile)); Assert.Contains("FAIL", File.ReadAllText(pathToLogFile)); }