public void TestAddAttachment()
        {
            DateTime dueDate = new DateTime(2010, 10, 10);
            decimal dueAmount = 100m;
            APartyEntity payee = new SupplierEntity(SupplierType.Cruise, "", "Galasam");
            APartyEntity payer = new CustomerEntity(CustomerType.Bureau, "", "Lonely Tree");
            PaymentType type = PaymentType.Full;
            string sale = "SR Josef";
            int booking = 59;

            PaymentEntity paymentEntity = new PaymentEntity(dueDate, dueAmount, payer,
                payee, type, sale, booking);

            List<string> expectedAttachments = new List<string>();
            expectedAttachments.Add("attachment1");
            expectedAttachments.Add("attachment2");
            expectedAttachments.Add("attachment3");

            paymentEntity.AddAttachment("attachment1");
            paymentEntity.AddAttachment("attachment2");
            paymentEntity.AddAttachment("attachment3");

            List<string> actualAttachments = new List<string>();

            foreach (string attachment in paymentEntity.Attachments)
            {
                actualAttachments.Add(attachment);
            }

            CollectionAssert.AreEqual(expectedAttachments, actualAttachments);
        }
        public void TestConstructorSetsAllProperties()
        {
            DateTime dueDate = new DateTime(2010, 10, 10);
            decimal dueAmount = 100m;
            APartyEntity payee = new SupplierEntity(SupplierType.Cruise, "", "Galasam");
            APartyEntity payer = new CustomerEntity(CustomerType.Bureau, "", "Lonely Tree");
            PaymentType type = PaymentType.Full;
            string sale = "VF March";
            int booking = 128;

            PaymentEntity paymentEntity = new PaymentEntity(dueDate, dueAmount, payer,
                payee, type, sale, booking);

            DateTime expectedPaidDate = new DateTime(1900, 01, 01);
            decimal expectedPaidAmount = 0m;
            bool expectedPaid = false;
            bool expectedArchived = false;
            int expectedAttachmentsCount = 0;

            Assert.AreEqual(dueDate, paymentEntity.DueDate);
            Assert.AreEqual(dueAmount, paymentEntity.DueAmount);
            Assert.AreEqual(payee, paymentEntity.Payee);
            Assert.AreEqual(payer, paymentEntity.Payer);
            Assert.AreEqual(expectedPaidDate, paymentEntity.PaidDate);
            Assert.AreEqual(expectedPaidAmount, paymentEntity.PaidAmount);
            Assert.AreEqual(expectedPaid, paymentEntity.Paid);
            Assert.AreEqual(expectedArchived, paymentEntity.Archived);
            Assert.AreEqual(expectedAttachmentsCount, paymentEntity.Attachments.Count);
        }
        public IPayment CreatePayment(DateTime dueDate, decimal dueAmount, IParty payer, IParty payee, 
            PaymentType type, string sale, int booking)
        {
            PaymentEntity entity = new PaymentEntity(dueDate, dueAmount, payer, payee, type, sale, booking);
            payments.Add(entity);

            return entity;
        }
Exemple #4
0
        public void TestEntityConstructorValidData()
        {
            APartyEntity payee = new SupplierEntity(SupplierType.Cruise, "", "Galasam");
            APartyEntity payer = new CustomerEntity(CustomerType.Bureau, "", "Lonely Tree");
            PaymentEntity entity = new PaymentEntity(validDueDate, validDueAmount, payer,
                payee, validType, validSale, validBooking);
            Payment payment = new Payment(entity, dataAccessFacadeStub);

            Assert.AreEqual(validDueDate, payment.DueDate);
            Assert.AreEqual(validDueAmount, payment.DueAmount);
            Assert.AreEqual(payee.Name, payment.Payee.Name);
            Assert.AreEqual(payer.Name, payment.Payer.Name);
            Assert.AreEqual(validType, payment.Type);
            Assert.AreEqual(validSale, payment.Sale);
            Assert.AreEqual(validBooking, payment.Booking);
        }