public void ShouldDumpGenericClass_WithMultipleGenericTypeArguments() { // Arrange var person = PersonFactory.GeneratePersons(count: 1).First(); var genericClass = new GenericClass <string, float, Person> { Prop1 = "Test", Prop2 = 123.45f, Prop3 = person }; // Act var dump = ObjectDumperCSharp.Dump(genericClass); // Assert this.testOutputHelper.WriteLine(dump); dump.Should().NotBeNull(); dump.Should().Be( "var genericClass = new GenericClass<string, float, Person>\r\n" + "{\r\n" + " Prop1 = \"Test\",\r\n" + " Prop2 = 123.45f,\r\n" + " Prop3 = new Person\r\n" + " {\r\n" + " Name = \"Person 1\",\r\n" + " Char = '',\r\n" + " Age = 2,\r\n" + " GetOnly = 11,\r\n" + " Bool = false,\r\n Byte = 0,\r\n ByteArray = new byte[]\r\n {\r\n 1,\r\n 2,\r\n 3,\r\n 4\r\n },\r\n SByte = 0,\r\n Float = 0f,\r\n Uint = 0u,\r\n Long = 0L,\r\n ULong = 0UL,\r\n Short = 0,\r\n UShort = 0,\r\n Decimal = 0m,\r\n Double = 0d,\r\n DateTime = DateTime.MinValue,\r\n NullableDateTime = null,\r\n Enum = DateTimeKind.Unspecified\r\n }\r\n};"); }
public void ShouldDumpObject() { // Arrange var person = PersonFactory.GeneratePersons(count: 1).Single(); // Act var dump = ObjectDumperConsole.Dump(person); // Assert this.testOutputHelper.WriteLine(dump); dump.Should().NotBeNull(); dump.Should().Be( "{Person}\r\n" + " Name: \"Person 1\"\r\n" + " Char: ''\r\n" + " Age: 2\r\n" + " GetOnly: 11\r\n" + " Bool: false\r\n" + " Byte: 0\r\n" + " ByteArray: ...\r\n" + " 1\r\n 2\r\n 3\r\n 4\r\n" + " SByte: 0\r\n" + " Float: 0\r\n" + " Uint: 0\r\n" + " Long: 0\r\n" + " ULong: 0\r\n" + " Short: 0\r\n" + " UShort: 0\r\n" + " Decimal: 0\r\n" + " Double: 0\r\n" + " DateTime: DateTime.MinValue\r\n" + " NullableDateTime: null\r\n" + " Enum: DateTimeKind.Unspecified"); }
public void ShouldDumpObjectWithMaxLevel() { // Arrange var persons = PersonFactory.GeneratePersons(count: 2).ToList(); var organization = new Organization { Name = "superdev gmbh", Persons = persons }; var options = new DumpOptions { MaxLevel = 1 }; // Act var dump = ObjectDumperCSharp.Dump(organization, options); // Assert this.testOutputHelper.WriteLine(dump); dump.Should().NotBeNull(); dump.Should().Be( "var organization = new Organization\r\n" + "{\r\n" + " Name = \"superdev gmbh\",\r\n" + " Persons = new List<Person>\r\n" + " {\r\n" + " },\r\n" + " IsAfterCollection = true\r\n" + "};"); }
public void ShouldDumpEnumerable() { // Arrange var persons = PersonFactory.GeneratePersons(count: 2).ToList(); // Act var dump = ObjectDumperCSharp.Dump(persons); // Assert this.testOutputHelper.WriteLine(dump); dump.Should().NotBeNull(); dump.Should().Be( "var listOfPersons = new List<Person>\r\n" + "{\r\n" + " new Person\r\n" + " {\r\n" + " Name = \"Person 1\",\r\n" + " Char = '',\r\n" + " Age = 3,\r\n" + " GetOnly = 11,\r\n" + " Bool = false,\r\n" + " Byte = 0,\r\n" + " ByteArray = new byte[]\r\n" + " {\r\n 1,\r\n 2,\r\n 3,\r\n 4\r\n },\r\n SByte = 0,\r\n Float = 0f,\r\n Uint = 0u,\r\n Long = 0L,\r\n ULong = 0UL,\r\n Short = 0,\r\n UShort = 0,\r\n Decimal = 0m,\r\n Double = 0d,\r\n DateTime = DateTime.MinValue,\r\n NullableDateTime = null,\r\n Enum = DateTimeKind.Unspecified\r\n" + " },\r\n" + " new Person\r\n" + " {\r\n" + " Name = \"Person 2\",\r\n" + " Char = '',\r\n" + " Age = 3,\r\n" + " GetOnly = 11,\r\n" + " Bool = false,\r\n" + " Byte = 0,\r\n" + " ByteArray = new byte[]\r\n" + " {\r\n" + " 1,\r\n" + " 2,\r\n" + " 3,\r\n" + " 4\r\n" + " },\r\n" + " SByte = 0,\r\n" + " Float = 0f,\r\n" + " Uint = 0u,\r\n" + " Long = 0L,\r\n" + " ULong = 0UL,\r\n" + " Short = 0,\r\n" + " UShort = 0,\r\n" + " Decimal = 0m,\r\n" + " Double = 0d,\r\n" + " DateTime = DateTime.MinValue,\r\n" + " NullableDateTime = null,\r\n" + " Enum = DateTimeKind.Unspecified\r\n" + " }\r\n" + "};"); }
public void ShouldDumpEnumerable() { // Arrange var persons = PersonFactory.GeneratePersons(count: 2); // Act var dump = ObjectDumperConsole.Dump(persons); // Assert this.testOutputHelper.WriteLine(dump); dump.Should().NotBeNull(); dump.Should().Be("{ObjectDumping.Tests.Testdata.Person}\r\n Name: \"Person 1\"\r\n Char: \r\n Age: 3\r\n GetOnly: 11\r\n Bool: False\r\n Byte: 0\r\n ByteArray: ...\r\n 1\r\n 2\r\n 3\r\n 4\r\n SByte: 0\r\n Float: 0\r\n Uint: 0\r\n Long: 0\r\n ULong: 0\r\n Short: 0\r\n UShort: 0\r\n Decimal: 0\r\n Double: 0\r\n DateTime: 01.01.0001 00:00:00\r\n NullableDateTime: null\r\n Enum: Unspecified\r\n\r\n{ObjectDumping.Tests.Testdata.Person}\r\n Name: \"Person 2\"\r\n Char: \r\n Age: 3\r\n GetOnly: 11\r\n Bool: False\r\n Byte: 0\r\n ByteArray: ...\r\n 1\r\n 2\r\n 3\r\n 4\r\n SByte: 0\r\n Float: 0\r\n Uint: 0\r\n Long: 0\r\n ULong: 0\r\n Short: 0\r\n UShort: 0\r\n Decimal: 0\r\n Double: 0\r\n DateTime: 01.01.0001 00:00:00\r\n NullableDateTime: null\r\n Enum: Unspecified\r\n\r\n"); }
public void ShouldDumpEnumerable() { // Arrange var persons = PersonFactory.GeneratePersons(count: 2); // Act var dump = ObjectDumperConsole.Dump(persons); // Assert this.testOutputHelper.WriteLine(dump); dump.Should().NotBeNull(); dump.Should().Be("{System.Diagnostics.Tests.Testdata.Person}\n\r Name: \"Person 1\"\n\r Char: \n\r Age: 3\n\r GetOnly: 11\n\r Bool: False\n\r Byte: 0\n\r ByteArray: ...\n\r 1\n\r 2\n\r 3\n\r 4\n\r SByte: 0\n\r Float: 0\n\r Uint: 0\n\r Long: 0\n\r ULong: 0\n\r Short: 0\n\r UShort: 0\n\r Decimal: 0\n\r Double: 0\n\r DateTime: 01.01.0001 00:00:00\n\r NullableDateTime: null\n\r Enum: Unspecified\n\r\n\r{System.Diagnostics.Tests.Testdata.Person}\n\r Name: \"Person 2\"\n\r Char: \n\r Age: 3\n\r GetOnly: 11\n\r Bool: False\n\r Byte: 0\n\r ByteArray: ...\n\r 1\n\r 2\n\r 3\n\r 4\n\r SByte: 0\n\r Float: 0\n\r Uint: 0\n\r Long: 0\n\r ULong: 0\n\r Short: 0\n\r UShort: 0\n\r Decimal: 0\n\r Double: 0\n\r DateTime: 01.01.0001 00:00:00\n\r NullableDateTime: null\n\r Enum: Unspecified\n\r\n\r"); }
public void ShouldDumpEnumerable() { // Arrange var persons = PersonFactory.GeneratePersons(count: 2).ToList(); // Act var dump = ObjectDumperCSharp.Dump(persons); // Assert this.testOutputHelper.WriteLine(dump); dump.Should().NotBeNull(); dump.Should().Be("var listPerson = new List<Person>\n\r{\n\r new Person\n\r {\n\r Name = \"Person 1\",\n\r Char = '',\n\r Age = 3,\n\r GetOnly = 11,\n\r Bool = false,\n\r Byte = 0,\n\r ByteArray = new Byte[]\n\r {\n\r 1,\n\r 2,\n\r 3,\n\r 4\n\r },\n\r SByte = 0,\n\r Float = 0f,\n\r Uint = 0,\n\r Long = 0L,\n\r ULong = 0L,\n\r Short = 0,\n\r UShort = 0,\n\r Decimal = 0m,\n\r Double = 0d,\n\r DateTime = DateTime.MinValue,\n\r NullableDateTime = null,\n\r Enum = System.DateTimeKind.Unspecified\n\r },\n\r new Person\n\r {\n\r Name = \"Person 2\",\n\r Char = '',\n\r Age = 3,\n\r GetOnly = 11,\n\r Bool = false,\n\r Byte = 0,\n\r ByteArray = new Byte[]\n\r {\n\r 1,\n\r 2,\n\r 3,\n\r 4\n\r },\n\r SByte = 0,\n\r Float = 0f,\n\r Uint = 0,\n\r Long = 0L,\n\r ULong = 0L,\n\r Short = 0,\n\r UShort = 0,\n\r Decimal = 0m,\n\r Double = 0d,\n\r DateTime = DateTime.MinValue,\n\r NullableDateTime = null,\n\r Enum = System.DateTimeKind.Unspecified\n\r }\n\r};"); }
public void ShouldRoslynDumpEnumerable() { // Arrange var persons = PersonFactory.GeneratePersons(2).ToList(); // Act var roslynDumper = new RoslynDumper(); var dump = roslynDumper.Dump(persons); // Assert testOutputHelper.WriteLine(dump); dump.Should().NotBeNullOrWhiteSpace(); dump.Should().Be("var listOfPersons = new List<Person>{new Person{Name = \"Person 1\", Char = '\\0', Age = 3, GetOnly = 11, Bool = false, Byte = 0, ByteArray = new Byte[]{1, 2, 3, 4}, SByte = 0, Float = 0F, Uint = 0U, Long = 0L, ULong = 0UL, Short = 0, UShort = 0, Decimal = 0M, Double = 0, DateTime = DateTime.MinValue, NullableDateTime = null, Enum = System.DateTimeKind.Unspecified}, new Person{Name = \"Person 2\", Char = '\\0', Age = 3, GetOnly = 11, Bool = false, Byte = 0, ByteArray = new Byte[]{1, 2, 3, 4}, SByte = 0, Float = 0F, Uint = 0U, Long = 0L, ULong = 0UL, Short = 0, UShort = 0, Decimal = 0M, Double = 0, DateTime = DateTime.MinValue, NullableDateTime = null, Enum = System.DateTimeKind.Unspecified}};"); }
public void ShouldDumpMultipleGenericTypes() { // Arrange var person = PersonFactory.GeneratePersons(count: 1).First(); var genericClass = new GenericClass <string, float, Person> { Prop1 = "Test", Prop2 = 123.45f, Prop3 = person }; // Act var dump = ObjectDumperConsole.Dump(genericClass); // Assert this.testOutputHelper.WriteLine(dump); dump.Should().NotBeNull(); dump.Should().Be("{ObjectDumping.Tests.Testdata.GenericClass<System.String, System.Single, ObjectDumping.Tests.Testdata.Person>}\r\n Prop1: \"Test\"\r\n Prop2: 123.45\r\n Prop3: { }\r\n {ObjectDumping.Tests.Testdata.Person}\r\n Name: \"Person 1\"\r\n Char: \r\n Age: 2\r\n GetOnly: 11\r\n Bool: False\r\n Byte: 0\r\n ByteArray: ...\r\n 1\r\n 2\r\n 3\r\n 4\r\n SByte: 0\r\n Float: 0\r\n Uint: 0\r\n Long: 0\r\n ULong: 0\r\n Short: 0\r\n UShort: 0\r\n Decimal: 0\r\n Double: 0\r\n DateTime: 01.01.0001 00:00:00\r\n NullableDateTime: null\r\n Enum: Unspecified\r\n"); }
public void ShouldDumpNestedObjects() { // Arrange var persons = PersonFactory.GeneratePersons(count: 2).ToList(); var organization = new Organization { Name = "superdev gmbh", Persons = persons }; // Act var dump = ObjectDumperCSharp.Dump(organization); // Assert this.testOutputHelper.WriteLine(dump); dump.Should().NotBeNull(); dump.Should().Be("var organization = new Organization\r\n{\r\n Name = \"superdev gmbh\",\r\n Persons = new List<Person>\r\n {\r\n new Person\r\n {\r\n Name = \"Person 1\",\r\n Char = '',\r\n Age = 3,\r\n GetOnly = 11,\r\n Bool = false,\r\n Byte = 0,\r\n ByteArray = new Byte[]\r\n {\r\n 1,\r\n 2,\r\n 3,\r\n 4\r\n },\r\n SByte = 0,\r\n Float = 0f,\r\n Uint = 0,\r\n Long = 0L,\r\n ULong = 0L,\r\n Short = 0,\r\n UShort = 0,\r\n Decimal = 0m,\r\n Double = 0d,\r\n DateTime = DateTime.MinValue,\r\n NullableDateTime = null,\r\n Enum = System.DateTimeKind.Unspecified\r\n },\r\n new Person\r\n {\r\n Name = \"Person 2\",\r\n Char = '',\r\n Age = 3,\r\n GetOnly = 11,\r\n Bool = false,\r\n Byte = 0,\r\n ByteArray = new Byte[]\r\n {\r\n 1,\r\n 2,\r\n 3,\r\n 4\r\n },\r\n SByte = 0,\r\n Float = 0f,\r\n Uint = 0,\r\n Long = 0L,\r\n ULong = 0L,\r\n Short = 0,\r\n UShort = 0,\r\n Decimal = 0m,\r\n Double = 0d,\r\n DateTime = DateTime.MinValue,\r\n NullableDateTime = null,\r\n Enum = System.DateTimeKind.Unspecified\r\n }\r\n }\r\n};"); }
public void ShouldDumpMultipleGenericTypes() { // Arrange var person = PersonFactory.GeneratePersons(count: 1).First(); var genericClass = new GenericClass <string, float, Person> { Prop1 = "Test", Prop2 = 123.45f, Prop3 = person }; // Act var dump = ObjectDumperConsole.Dump(genericClass); // Assert this.testOutputHelper.WriteLine(dump); dump.Should().NotBeNull(); dump.Should().Be("{System.Diagnostics.Tests.Testdata.GenericClass<System.String, System.Single, System.Diagnostics.Tests.Testdata.Person>}\n\r Prop1: \"Test\"\n\r Prop2: 123.45\n\r Prop3: { }\n\r {System.Diagnostics.Tests.Testdata.Person}\n\r Name: \"Person 1\"\n\r Char: \n\r Age: 2\n\r GetOnly: 11\n\r Bool: False\n\r Byte: 0\n\r ByteArray: ...\n\r 1\n\r 2\n\r 3\n\r 4\n\r SByte: 0\n\r Float: 0\n\r Uint: 0\n\r Long: 0\n\r ULong: 0\n\r Short: 0\n\r UShort: 0\n\r Decimal: 0\n\r Double: 0\n\r DateTime: 01.01.0001 00:00:00\n\r NullableDateTime: null\n\r Enum: Unspecified\n\r"); }
public void ShouldDumpMultipleGenericTypes() { // Arrange var person = PersonFactory.GeneratePersons(count: 1).First(); var genericClass = new GenericClass <string, float, Person> { Prop1 = "Test", Prop2 = 123.45f, Prop3 = person }; // Act var dump = ObjectDumperCSharp.Dump(genericClass); // Assert this.testOutputHelper.WriteLine(dump); dump.Should().NotBeNull(); dump.Should().Be("var genericClass = new GenericClass<String, Single, Person>\n\r{\n\r Prop1 = \"Test\",\n\r Prop2 = 123.45f,\n\r Prop3 = new Person\n\r {\n\r Name = \"Person 1\",\n\r Char = '',\n\r Age = 2,\n\r GetOnly = 11,\n\r Bool = false,\n\r Byte = 0,\n\r ByteArray = new Byte[]\n\r {\n\r 1,\n\r 2,\n\r 3,\n\r 4\n\r },\n\r SByte = 0,\n\r Float = 0f,\n\r Uint = 0,\n\r Long = 0L,\n\r ULong = 0L,\n\r Short = 0,\n\r UShort = 0,\n\r Decimal = 0m,\n\r Double = 0d,\n\r DateTime = DateTime.MinValue,\n\r NullableDateTime = null,\n\r Enum = System.DateTimeKind.Unspecified\n\r }\n\r};"); }
public void ShouldDumpRecursiveTypes_RuntimeProperties() { // Arrange var person = PersonFactory.GeneratePersons(count: 1).Single(); var properties = person.GetType().GetRuntimeProperties(); var options = new DumpOptions { MaxLevel = 2 }; // Act var dump = ObjectDumperConsole.Dump(properties, options); // Assert this.testOutputHelper.WriteLine(dump); dump.Should().NotBeNull(); }
public void ShouldDumpEnumerable_ValueTuples() { // Arrange var persons = PersonFactory.GeneratePersons(count: 2).ToList(); var valueTuples = persons.Select(s => (s.Name, s.Age)).ToList(); // Act var dump = ObjectDumperConsole.Dump(valueTuples); // Assert this.testOutputHelper.WriteLine(dump); dump.Should().NotBeNull(); dump.Should().Be( "(\"Person 1\", 3)\r\n" + "(\"Person 2\", 3)"); }
public void ShouldDumpGenericClass_WithMultipleGenericTypeArguments() { // Arrange var person = PersonFactory.GeneratePersons(count: 1).First(); var genericClass = new GenericClass <string, float, Person> { Prop1 = "Test", Prop2 = 123.45f, Prop3 = person }; // Act var dump = ObjectDumperConsole.Dump(genericClass); // Assert this.testOutputHelper.WriteLine(dump); dump.Should().NotBeNull(); dump.Should().Be( "{GenericClass<string, float, Person>}\r\n" + " Prop1: \"Test\"\r\n" + " Prop2: 123.45\r\n" + " Prop3: {Person}\r\n" + " Name: \"Person 1\"\r\n" + " Char: ''\r\n" + " Age: 2\r\n" + " GetOnly: 11\r\n" + " Bool: false\r\n" + " Byte: 0\r\n" + " ByteArray: ...\r\n" + " 1\r\n" + " 2\r\n" + " 3\r\n" + " 4\r\n" + " SByte: 0\r\n" + " Float: 0\r\n" + " Uint: 0\r\n" + " Long: 0\r\n" + " ULong: 0\r\n" + " Short: 0\r\n" + " UShort: 0\r\n" + " Decimal: 0\r\n" + " Double: 0\r\n" + " DateTime: DateTime.MinValue\r\n" + " NullableDateTime: null\r\n" + " Enum: DateTimeKind.Unspecified"); }
public void ShouldDumpObjectWithMaxLevel() { // Arrange var persons = PersonFactory.GeneratePersons(count: 2).ToList(); var organization = new Organization { Name = "superdev gmbh", Persons = persons }; var options = new DumpOptions { MaxLevel = 1 }; // Act var dump = ObjectDumperConsole.Dump(organization, options); // Assert this.testOutputHelper.WriteLine(dump); dump.Should().NotBeNull(); dump.Should().Be("{ObjectDumping.Tests.Testdata.Organization}\r\n Name: \"superdev gmbh\"\r\n Persons: ...\r\n"); }
public void ShouldDumpGenericClass_WithMultipleGenericTypeArguments() { // Arrange var person = PersonFactory.GeneratePersons(1).First(); var genericClass = new GenericClass <string, float, Person> { Prop1 = "Test", Prop2 = 123.45f, Prop3 = person }; // Act var roslynDumper = new RoslynDumper(); var dump = roslynDumper.Dump(genericClass); // Assert testOutputHelper.WriteLine(dump); //my output isn't the same because //1. same issues as ShouldRoslynDumpNestedObjects //2. <String, Single, Person> is not being written correctly dump.Should().NotBeNull(); dump.Should().Be("var genericClass = new GenericClass<String, Single, Person>\r\n{\r\n Prop1 = \"Test\",\r\n Prop2 = 123.45f,\r\n Prop3 = new Person\r\n {\r\n Name = \"Person 1\",\r\n Char = '',\r\n Age = 2,\r\n GetOnly = 11,\r\n Bool = false,\r\n Byte = 0,\r\n ByteArray = new Byte[]\r\n {\r\n 1,\r\n 2,\r\n 3,\r\n 4\r\n },\r\n SByte = 0,\r\n Float = 0f,\r\n Uint = 0,\r\n Long = 0L,\r\n ULong = 0L,\r\n Short = 0,\r\n UShort = 0,\r\n Decimal = 0m,\r\n Double = 0d,\r\n DateTime = DateTime.MinValue,\r\n NullableDateTime = null,\r\n Enum = System.DateTimeKind.Unspecified\r\n }\r\n};"); }
public void ShouldDumpObject_WithDumpOptions() { // Arrange var person = PersonFactory.GeneratePersons(count: 1).Single(); var options = new DumpOptions { IndentChar = '\t', IndentSize = 1, SetPropertiesOnly = true }; // Act var dump = ObjectDumperConsole.Dump(person, options); // Assert this.testOutputHelper.WriteLine(dump); dump.Should().NotBeNull(); dump.Should().Be("{Person}\r\n" + " Name: \"Person 1\"\r\n"+ " Char: ''\r\n"+ " Age: 2\r\n"+ " Bool: false\r\n"+ " Byte: 0\r\n ByteArray: ...\r\n"+ " 1\r\n"+ " 2\r\n"+ " 3\r\n"+ " 4\r\n"+ " SByte: 0\r\n"+ " Float: 0\r\n"+ " Uint: 0\r\n"+ " Long: 0\r\n ULong: 0\r\n"+ " Short: 0\r\n"+ " UShort: 0\r\n"+ " Decimal: 0\r\n"+ " Double: 0\r\n DateTime: DateTime.MinValue\r\n"+ " NullableDateTime: null\r\n"+ " Enum: DateTimeKind.Unspecified"); }
public void ShouldDumpNestedObjects() { // Arrange var persons = PersonFactory.GeneratePersons(count: 2).ToList(); var organization = new Organization { Name = "superdev gmbh", Persons = persons }; // Act var dump = ObjectDumperConsole.Dump(organization); // Assert this.testOutputHelper.WriteLine(dump); dump.Should().NotBeNull(); dump.Should().Be( "{Organization}\r\n" + " Name: \"superdev gmbh\"\r\n" + " Persons: ...\r\n" + " {Person}\r\n" + " Name: \"Person 1\"\r\n" + " Char: ''\r\n" + " Age: 3\r\n" + " GetOnly: 11\r\n" + " Bool: false\r\n" + " Byte: 0\r\n" + " ByteArray: ...\r\n" + " 1\r\n" + " 2\r\n" + " 3\r\n" + " 4\r\n" + " SByte: 0\r\n" + " Float: 0\r\n" + " Uint: 0\r\n" + " Long: 0\r\n" + " ULong: 0\r\n" + " Short: 0\r\n" + " UShort: 0\r\n" + " Decimal: 0\r\n" + " Double: 0\r\n" + " DateTime: DateTime.MinValue\r\n" + " NullableDateTime: null\r\n" + " Enum: DateTimeKind.Unspecified\r\n" + " {Person}\r\n" + " Name: \"Person 2\"\r\n" + " Char: ''\r\n" + " Age: 3\r\n" + " GetOnly: 11\r\n" + " Bool: false\r\n" + " Byte: 0\r\n" + " ByteArray: ...\r\n" + " 1\r\n" + " 2\r\n" + " 3\r\n" + " 4\r\n" + " SByte: 0\r\n" + " Float: 0\r\n" + " Uint: 0\r\n" + " Long: 0\r\n" + " ULong: 0\r\n" + " Short: 0\r\n" + " UShort: 0\r\n" + " Decimal: 0\r\n" + " Double: 0\r\n" + " DateTime: DateTime.MinValue\r\n" + " NullableDateTime: null\r\n" + " Enum: DateTimeKind.Unspecified\r\n" + " IsAfterCollection: true"); }
public void ShouldDumpNestedObjects() { // Arrange var persons = PersonFactory.GeneratePersons(count: 2).ToList(); var organization = new Organization { Name = "superdev gmbh", Persons = persons }; // Act var dump = ObjectDumperCSharp.Dump(organization); // Assert this.testOutputHelper.WriteLine(dump); dump.Should().NotBeNull(); dump.Should().Be( "var organization = new Organization\r\n" + "{\r\n" + " Name = \"superdev gmbh\",\r\n" + " Persons = new List<Person>\r\n" + " {\r\n" + " new Person\r\n" + " {\r\n" + " Name = \"Person 1\",\r\n" + " Char = '',\r\n" + " Age = 3,\r\n" + " GetOnly = 11,\r\n" + " Bool = false,\r\n" + " Byte = 0,\r\n" + " ByteArray = new byte[]\r\n" + " {\r\n" + " 1,\r\n" + " 2,\r\n" + " 3,\r\n" + " 4\r\n" + " },\r\n" + " SByte = 0,\r\n" + " Float = 0f,\r\n" + " Uint = 0u,\r\n" + " Long = 0L,\r\n" + " ULong = 0UL,\r\n" + " Short = 0,\r\n" + " UShort = 0,\r\n" + " Decimal = 0m,\r\n" + " Double = 0d,\r\n" + " DateTime = DateTime.MinValue,\r\n" + " NullableDateTime = null,\r\n" + " Enum = DateTimeKind.Unspecified\r\n" + " },\r\n" + " new Person\r\n" + " {\r\n" + " Name = \"Person 2\",\r\n" + " Char = '',\r\n" + " Age = 3,\r\n" + " GetOnly = 11,\r\n" + " Bool = false,\r\n" + " Byte = 0,\r\n" + " ByteArray = new byte[]\r\n" + " {\r\n" + " 1,\r\n" + " 2,\r\n" + " 3,\r\n" + " 4\r\n" + " },\r\n" + " SByte = 0,\r\n" + " Float = 0f,\r\n" + " Uint = 0u,\r\n" + " Long = 0L,\r\n" + " ULong = 0UL,\r\n" + " Short = 0,\r\n" + " UShort = 0,\r\n" + " Decimal = 0m,\r\n" + " Double = 0d,\r\n" + " DateTime = DateTime.MinValue,\r\n" + " NullableDateTime = null,\r\n" + " Enum = DateTimeKind.Unspecified\r\n" + " }\r\n" + " },\r\n" + " IsAfterCollection = true\r\n" + "};"); }