public async Task GetTaxRate_WhenUnsuccessful_ReturnsError() { var taxJar = new TaxJarCalculator(); var res = await taxJar.GetTaxRate(MakeInvalidRateRequest()); Assert.IsFalse(res.success); Assert.IsNotNull(res.message); Assert.IsNull(res.rate); }
public async Task GetTaxRate_WhenSuccessful_ReturnsRate() { var taxJar = new TaxJarCalculator(); var res = await taxJar.GetTaxRate(MakeValildRateRequest()); Assert.IsTrue(res.success); Assert.IsTrue(string.IsNullOrEmpty(res.message)); Assert.IsNotNull(res.rate); Assert.IsTrue(res.rate.CombinedRate > 0); }
public void GetRates_IncorrectlyConfigured_ShouldReturn0() { Assert.AreEqual(calc_bad.GetTaxRate(TestEngine.Address_US_FL_2), 0, 0.000001); Assert.AreEqual(calc_bad.GetTaxRate(TestEngine.Address_CA_QC), 0, 0.000001); }
public void GetRates_ReturnsCorrectValue() { Assert.AreEqual(calc.GetTaxRate(TestEngine.Address_US_FL_2), 0.07, 0.000001); Assert.AreEqual(calc.GetTaxRate(TestEngine.Address_CA_QC), 0.14975, 0.000001); }