public void Can_Calculate_Correct_Total_Amount_With_And_Without_Tax() { // Arrange Person person = new PhysicalPerson("12345678901", "Mile", "Milic"); LegalPerson legalPerson = new LegalPerson("12345678901", "Mile d.o.o") { NumberOfBankAccount = "123487815645" }; Bill bill = new Bill(person, legalPerson, 23); bill.AddBillItem(new BillItem(1, 23.5m, "Kruške")); bill.AddBillItem(new BillItem(3, 46.8m, "Jabuke")); // Act var totalAmount = bill.TotalAmount; var totalAmountWithTax = bill.TotalAmountWithTax; // Assert Assert.AreEqual(163.9m, totalAmount); Assert.AreEqual(201.597m, totalAmountWithTax); }
/// <summary> /// Izadaje racun za pricuvu /// </summary> /// <param name="apartment">stan za kojieg se izdaje racun za placanje pricuve</param> /// <returns>racun za pricuvu</returns> public Bill IssueReserveBillFor(Apartment apartment) { if(apartment.ResponsibleTenant == null) { throw new RulesException("Responsible tenant is not set."); } Bill bill = new Bill(apartment.ResponsibleTenant, buildingManager.LegalPerson, tax); decimal price = reserveCoefficient * apartment.SurfaceArea; BillItem billItem = new BillItem(1, price, "Pričuva"); bill.AddBillItem(billItem); bill.ReferenceNumber = REFERENCE_NUMBER_PREFIX + apartment.Id + bill.DateTimeIssued.ToShortDateString(); return bill; }