Example #1
0
 public CompanyOrder(CompanyOrder obj)
 {
     this.crateBy         = obj.crateBy;
     this.createdDate     = obj.createdDate;
     this.customer        = obj.customer;
     this.dateSenndBill   = obj.dateSenndBill;
     this.daysToPaid      = obj.daysToPaid;
     this.descriptionTask = obj.descriptionTask;
     this.hoursUse        = obj.hoursUse;
     this.invoiceNo       = obj.invoiceNo;
     this.paid            = obj.paid;
     this.paidHour        = obj.paidHour;
     this.paidToAcc       = obj.paidToAcc;
 }
Example #2
0
        public void CompanyOrdersd()
        {
            var dateTime       = DateTime.Now;
            var companyOrdersd = new Orders.CompanyOrder(new TestingOrder.Worker1(), dateTime,
                                                         new TestingOrder.CustomerCompany1(), dateTime, 5, "testDescriptonTask",
                                                         65D, 15, false, 320.5D, 1564, dateTime);

            // testing get
            Assert.AreEqual(new TestingOrder.Worker1().WorkNo, companyOrdersd.CreateBy.WorkNo);
            Assert.AreEqual(dateTime, companyOrdersd.CreateDate);
            Assert.AreEqual(new TestingOrder.CustomerCompany1().CompanyCustomersNo, companyOrdersd.Customer.CompanyCustomersNo);
            Assert.AreEqual(dateTime, companyOrdersd.DateSendBill);
            Assert.AreEqual(5, companyOrdersd.DaysToPaid);
            Assert.AreEqual("testDescriptonTask", companyOrdersd.DescriptionTask);
            Assert.AreEqual(65D, companyOrdersd.HoutsUse);
            Assert.AreEqual(15, companyOrdersd.InvoiceNo);
            Assert.AreEqual(false, companyOrdersd.Paid);
            Assert.AreEqual(320.5D, companyOrdersd.PaidHour);
            Assert.AreEqual(1564, companyOrdersd.PaidToAcc);
            Assert.AreEqual(dateTime, companyOrdersd.TaskDate);

            dateTime = dateTime.AddDays(5);

            // testing set
            companyOrdersd.CreateBy        = new TestingOrder.Worker2();
            companyOrdersd.CreateDate      = dateTime;
            companyOrdersd.Customer        = new TestingOrder.CustomerCompany2();
            companyOrdersd.DateSendBill    = dateTime;
            companyOrdersd.DaysToPaid      = 43;
            companyOrdersd.DescriptionTask = "newTestDescriptonTask";
            companyOrdersd.HoutsUse        = 16D;
            companyOrdersd.Paid            = true;
            companyOrdersd.PaidHour        = 465D;
            companyOrdersd.PaidToAcc       = 648641;
            companyOrdersd.TaskDate        = dateTime;

            var crateBy = (Interface.Iworker) new PrivateObject(companyOrdersd).GetField("crateBy");

            Assert.AreEqual(new TestingOrder.Worker2().WorkNo, crateBy.WorkNo);
            var createdDate = (DateTime) new PrivateObject(companyOrdersd).GetField("createdDate");

            Assert.AreEqual(dateTime, createdDate);
            var customer = (Interface.IcompanyCustomer) new PrivateObject(companyOrdersd).GetField("customer");

            Assert.AreEqual(new TestingOrder.CustomerCompany2().CompanyCustomersNo, customer.CompanyCustomersNo);
            var dateSenndBill = (DateTime) new PrivateObject(companyOrdersd).GetField("dateSenndBill");

            Assert.AreEqual(dateTime, dateSenndBill);
            var daysToPaid = (int)new PrivateObject(companyOrdersd).GetField("daysToPaid");

            Assert.AreEqual(43, daysToPaid);
            var descriptionTask = (string)new PrivateObject(companyOrdersd).GetField("descriptionTask");

            Assert.AreEqual("newTestDescriptonTask", descriptionTask);
            var hoursUse = (double)new PrivateObject(companyOrdersd).GetField("hoursUse");

            Assert.AreEqual(16D, hoursUse);
            var paid = (bool)new PrivateObject(companyOrdersd).GetField("paid");

            Assert.AreEqual(true, paid);
            var paidHour = (double)new PrivateObject(companyOrdersd).GetField("paidHour");

            Assert.AreEqual(465D, paidHour);
            var paidToAcc = (int)new PrivateObject(companyOrdersd).GetField("paidToAcc");

            Assert.AreEqual(648641, paidToAcc);
            var taskDate = (DateTime) new PrivateObject(companyOrdersd).GetField("taskDate");
        }