public void ASaleIsATypeOfTransaction()
 {
     Tax defaultTax = new Tax("5% Tax", 5);
     Product simpleProduct = new Product("A Cap", 10, defaultTax);
     Transaction sale = new Sale(simpleProduct, "Selling a cap", 1, 0);
     Assert.AreEqual((decimal)10.5, sale.NetAmount);
 }
 public void SalesCanNotBeNegative()
 {
     Product cap = new Product("Cap", 5, taxesDictionary["IGIC General"]);
     DateTime issueDate = DateTime.Now;
     try
     {
         Transaction transaction = new Sale(cap,"Return a cap", 1, -10, 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 TheTransactionsCostAndTaxesCanDiferFromDefaultProductCost()
 {
     Tax defaultTax = new Tax("5% Tax", 5);
     Product simpleProduct = new Product("A Cap", 10, defaultTax);
     Transaction sale = new Sale(simpleProduct, "Selling a cap", 1, 20, new Tax("No Tax", 0), 0);
     Assert.AreEqual((decimal)20, sale.NetAmount);
 }