public void WritingLogEntryIndentsAllLinesOfMessage() { var creatorType = typeof(DefaultTypeCreator); var sut = new DefaultBuildLog { IsEnabled = true }; Exception exception; try { throw new TimeoutException(); } catch (TimeoutException ex) { // Get the exception with a valid stack trace exception = ex; } sut.CreatingType(typeof(Person), creatorType, null !); sut.BuildFailure(exception); sut.CreatedType(typeof(Person), null !); var lines = sut.Output.Split( new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); var indentedLines = lines.Skip(1).Take(lines.Length - 2); indentedLines.All(x => x.StartsWith(" ", StringComparison.OrdinalIgnoreCase)).Should().BeTrue(); }
public void CreatedTypeDoesNotWriteLogWhenDisabled() { var sut = new DefaultBuildLog(); sut.CreatedType(typeof(string), null !); sut.Output.Should().BeEmpty(); }
public void CreatedTypeThrowsExceptionWithNullTypeTest() { var target = new DefaultBuildLog(); Action action = () => target.CreatedType(null, null); action.ShouldThrow<ArgumentNullException>(); }
public void CreatedTypeAppendsLogEntryTest() { var target = new DefaultBuildLog(); target.CreatedType(typeof(string), null); target.Output.Should().NotBeNullOrWhiteSpace(); }
public void CreatedTypeAppendsLogEntry() { var sut = new DefaultBuildLog { IsEnabled = true }; sut.CreatedType(typeof(string), null !); sut.Output.Should().NotBeNullOrWhiteSpace(); }
public void CreateTypeIndentsChildMessages() { var generatorType = typeof(StateValueGenerator); var creatorType = typeof(DefaultTypeCreator); var sut = new DefaultBuildLog { IsEnabled = true }; sut.CreatingType(typeof(Person), creatorType, null !); sut.CreatingValue(typeof(string), generatorType, null !); sut.CreatedType(typeof(Person), null !); var actual = sut.Output; actual.Should().Contain(" "); }
public void WritingLogEntryIndentsAllLinesOfMessageTest() { var target = new DefaultBuildLog(); Exception exception; try { throw new TimeoutException(); } catch (Exception ex) { // Get the exception with a valid stack trace exception = ex; } target.CreatingType(typeof(Person), null); target.BuildFailure(exception); target.CreatedType(typeof(Person), null); var lines = target.Output.Split( new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); var indentedLines = lines.Skip(1).Take(lines.Length - 2); indentedLines.All(x => x.StartsWith(" ")).Should().BeTrue(); }
public void CreateTypeIndentsChildMessagesTest() { var target = new DefaultBuildLog(); target.CreatingType(typeof(Person), null); target.CreatingValue(typeof(string), null); target.CreatedType(typeof(Person), null); var actual = target.Output; actual.Should().Contain(" "); }