public void TestLoadEmbededDataFromFile() { // Get test file var filePath = GetTestFilePath("TransformerTest.xlsx"); if (!File.Exists(filePath)) { throw new FileNotFoundException(String.Format("Test file {0} not found!", filePath)); } TestEmbededData order = TestEmbededData.Load(filePath); Assert.IsNotNull(order); Console.Write(order.ToString()); }
public void TestWriteEmbededDataToFile() { // Get test file var filePath = GetTestFilePath("TransformerTest.xlsx"); if (!File.Exists(filePath)) { throw new FileNotFoundException(String.Format("Test file {0} not found!", filePath)); } // Create a new file var newFilePath = GetTestFilePath("TransformerTest_WriteEmbeded.xlsx"); if (File.Exists(newFilePath)) { File.Delete(newFilePath); } File.Copy(filePath, newFilePath); TestEmbededData order = TestEmbededData.Load(filePath); Assert.IsNotNull(order); Console.Write(order.ToString()); order.Currency += "_new"; order.Delivery += "_new"; order.ExtPo += "_new"; order.Id += "_new"; order.IncoTerms += "_new"; order.Payment += "_new"; order.PoDate += new TimeSpan(1, 0, 0, 0); order.ShipTo += "_new"; order.Version += "_new"; order.AdditionalNotes += "_new"; foreach (var item in order.Items) { item.Description += "_new"; item.ExwDate += new TimeSpan(1, 0, 0, 0); item.LineNumber += 1; item.Part += "_new"; item.Qty += 1; item.TotalPrice += 1; item.UnitPrice += 1; } order.Save(newFilePath); }