public void ReturnsTrueWhenCancellationThunkIsFalse() { var logger = SpyLogger.Create(); var visitor = new StandardOutputVisitor(logger, () => false); var result = visitor.OnMessage(errorMessage); Assert.True(result); }
public void LogsMessage() { var logger = SpyLogger.Create(); var visitor = new StandardOutputVisitor(logger, null); var result = visitor.OnMessage(errorMessage); Assert.Collection(logger.Messages, msg => Assert.Equal("ERROR: ExceptionType: This is my message \\t\\r\\n", msg), msg => Assert.Equal("ERROR: Line 1\r\nLine 2\r\nLine 3", msg)); }
public void LogsMessage() { var errorMessage = Substitute.For<IErrorMessage>(); errorMessage.ExceptionType.Returns("ExceptionType"); errorMessage.Message.Returns("This is my message \t\r\n"); errorMessage.StackTrace.Returns("Line 1\r\nLine 2\r\nLine 3"); var logger = SpyLogger.Create(); var visitor = new StandardOutputVisitor(logger, null, false, null); visitor.OnMessage(errorMessage); Assert.Collection(logger.Messages, msg => Assert.Equal("ERROR: ExceptionType: This is my message \\t\\r\\n", msg), msg => Assert.Equal("ERROR: Line 1\r\nLine 2\r\nLine 3", msg)); }
public void LogsTestNameWithExceptionAndStackTrace() { var testFailed = Substitute.For<ITestFailed>(); testFailed.TestDisplayName.Returns("This is my display name \t\r\n"); testFailed.Message.Returns("This is my message \t\r\n"); testFailed.StackTrace.Returns("Line 1\r\nLine 2\r\nLine 3"); var logger = SpyLogger.Create(); var visitor = new StandardOutputVisitor(logger, null, false, null); visitor.OnMessage(testFailed); Assert.Collection(logger.Messages, msg => Assert.Equal("ERROR: This is my display name \\t\\r\\n: This is my message \\t\\r\\n", msg), msg => Assert.Equal("ERROR: Line 1\r\nLine 2\r\nLine 3", msg)); }
public void LogsMessageWithStatitics() { var assemblyStarting = Substitute.For<ITestAssemblyStarting>(); assemblyStarting.AssemblyFileName.Returns(@"C:\Assembly\File.dll"); var assemblyFinished = Substitute.For<ITestAssemblyFinished>(); assemblyFinished.TestsRun.Returns(2112); assemblyFinished.TestsFailed.Returns(42); assemblyFinished.TestsSkipped.Returns(6); assemblyFinished.ExecutionTime.Returns(123.4567M); var logger = SpyLogger.Create(); var visitor = new StandardOutputVisitor(logger, null, false, null); visitor.OnMessage(assemblyStarting); visitor.OnMessage(assemblyFinished); Assert.Single(logger.Messages, "MESSAGE[High]: Started: File.dll"); Assert.Single(logger.Messages, "MESSAGE[High]: Finished: File.dll"); }
public void AddsStatisticsToRunningTotal() { var logger = SpyLogger.Create(); var visitor = new StandardOutputVisitor(logger, null) { Total = 10, Failed = 10, Skipped = 10, Time = 10M }; visitor.OnMessage(assemblyFinished); Assert.Equal(2122, visitor.Total); Assert.Equal(52, visitor.Failed); Assert.Equal(16, visitor.Skipped); Assert.Equal(133.4567M, visitor.Time); }
public void ReturnsFalseWhenCancellationThunkIsTrue() { var logger = SpyLogger.Create(); var visitor = new StandardOutputVisitor(logger, () => true); var result = visitor.OnMessage(testSkipped); Assert.False(result); }
public void LogsTestNameAsWarning() { var logger = SpyLogger.Create(); var visitor = new StandardOutputVisitor(logger, null); visitor.OnMessage(testSkipped); Assert.Single(logger.Messages, "WARNING: This is my display name \\t\\r\\n: This is my skip reason \\t\\r\\n"); }
public void LogsTestName() { var logger = SpyLogger.Create(); var visitor = new StandardOutputVisitor(logger, null); visitor.OnMessage(testPassed); Assert.Single(logger.Messages, "MESSAGE[Normal]: This is my display name \\t\\r\\n"); }
public void LogsTestNameWithExceptionAndStackTrace() { var logger = SpyLogger.Create(); var visitor = new StandardOutputVisitor(logger, null); visitor.OnMessage(testFailed); Assert.Collection(logger.Messages, msg => Assert.Equal("ERROR: This is my display name \\t\\r\\n: This is my message \\t\\r\\n", msg), msg => Assert.Equal("ERROR: Line 1\r\nLine 2\r\nLine 3", msg)); }
public void LogsMessageWithStatitics() { var logger = SpyLogger.Create(); var visitor = new StandardOutputVisitor(logger, null); visitor.OnMessage(assemblyFinished); Assert.Single(logger.Messages, "MESSAGE[High]: Tests: 2112, Failures: 42, Skipped: 6, Time: 123.457 seconds"); }
public void NullStackTraceDoesNotLogStackTrace() { var testFailed = Substitute.For<ITestFailed>(); testFailed.TestDisplayName.Returns("1"); testFailed.Message.Returns("2"); testFailed.StackTrace.Returns((string)null); var logger = SpyLogger.Create(); var visitor = new StandardOutputVisitor(logger, null, false, null); visitor.OnMessage(testFailed); Assert.Collection(logger.Messages, msg => Assert.Equal("ERROR: 1: 2", msg)); }
public void OutputStartMessageWhenInVerboseMode() { var logger = SpyLogger.Create(); var visitor = new StandardOutputVisitor(logger, null, true, null); visitor.OnMessage(testStarting); Assert.Single(logger.Messages, "MESSAGE[Normal]: START: This is my display name \\t\\r\\n"); }
public void NoOutputWhenNotInVerboseMode() { var logger = SpyLogger.Create(); var visitor = new StandardOutputVisitor(logger, null, false, null); visitor.OnMessage(testStarting); Assert.Empty(logger.Messages); }
public void LogsTestNameAsWarning() { var testSkipped = Substitute.For<ITestSkipped>(); testSkipped.TestDisplayName.Returns("This is my display name \t\r\n"); testSkipped.Reason.Returns("This is my skip reason \t\r\n"); var logger = SpyLogger.Create(); var visitor = new StandardOutputVisitor(logger, null, false, null); visitor.OnMessage(testSkipped); Assert.Single(logger.Messages, "WARNING: This is my display name \\t\\r\\n: This is my skip reason \\t\\r\\n"); }
public void AddsPassToLogWhenInVerboseMode() { var logger = SpyLogger.Create(); var visitor = new StandardOutputVisitor(logger, null, true, null); visitor.OnMessage(testPassed); Assert.Single(logger.Messages, "MESSAGE[Normal]: PASS: This is my display name \\t\\r\\n"); }