public void Scribe_Write_Performance_Test() { var business = new SimpleBusiness() { BusinessId = 12345, BusinessName = "BusinessName", BusinessTelephoneNumber = "5555555555", TaxId = "456789", CashOnHand = "10000" }; var businessList = new List <SimpleBusiness>(); for (int i = 0; i < 1000000000; i++) { businessList.Add(business); } using (var writer = new StringWriter()) { var stopwatch = new Stopwatch(); IFieldFormatter fieldFormatter = new FieldFormatter(); IScribe scribe = new Scribe(writer, fieldFormatter); stopwatch.Start(); scribe.Write(businessList); stopwatch.Stop(); var timeToRun = stopwatch.Elapsed.TotalSeconds; Assert.True(timeToRun <= 15); } }
public void Scribe_Write_Class_Writes_Properties_To_String_Value() { var expected = "12345000000000000000BusinessName 5555555555 4567890000000000000000000000000000010000"; var fieldFormatter = new FieldFormatter(); var business = new SimpleBusiness() { BusinessId = 12345, BusinessName = "BusinessName", BusinessTelephoneNumber = "5555555555", TaxId = "456789", CashOnHand = "10000" }; using (var writer = new StringWriter()) { IScribe scribe = new Scribe(writer, fieldFormatter); scribe.Write(business); var actual = writer.ToString(); Assert.Equal(expected, actual); } }