public void AmendingInvoiceHasTheSameInvoiceIDButWithDifferentPrefix()
 {
     DateTime issueDate = DateTime.Parse("01/01/2013");
     billDataManager.InvoiceSequenceNumber = 5000;
     Invoice invoice = new Invoice(invoiceCustomerData, transactionsList, issueDate);
     AmendingInvoice amendingInvoice = new AmendingInvoice(invoice);
     Assert.AreEqual("INV2013005000", invoice.InvoiceID);
     Assert.AreEqual("AMN2013005000", amendingInvoice.InvoiceID);
 }
        public void AmendingInvoiceIsCorrectlyAddedToClubMember()
        {
            clubMemberDataManager.MemberIDSequenceNumber = 5;
            ClubMember clubMember = new ClubMember("Francisco", "Gomez-Caldito", "Viseas");
            Assert.AreEqual(0, clubMember.InvoicesList.Count);

            InvoiceCustomerData invoiceCustomerData = new InvoiceCustomerData(clubMember);
            Invoice invoice = new Invoice(
                new InvoiceCustomerData(clubMember),
                new List<Transaction>() { new Transaction("Kajak Rent", 1, 50, new Tax("No Tax", 0), 0) },
                DateTime.Now);
            AmendingInvoice amendingInvoice = new AmendingInvoice(invoice);
            clubMember.AddAmendingInvoice(amendingInvoice);
            Assert.IsNotNull(clubMember.AmendingInvoicesList[amendingInvoice.InvoiceID]);
        }
 public void AfterTheFirstReferenceAnAmendingInvoiceHasTheSameTransactionsThanOriginalInvoiceButWithNegativeUnits()
 {
     DateTime issueDate = DateTime.Now;
     Invoice invoice = new Invoice(invoiceCustomerData, transactionsList, issueDate);
     AmendingInvoice amendingInvoice = new AmendingInvoice(invoice);
     List<Transaction> invoiceDetail = invoice.InvoiceDetail;
     List<Transaction> amendingInvoiceDetail = amendingInvoice.InvoiceDetail;
     bool bothDetailsAreComplementary = true;
     for (int index = 0; index < invoiceDetail.Count; index++)
     {
         Transaction currentLine= invoiceDetail[index];
         Transaction amendingTransaction = new Transaction(
             "Amending " + currentLine.Description, -currentLine.Units, currentLine.UnitCost, currentLine.Tax, currentLine.Discount);
         if (!amendingTransaction.CompareTo(amendingInvoiceDetail[index + 1]))
         {
             bothDetailsAreComplementary = false;
             break;
         }
     }
     Assert.AreEqual(true, bothDetailsAreComplementary);
 }
 public void AnAmendingInvoiceHasTheSameNetAmountThanTheAmendedInvoiceButNegative()
 {
     DateTime issueDate = DateTime.Now;
     Invoice invoice = new Invoice(invoiceCustomerData, transactionsList, issueDate);
     AmendingInvoice amendingInvoice = new AmendingInvoice(invoice);
     Assert.AreEqual(-invoice.NetAmount, amendingInvoice.NetAmount);
 }
 public void TheCustomerDataInfoOfdAnAmendingInvoiceIsTheSameThanTheOriginalInvoice()
 {
     DateTime issueDate = DateTime.Now;
     Invoice invoice = new Invoice(invoiceCustomerData, transactionsList, issueDate);
     AmendingInvoice amendingInvoice = new AmendingInvoice(invoice);
     Assert.AreEqual(invoiceCustomerData, amendingInvoice.CustomerData);
 }
 public void FirstTransactionInAmendingInvoiceIsANoValueReferenceToOriginalInvoice()
 {
     DateTime issueDate = DateTime.Now;
     Invoice invoice = new Invoice(invoiceCustomerData, transactionsList, issueDate);
     Transaction originalInvoiceReference = new Transaction("Amending invoice " + invoice.InvoiceID + "as detailed", 1, 0, new Tax("VoidTax", 0), 0);
     AmendingInvoice amendingInvoice = new AmendingInvoice(invoice);
     Transaction firstTransactionFromAmendingInvoice = amendingInvoice.InvoiceDetail[0];
     Assert.AreEqual(true, firstTransactionFromAmendingInvoice.CompareTo(originalInvoiceReference));
 }
 public void AnAmendingInvoiceHasTheSameNumberOfTransactionsThanTheAmendedInvoicePlusOne()
 {
     DateTime issueDate = DateTime.Now;
     Invoice invoice = new Invoice(invoiceCustomerData, transactionsList, issueDate);
     AmendingInvoice amendingInvoice = new AmendingInvoice(invoice);
     List<Transaction> invoiceDetail = invoice.InvoiceDetail;
     List<Transaction> amendingInvoiceDetail = amendingInvoice.InvoiceDetail;
     Assert.AreEqual(invoiceDetail.Count, amendingInvoiceDetail.Count - 1);
 }
 public void AddAmendingInvoice(AmendingInvoice amendinginvoice)
 {
     amendingInvoicesList.Add(amendinginvoice.InvoiceID, amendinginvoice);
 }
 public void CancelInvoice(Invoice invoiceToCancel, ClubMember debtor)
 {
     invoiceToCancel.Cancel();
     AmendingInvoice amendingInvoice = new AmendingInvoice(invoiceToCancel);
     debtor.AddAmendingInvoice(amendingInvoice);
 }