public void CanRetrieveProductionTaxData() { ITaxRepository data = new ProductionTaxesRepository(@"C:\Data\LiveData\Taxes.txt"); List <Tax> taxes = data.RetrieveTaxes(); Assert.IsTrue(taxes.Count > 0); }
[TestCase("02/02/2222", "Thomas", "OH", "Wood", true)] //correct public void UpdateOrder(string date, string name, string state, string product, bool expected) { Order order = new Order(); order.OrderDate = DateTime.Parse(date); order.CustomerName = name; order.State = state; order.ProductType = product; bool isValid = true; if (order.OrderDate < DateTime.Now) { isValid = false; } string validChars = "abcdefghijklmnopqrstuvwxyz123456789,. "; if (order.CustomerName.Any(x => !validChars.Contains(x.ToString().ToLower()))) { isValid = false; } ITaxRepository taxrepo = new ProductionTaxesRepository(@"C:\Data\LiveData\Taxes.txt"); var Taxes = taxrepo.RetrieveTaxes(); if (!Taxes.Any(t => t.StateAbbreviation.ToLower() == order.State.ToLower())) { isValid = false; } IProductRepository productrepo = new ProductionProductsRepository(@"C:\Data\LiveData\Products.txt"); var Products = productrepo.RetrieveProducts(); if (!Products.Any(p => p.ProductType.ToLower() == order.ProductType.ToLower())) { isValid = false; } if (isValid) { manager.CreateOrder(order); } Order orderTwo = order; orderTwo.CustomerName = "Thomas"; bool result = manager.UpdateOrder(orderTwo).Success; Assert.AreEqual(expected, result); }