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 InstantiatingASimpleProductThatHasADescriptionCostAndAplicapleTax() { Tax defaultTax = new Tax("5% Tax", 5); ClubService simpleService = new ClubService("Optimist Rent", 10, defaultTax); Assert.AreEqual("Optimist Rent", simpleService.Description); Assert.AreEqual(10,simpleService.Cost); Assert.AreEqual(defaultTax, simpleService.Tax); }
public ServiceCharge(ClubService service, string concept, int units, double unitCost, Tax tax, double discount) : base(concept, units, unitCost, tax, discount) { this.service = service; this.concept = concept; this.units = units; this.unitCost = unitCost; this.tax = tax; this.discount = discount; }
public void ServiceDescriptionCanNotBeNull() { Tax defaultTax = new Tax("5% Tax", 5); try { ClubService simpleService = new ClubService(null, 10, defaultTax); } catch (ArgumentException exception) { Assert.AreEqual("Service name can't be empty or null", exception.GetMessageWithoutParamName()); throw exception; } }
public void ServiceCostCantBeNegative() { Tax defaultTax = new Tax("5% Tax", 5); try { ClubService simpleService = new ClubService(null, -1, defaultTax); } catch (ArgumentException exception) { Assert.AreEqual("Service cost can't be negative", exception.GetMessageWithoutParamName()); throw exception; } }
public void GivenTheseServices(Table services) { invoiceContextData.servicesDictionary = new Dictionary<string, ClubService>(); foreach (var row in services.Rows) { string serviceName = row["Service Name"]; double defaultCost = double.Parse(row["Default Cost"]); string defaultTax = row["Default Tax"]; ClubService clubService = new ClubService(serviceName, defaultCost, invoiceContextData.taxesDictionary[defaultTax]); invoiceContextData.servicesDictionary.Add(serviceName, clubService); } }
public ServiceCharge(ClubService service, string concept, int units, double discount) : this(service,concept,units,service.Cost, service.Tax, discount) { }
public ServiceCharge(ClubService service) : this(service, service.Description, 1, service.Cost, service.Tax,0) { }
public void TransactionsOnProFormaInvoicesCantHaveZeroOrLessUnits() { Product cap = new Product("Cap", 5, taxesDictionary["IGIC General"]); ClubService membership = new ClubService("Club Full Membership", 50, taxesDictionary["IGIC General"]); DateTime issueDate = DateTime.Now; List<Transaction> transactionsList = new List<Transaction>{ new ServiceCharge(membership, "June Membership Fee", 0,79,taxesDictionary["IGIC General"],0)}; try { ProFormaInvoice proFormaInvoice = new ProFormaInvoice(invoiceCustomerData, transactionsList, issueDate); } catch (ArgumentOutOfRangeException exception) { Assert.AreEqual("Pro Forma Invoice transactions must have at least one element to transact", exception.GetMessageWithoutParamName()); throw exception; } }
public void TheInvoiceCanMixSalesAndServiceCharges() { Product cap = new Product("Cap", 10, new Tax("5% Tax", 5)); ClubService membership = new ClubService("Club Full Membership", 80, new Tax("5% Tax", 5)); DateTime issueDate = DateTime.Now; List<Transaction> transactionsList = new List<Transaction>{ new Sale(cap, "Nice Blue Cap", 1,0), new ServiceCharge(membership, "June Membership Fee", 1,0)}; Invoice invoice = new Invoice(invoiceCustomerData, transactionsList, issueDate); Assert.AreEqual((decimal)94.5, invoice.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; } }
public void ProFormaInvoicesAcceptTransactionsWithZeroCost() { Product cap = new Product("Cap", 5, taxesDictionary["IGIC General"]); ClubService membership = new ClubService("Club Full Membership", 50, taxesDictionary["IGIC General"]); DateTime issueDate = DateTime.Now; List<Transaction> transactionsList = new List<Transaction>{ new Sale(cap, "Nice Blue Cap", 1,0,taxesDictionary["IGIC Reducido 2"],0), new ServiceCharge(membership, "June Membership Fee", 1,0,taxesDictionary["IGIC General"],0)}; ProFormaInvoice proFormaInvoice = new ProFormaInvoice(invoiceCustomerData, transactionsList, issueDate); Assert.AreEqual((decimal)0, proFormaInvoice.NetAmount); }
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); }