Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        public void TestEntityConstructorValidData()
        {
            CustomerEntity entity = new CustomerEntity(validType, validNote,
                validName);
            Customer customer = new Customer(entity, dataAccessFacadeStub);

            Assert.AreEqual(validName, customer.Name);
            Assert.AreEqual(validNote, customer.Note);
            Assert.AreEqual(validType, customer.Type);
        }
Пример #4
0
        public void TestConstructorSetsAllProperties()
        {
            CustomerType type = CustomerType.Bureau;
            string note = "bla";
            string name = "Peter";

            CustomerEntity customerEntity = new CustomerEntity(type, note,
                name);
            Assert.AreEqual(customerEntity.Name, name);
            Assert.AreEqual(customerEntity.Note, note);
            Assert.AreEqual(type, customerEntity.Type);
        }
Пример #5
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);
        }
Пример #6
0
 public ICustomer CreateCustomer(CustomerType type, string note, string name)
 {
     CustomerEntity entity = new CustomerEntity(type, note, name);
     customers.Add(entity);
     return entity;
 }