public async Task create_tax_rate() { var name = Random.GetRandomString(10); var state = Random.GetRandomString(5); var local = Random.GetRandomString(5); const decimal stateRate = 7.5m; const decimal localRate = 0.625m; const ReportTaxType taxType = ReportTaxType.Input; var taxRate = await Given_a_tax_rate(name, taxType, state, stateRate, local, localRate); Assert.IsTrue(name == taxRate.Name); Assert.IsTrue(taxType == taxRate.ReportTaxType); AssertContainsRate(taxRate, state, stateRate); AssertContainsRate(taxRate, local, localRate); }
protected TaxRate Given_a_tax_rate(string name, ReportTaxType taxType, string state, decimal stateRate, string local, decimal localRate) { return Api.Create(new[]{ new TaxRate { Name = name, ReportTaxType = taxType, TaxComponents = new List<TaxComponent> { new TaxComponent { Name = state, Rate = stateRate }, new TaxComponent { Name = local, Rate = localRate } } }}).First(); }
protected TaxRate Given_a_tax_rate(string name, ReportTaxType taxType, string state, decimal stateRate, string local, decimal localRate) { return(Api.Create(new[] { new TaxRate { Name = name, ReportTaxType = taxType, TaxComponents = new List <TaxComponent> { new TaxComponent { Name = state, Rate = stateRate }, new TaxComponent { Name = local, Rate = localRate } } } }).First()); }
public async Task update_tax_rate() { var name = Random.GetRandomString(10); var state = Random.GetRandomString(5); var local = Random.GetRandomString(5); const decimal stateRate = 7.5m; const decimal localRate = 0.625m; const ReportTaxType taxType = ReportTaxType.Input; var taxRate = await Given_a_tax_rate(name, taxType, state, stateRate, local, localRate); // the local tax rate is increased const decimal expected = 0.7m; var component = taxRate.TaxComponents.Single(p => p.Name == local); component.Rate = expected; var updated = await Api.UpdateAsync(taxRate); Assert.AreEqual(expected, updated.TaxComponents.Single(p => p.Name == local).Rate); }