public void FormatItemToCsv_Test() { List<QuantityLocation> qlocList = new List<QuantityLocation>(); qlocList.Add(new QuantityLocation() { Location = "ABC", Quantity = 4000 }); qlocList.Add(new QuantityLocation() { Location = "XYZ", Quantity = 1000 }); Item i = new Item() { EffectiveDate = new DateTime(2015, 06, 17), EntryNumber = 740498, Price = 12.87m, QuantityAtLocation = qlocList, Sku = "P", TotalQty = 5000, Vendor = "850001" }; ItemToCsvFormatter f = new ItemToCsvFormatter(i); string csv = f.Format(); string[] result = csv.Split(new string[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries); result.Count().ShouldBeGreaterThan(1); result[0].ShouldBe("850001,740498,P,5000,,17062015,0,0,12.87,ABC,4000"); }
string getCsvFormat(Item i) { ItemToCsvFormatter pf = new ItemToCsvFormatter(i); string val = pf.Format(); return val; }