Beispiel #1
0
        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 BuildFailureThrowsExceptionWithNullTypeTest()
        {
            var target = new DefaultBuildLog();

            Action action = () => target.BuildFailure(null);

            action.ShouldThrow<ArgumentNullException>();
        }
Beispiel #3
0
        public void BuildFailureDoesNotWriteLogWhenDisabled()
        {
            var ex = new BuildException(Guid.NewGuid().ToString());

            var sut = new DefaultBuildLog();

            sut.BuildFailure(ex);

            sut.Output.Should().BeEmpty();
        }
        public void BuildFailureAppendsLogEntryTest()
        {
            var ex = new BuildException(Guid.NewGuid().ToString());

            var target = new DefaultBuildLog();

            target.BuildFailure(ex);

            target.Output.Should().Contain(ex.ToString());
        }
Beispiel #5
0
        public void BuildFailureAppendsLogEntry()
        {
            var ex = new BuildException(Guid.NewGuid().ToString());

            var sut = new DefaultBuildLog {
                IsEnabled = true
            };

            sut.BuildFailure(ex);

            sut.Output.Should().Contain(ex.ToString());
        }
        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();
        }