public void Will_Return_TaxValue(decimal taxMultiplier, decimal value, CalculationDirection direction, decimal expected) { var taxInfo = new TaxInfo("test", taxMultiplier); var position = new InvoicePosition(1, "", 1, taxInfo, value, string.Empty); position.GetTaxValue(direction).ShouldBe(expected); }
protected static Invoice GenerateEmptyTestInvoice(CalculationDirection calculationDirection = CalculationDirection.NetToGross) => GenerateTestInvoice(calculationDirection, Array.Empty <(int, decimal, decimal)>());
protected static Invoice GenerateTestInvoice(CalculationDirection direction, (int taxMultiplier, decimal quantity, decimal value)[] positionsSpec)
public void Will_Return_Net_Value(decimal value, decimal multiplier, CalculationDirection direction, decimal expected) { var taxInfo = new TaxInfo("test", multiplier); taxInfo.GetNetValue(direction, value).ShouldBe(expected); }
public void Will_Not_Create_For_Invalid_Input(string draftCreatedAtUtcString, Guid templateVersionId, Guid buyerId, Guid sellerId, Guid issuerId, Currency currency, CalculationDirection calculationDirection) { if (draftCreatedAtUtcString == "future") { draftCreatedAtUtcString = DateTime.UtcNow.AddMinutes(1).ToString(); } Should.Throw <ArgumentException>(() => new Invoice( DateTime.Parse(draftCreatedAtUtcString), templateVersionId, buyerId, sellerId, issuerId, currency, calculationDirection )); }
public void Will_Create_For_Valid_Input(string draftCreatedAtUtcString, Guid templateVersionId, Guid buyerId, Guid sellerId, Guid issuerId, Currency currency, CalculationDirection calculationDirection) { Should.NotThrow(() => new Invoice( DateTime.Parse(draftCreatedAtUtcString), templateVersionId, buyerId, sellerId, issuerId, currency, calculationDirection )); }
public decimal GetTotalTaxValue(CalculationDirection calculationDirection) => GetTotalGrossValue(calculationDirection) - GetTotalNetValue(calculationDirection);
public decimal GetTotalGrossValue(CalculationDirection calculationDirection) => TaxInfo.GetGrossValue(calculationDirection, Value * Quantity);
public decimal GetGrossValue(CalculationDirection calculationDirection) => TaxInfo.GetGrossValue(calculationDirection, Value);