public void Test2() { var mockData = MockDataHelper.GetInvoiceData(); InvoiceDataStore.Add(mockData); Assert.That(_invoiceStore.ContainsKey(mockData.InvoiceNo)); Assert.That(_invoiceStore[mockData.InvoiceNo].TotalAmount == mockData.TotalAmount); }
public void Test3() { var mockData = MockDataHelper.GetInvoiceData(); InvoiceDataStore.Add(mockData); Assert.That(_invoiceStore.ContainsKey(mockData.InvoiceNo)); mockData.Seller.Name = "Zomato"; mockData.ShipTo.ZipCode = "234323"; InvoiceDataStore.Update(mockData.InvoiceNo, mockData); Assert.That(_invoiceStore.ContainsKey(mockData.InvoiceNo)); Assert.That(_invoiceStore[mockData.InvoiceNo].Seller.Name.Equals("Zomato")); Assert.That(_invoiceStore[mockData.InvoiceNo].ShipTo.ZipCode.Equals("234323")); }
/// <summary> /// Parsing the invoice file and extract and stores the data /// Actual Parsing Need to be implemented /// </summary> /// <param name="filePath"> Invoice file path</param> /// <returns></returns> public bool ProcessInvoice(IEnumerable <string> invoiceFiles) { try { foreach (var file in invoiceFiles) { var data = MockDataHelper.GetInvoiceData(); data.Status = Status.Digitized; InvoiceDataStore.Add(data); } return(true); } catch (Exception) { return(false); } }
public void Test4() { var mockData = MockDataHelper.GetInvoiceData(); InvoiceDataStore.Add(mockData); var oldInvoiceNo = mockData.InvoiceNo; var newInvoiceNo = Guid.NewGuid().ToString(); Assert.That(_invoiceStore.ContainsKey(mockData.InvoiceNo)); mockData.InvoiceNo = newInvoiceNo; mockData.Seller.Name = "Zomato"; mockData.ShipTo.ZipCode = "234323"; InvoiceDataStore.Update(mockData.InvoiceNo, mockData); Assert.That(_invoiceStore.ContainsKey(newInvoiceNo)); Assert.That(_invoiceStore[newInvoiceNo].Seller.Name.Equals("Zomato")); Assert.That(_invoiceStore[newInvoiceNo].ShipTo.ZipCode.Equals("234323")); Assert.That(_invoiceStore.ContainsKey(oldInvoiceNo)); }