예제 #1
0
 public void CalcOnAnotherDay()
 {
     (var type, var total, var days, var delayedHours) = PaymentCalculation.Calculate(new DateTime(2019, 1, 1, 18, 30, 0), new DateTime(2019, 1, 2, 9, 0, 0), 800, 500);
     Assert.AreEqual(type, PaymentType.Days);
     Assert.AreEqual(total, 800);
     Assert.AreEqual(days, 1);
 }
예제 #2
0
        public void Calc1Day()
        {
            var payment = PaymentCalculation.Calculate(new DateTime(2019, 1, 1), new DateTime(2019, 1, 2), 800, 500);

            Assert.AreEqual(payment.Type, PaymentType.Days);
            Assert.AreEqual(payment.Total, 800);
        }
        public void TestMethod_CalculatePayment()
        {
            PaymentCalculation paymentCalculation = new PaymentCalculation();

            double[] result = paymentCalculation.ReturnPaymentAndChange(1.0, 0.25);
            Assert.AreEqual(result[0], 4);
        }
예제 #4
0
        public void Calc15Days()
        {
            DateTime start   = new DateTime(2019, 1, 1, 10, 0, 0);
            DateTime end     = new DateTime(2019, 1, 16, 10, 0, 0);
            var      payment = PaymentCalculation.Calculate(start, end, 800, 500);

            Assert.AreEqual(payment.Type, PaymentType.Days);
            Assert.AreEqual(payment.Total, 8160);
        }
예제 #5
0
        public void Max4HoursDelay()
        {
            DateTime start = new DateTime(2019, 1, 1, 10, 0, 0);
            DateTime end   = new DateTime(2019, 1, 2, 15, 0, 0);
            Price    pay   = new Price(800, 500, 100);

            var payment = PaymentCalculation.Calculate(start, end, pay);

            Assert.AreEqual(payment.Type, PaymentType.Days);
            Assert.AreEqual(payment.Total, 1600);
        }
예제 #6
0
 public CloseOrderModel(Order order, bool isRegularClient)
 {
     this.Order           = order;
     this.ID              = order.ID;
     this.Payment         = PaymentCalculation.Calculate(order.StartDate.ToRussianTime(), DateTime.UtcNow.ToRussianTime(), order.Tool.GetPrice());
     this.Days            = this.Payment.Days;
     this.DelayedHours    = this.Payment.DelayedHours;
     this.TotalPayment    = this.Payment.Total;
     this.IsRegularClient = isRegularClient;
     ShouldCallClient     = order.ShouldCallClient;
 }
예제 #7
0
        public void Calc1HourDelay()
        {
            DateTime start = new DateTime(2019, 1, 1, 12, 30, 0);
            DateTime end   = new DateTime(2019, 1, 2, 12, 40, 0);
            Price    pay   = new Price(800, 500, 100);

            var payment = PaymentCalculation.Calculate(start, end, pay);

            Assert.AreEqual(payment.Type, PaymentType.DaysAndHours);
            Assert.AreEqual(payment.DelayedHours, 1);
            Assert.AreEqual(payment.Total, 900);
        }
예제 #8
0
        public void NoHoursDelayInTheSameDay()
        {
            DateTime start = new DateTime(2019, 1, 6, 22, 20, 0);
            DateTime end   = new DateTime(2019, 1, 7, 2, 0, 0);
            Price    pay   = new Price(770, 670, 150);

            var payment = PaymentCalculation.Calculate(start, end, pay);

            Assert.AreEqual(payment.Days, 1);
            Assert.AreEqual(payment.Total, 770);
            Assert.AreEqual(payment.Type, PaymentType.Days);
        }
예제 #9
0
 public void CalculatesWorkShip()
 {
     (var type, var total, var days, var delayedHours) = PaymentCalculation.Calculate(new DateTime(2019, 1, 1), new DateTime(2019, 1, 1), 800, 500);
     Assert.AreEqual(type, PaymentType.WorkShift);
     Assert.AreEqual(total, 500);
 }