/// <summary> /// Loads the person record array. /// </summary> protected void LoadPersonRecordArray() { this._personRecordArray = RandomData.GeneratePersonRecordCollection(this.MaxCount).ToArray(); ConsoleLogger.Default.WriteLine($"{nameof(this._personRecordArray)} Length = {this._personRecordArray.Length}."); this._personRecordArrayHalf = RandomData.GeneratePersonRecordCollection(this.MaxCount / 2).ToArray(); ConsoleLogger.Default.WriteLine($"{nameof(this._personRecordArrayHalf)} Length = {this._personRecordArrayHalf.Length}."); }
public override void Setup() { base.Setup(); this._personProper = RandomData.GenerateRefPerson <PersonProper>(); this._personRecord = RandomData.GeneratePersonRecordCollection(count: 1, addressCount: 1).First(); this._peopleJson = this._personProper.ToJson(); }
public void GeneratePersonRecordCollectionTest() { var people = RandomData.GeneratePersonRecordCollection(Count, addressCount: 3); Assert.IsNotNull(people); Assert.IsTrue(people.Count == Count); }
public void PropertiesToStringTest() { var personRecord = RandomData.GeneratePersonRecordCollection(1).First(); var propertiesTest = new PropertiesTest { Id = RandomData.GenerateKey(), PersonProper = RandomData.GenerateRefPerson <PersonProper>(), PersonRecord = RandomData.GeneratePersonRecordCollection(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.GenerateRefPerson <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.GeneratePersonRecordCollection(5); result = personCollection.PropertiesToString(); Assert.IsTrue(result.Contains("LastName")); Assert.IsTrue(result.Length > 6000); }
public void UpdatePersonRecordTest() { var person1 = RandomData.GeneratePersonRecordCollection(count: 1, addressCount: 2).First(); Assert.IsNotNull(person1); // Update Postal code var person2 = person1 with { CellPhone = "(858) 123-1234" }; Assert.IsNotNull(person2); Debug.WriteLine(person2.ToString()); Debug.WriteLine(person2.PropertiesToString()); } }
public void SerializeDeserializeTestPersonRecord() { var person = RandomData.GeneratePersonRecordCollection(1).First(); //Serialize var xml = XmlSerialization.Serialize(person); var fileName = Path.Combine(Environment.GetEnvironmentVariable(EnvironmentKey.APPDATA.ToString()), "PersonRecord.xml"); //For debugging File.WriteAllText(fileName, xml); Assert.IsTrue(string.IsNullOrEmpty(xml) is false); //Deserialize var serializedPerson = XmlSerialization.Deserialize <PersonRecord>(xml); Assert.IsNotNull(serializedPerson); File.Delete(fileName); }
public void UpsertTest() { var people = RandomData.GeneratePersonRefCollection <PersonProper>(10); var personFromCollection = people.Shuffle().First(); var person = RandomData.GenerateRefPerson <PersonProper>(); var personRecords = RandomData.GeneratePersonRecordCollection(10); var personRecord = RandomData.GeneratePersonRecordCollection(1).First(); // TEST people.Upsert(person); Assert.IsTrue(people.FastCount() == 11); people.Upsert <PersonProper, string>(personFromCollection); Assert.IsTrue(people.FastCount() == 11); personRecords.Upsert(personRecord); Assert.IsTrue(personRecords.FastCount() == 11); }
public void PropertiesToDictionaryTest() { var personProper = RandomData.GeneratePersonRecordCollection(1).First(); var propertiesTest = new PropertiesTest { Id = RandomData.GenerateKey(), PersonProper = RandomData.GenerateRefPerson <PersonProper>(), PersonRecord = RandomData.GeneratePersonRecordCollection(1).First(), Today = DateTime.Now }; var result = personProper.PropertiesToDictionary(memberName: $"Person-{personProper.Id}", ignoreNulls: true); Assert.IsTrue(result.FastCount() > 1); result = propertiesTest.PropertiesToDictionary( memberName: $"TestPerson-{personProper.Id}", ignoreNulls: true); Assert.IsTrue(result.FastCount() > 1); }
public void PropertiesToString02() { var person = RandomData.GeneratePersonRecordCollection(count: 1, addressCount: 1).First(); base.Consumer.Consume(person.PropertiesToString()); }
public void CreatePerson05() { var person = RandomData.GeneratePersonRecordCollection(count: 1, addressCount: 1).First(); base.Consumer.Consume(person); }