public void PropertiesToStringTest() { var personRecord = RandomData.GeneratePersonCollection(1).First(); var propertiesTest = new PropertiesTest { Id = RandomData.GenerateKey(), PersonProper = RandomData.GeneratePerson <PersonProper>(), PersonRecord = RandomData.GeneratePersonCollection(1).First(), Today = DateTimeOffset.Now, ClosedOn = DateTimeOffset.Now, }; var result = personRecord.PropertiesToString( header: "PersonRecord", keyValueSeparator: ':', sequenceSeparator: ", ", ignoreNulls: true); Assert.IsTrue(result.Length > 1300); Assert.IsTrue(result.Contains("Addresses")); PrintResult(result, nameof(this.PropertiesToStringTest)); result = propertiesTest.PropertiesToString( header: "PersonRecord", keyValueSeparator: ':', sequenceSeparator: ", ", ignoreNulls: true, includeMemberName: false); Assert.IsTrue(result.Length > 1300); Assert.IsTrue(result.Contains("Addresses")); PrintResult(result, nameof(this.PropertiesToStringTest)); var person = RandomData.GeneratePerson <PersonProper>(); result = person.PropertiesToString(header: person.Id); Assert.IsTrue(result.Length > 500); Assert.IsTrue(result.Contains("Address1")); PrintResult(result, nameof(this.PropertiesToStringTest)); var coordinate = RandomData.GenerateCoordinate <CoordinateProper>(); result = coordinate.PropertiesToString(); Assert.IsTrue(result.Length > 50); Assert.IsTrue(result.Contains("X")); PrintResult(result, nameof(this.PropertiesToStringTest)); var personCollection = RandomData.GeneratePersonCollection(5); result = personCollection.PropertiesToString(); Assert.IsTrue(result.Contains("Item")); Assert.IsTrue(result.Length > 6000); }
public void PropertiesToDictionaryTest() { var personProper = RandomData.GeneratePersonCollection(1).First(); var propertiesTest = new PropertiesTest { Id = RandomData.GenerateKey(), PersonProper = RandomData.GeneratePerson <PersonProper>(), PersonRecord = RandomData.GeneratePersonCollection(1).First(), Today = DateTime.Now }; var result = personProper.PropertiesToDictionary(memberName: $"Person-{personProper.Id}", ignoreNulls: true); Assert.IsTrue(result.Count() > 1); result = propertiesTest.PropertiesToDictionary( memberName: $"TestPerson-{personProper.Id}", ignoreNulls: true); Assert.IsTrue(result.Count() > 1); }