public void GetSubTotalTest() { var service = new TaxService(new TaxJarCalculator()); var order = new Models.Order(); order.AddProduct(new Product() { Id = 1, Price = 10m }); var subtotal = order.GetSubTotal(); Assert.IsTrue(subtotal == 10m); }
public async Task GetTotalAmountActualTest() { var service = new TaxService(new TaxJarCalculator()); var order = new Models.Order(); order.ToZip = "33458"; order.ToState = "FL"; order.FromZip = "33458"; order.FromState = "FL"; order.AddProduct(new Product() { Price = 10m }); var result = await service.GetOrderTotal(order); Assert.IsTrue(result == 10.65m); }
public async Task GetTaxAmountWithPriceTest() { var service = new TaxService(new TaxJarCalculator()); var order = new Models.Order(); order.ToZip = "33458"; order.ToState = "FL"; order.FromZip = "33458"; order.FromState = "FL"; order.AddProduct(new Product() { Id = 1, Name = "Test", Price = 10m }); var result = await service.GetTaxAmount(order); Assert.IsTrue(result != default(decimal)); }
public async Task CalculateTaxesForOrderTest() { var taxJarService = new TaxJarCalculator(); var order = new Models.Order() { FromState = "FL", Country = "US", ToState = "FL", ToZip = "33458" }; order.AddProduct(new Product() { Price = 10m }); var result = await taxJarService.CalculateTaxesForOrder(order); Assert.IsTrue(result != default, "Tax should not be zero"); Assert.IsTrue(result == 0.65m, "Tax on $10 should be 65c"); }