public void AServiceChargeIsATypeOfTransaction() { Tax defaultTax = new Tax("No Tax", 0); ClubService clubService = new ClubService("Member Fee", 79, defaultTax); Transaction serviceCharge = new ServiceCharge(clubService, "June Full Membership Fee", 1, 0); Assert.AreEqual((decimal)79, serviceCharge.NetAmount); }
public void ServiceChargesCanNotBeNegative() { ClubService membership = new ClubService("Club Full Membership", 50, taxesDictionary["IGIC General"]); DateTime issueDate = DateTime.Now; try { Transaction transaction = new ServiceCharge(membership, "Return Member Fee", 1, -79, taxesDictionary["IGIC General"], 0); } catch (ArgumentOutOfRangeException exception) { Assert.AreEqual("Transactions units cost can't be negative", exception.GetMessageWithoutParamName()); throw exception; } }
private void AddTransactionsToTransactionList(List<Transaction> currentTransactionsList, Table newTransactions) { foreach (var row in newTransactions.Rows) { Transaction transaction; int units = int.Parse(row["Units"]); string elementName = row[1]; string description = row["Description"]; double unitCost = double.Parse(row["Unit Cost"]); Tax tax = invoiceContextData.taxesDictionary[row["Tax"]]; double discount = double.Parse(row["Discount"]); if (newTransactions.Header.Contains("Service Name")) { ClubService clubService = invoiceContextData.servicesDictionary[elementName]; transaction = new ServiceCharge(clubService, description, units, unitCost, tax, discount); } else { Product product = invoiceContextData.productsDictionary[elementName]; transaction = new Sale(product, description, units, unitCost, tax, discount); } currentTransactionsList.Add(transaction); } }
public void TheTransactionsCostAndTaxesCanDiferFromDefaultServiceCost() { Tax defaultTax = new Tax("No Tax", 0); ClubService clubService = new ClubService("Member Fee", 79, defaultTax); Transaction serviceCharge = new ServiceCharge(clubService, "June Full Membership Fee", 1, 80, new Tax("5% Tax", 5), 0); Assert.AreEqual((decimal)84, serviceCharge.NetAmount); }