public void TaxRateManager_GetDefaultRateForOrderLine_ShouldReturnTaxRate() { var taxRate = new TaxRate { Percentage = 10, IsDefault = true, Name = "GLOBAL", Code = "GL" }; var taxRate2 = new TaxRate { Percentage = 50, IsDefault = false, Name = "UK", Code = "UK" }; _taxRateManager.Add(taxRate); _taxRateManager.Add(taxRate2); var pv = new ProductVariant { TaxRate = taxRate2 }; var orderLine = new OrderLine { ProductVariant = pv, SKU = "123" }; A.CallTo(() => _productVariantService.GetProductVariantBySKU(orderLine.SKU)).Returns(pv); TaxRate result = _taxRateManager.GetRateForOrderLine(orderLine); result.Should().NotBeNull(); result.Should().Be(taxRate2); }
public void Get_ShouldReturnTaxRate() { var taxRate = new TaxRate { Percentage = 10, IsDefault = true, Name = "GLOBAL", Code = "GL" }; Session.Transact(session => session.Save(taxRate)); TaxRate result = _getDefaultTaxRate.Get(); result.Should().NotBeNull(); result.Should().Be(taxRate); }
TaxRateManager_GetDefaultRateForOrderLine_ShouldReturnDefaultTaxRateIfProductVariantTaxRateNotSpecified() { var taxRate = new TaxRate { Percentage = 10, IsDefault = true, Name = "GLOBAL", Code = "GL" }; A.CallTo(() => _getDefaultTaxRate.Get()).Returns(taxRate); var orderLine = new OrderLine { ProductVariant = new ProductVariant(), SKU = "123" }; A.CallTo(() => _productVariantService.GetProductVariantBySKU(orderLine.SKU)).Returns(null); TaxRate result = _taxRateManager.GetRateForOrderLine(orderLine); result.Should().NotBeNull(); result.Should().Be(taxRate); }