コード例 #1
0
            public void When_IncludeStackTrace_output_includes_stack_trace()
            {
                TestEx.Print(includeStackTrace: true).Should().StartWith(
                    @"CommandDotNet.Tests.UnitTests.Extensions.TestException: I'm a test exception
StackTrace:
  at CommandDotNet.Tests.UnitTests.Extensions.TestException.ThrowEx() in CommandDotNet.Tests/UnitTests/Extensions/TestException.cs:line 46");
            }
コード例 #2
0
            public void When_IncludeProperties_output_includes_properties_except_those_defined_on_exception()
            {
                TestEx.Print(includeProperties: true).Should().Be(
                    @"CommandDotNet.Tests.UnitTests.Extensions.TestException: I'm a test exception
Properties:
  SomeProperty: Some property value");
            }
コード例 #3
0
            public void When_IncludeData_output_includes_values_from_Data_collection()
            {
                TestEx.Print(includeData: true).Should().Be(
                    @"CommandDotNet.Tests.UnitTests.Extensions.TestException: I'm a test exception
Data:
  data-key: data value");
            }
コード例 #4
0
         public void Honors_indent_when_provided()
         {
             TestEx.Print(indent: new Indent(depth: 2), includeProperties: true, includeData: true, includeStackTrace: true)
             .Should().StartWith(
                 @"    CommandDotNet.Tests.UnitTests.Extensions.TestException: I'm a test exception
 Properties:
   SomeProperty: Some property value
 Data:
   data-key: data value
   non-serializable-key: non-serializable-value
 StackTrace:
   at CommandDotNet.Tests.UnitTests.Extensions.TestException.ThrowEx() in CommandDotNet.Tests/UnitTests/Extensions/TestException.cs:line 46");
         }
コード例 #5
0
            public void When_include_all_output_includes_stack_trace()
            {
                TestEx.Print(includeProperties: true, includeData: true, includeStackTrace: true)
                .Should().StartWith(
                    @"CommandDotNet.Tests.UnitTests.Extensions.TestException: I'm a test exception
Properties:
  SomeProperty: Some property value
Data:
  data-key: data value
  non-serializable-key: non-serializable-value
StackTrace:
  at CommandDotNet.Tests.UnitTests.Extensions.TestException.ThrowEx() in CommandDotNet.Tests/UnitTests/Extensions/TestException.cs:line 46");
            }
コード例 #6
0
            public void Prints_to_console_when_provided()
            {
                var testConsole = new TestConsole();

                TestEx.Print(testConsole, includeProperties: true, includeData: true, includeStackTrace: true);
                testConsole.AllText().Should().StartWith(
                    @"CommandDotNet.Tests.UnitTests.Extensions.TestException: I'm a test exception
Properties:
  SomeProperty: Some property value
Data:
  data-key: data value
StackTrace:
  at CommandDotNet.Tests.UnitTests.Extensions.TestException.ThrowEx() in CommandDotNet.Tests/UnitTests/Extensions/TestException.cs:line 37
  at CommandDotNet.Tests.UnitTests.Extensions.TestException.Build() in CommandDotNet.Tests/UnitTests/Extensions/TestException.cs:line 23");
            }
コード例 #7
0
 public void Default_prints_only_the_exception_message()
 {
     TestEx.Print().Should().Be(
         "CommandDotNet.Tests.UnitTests.Extensions.TestException: I'm a test exception");
 }