예제 #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 ISupplier CreateSupplier(string name, string note, SupplierType type)
        {
            SupplierEntity entity = new SupplierEntity(type, note, name);
            supplierList.Add(entity);

            return entity;
        }
예제 #3
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);
        }
예제 #4
0
        public void TestSupplierConstructorValidData()
        {
            string name = "gert";
            string note = "total fed note";
            SupplierType type = SupplierType.Cruise;

            DataAccessFacadeStub stub = new DataAccessFacadeStub();
            SupplierEntity entity = new SupplierEntity(type, note, name);

            Supplier supplier = new Supplier(stub, entity);

            string expectedName = "gert";
            string expectedNote = "total fed note";
            SupplierType expectedType = SupplierType.Cruise;

            Assert.AreEqual(expectedNote, supplier.Note);
            Assert.AreEqual(expectedName, supplier.Name);
            Assert.AreEqual(expectedType, supplier.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);
        }