コード例 #1
0
        public HttpResponseMessage Calculate(TaxiRide aod_taxi_ride)
        {
            var cost = lod_rate_calc.CalcRate(aod_taxi_ride);
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, new { cost = cost });

            return(response);
        }
コード例 #2
0
        public void CalcRateTestNightHours()
        {
            TaxiRide lod_taxi_ride = new TaxiRide()
            {
                state    = "New York",
                miles    = 5,
                minutes  = 5,
                RideTime = DateTime.Parse("10/08/2010 12:30:00 am")
            };
            RateCalculator lod_rate_calculator = new RateCalculator();

            Assert.AreEqual((decimal)14.5, lod_rate_calculator.CalcRate(lod_taxi_ride));
        }
コード例 #3
0
        public void CalcRateTestNoNYTax()
        {
            TaxiRide lod_taxi_ride = new TaxiRide()
            {
                state    = "New Jersey",
                miles    = 2,
                minutes  = 5,
                RideTime = DateTime.Parse("10/08/2010 09:08:00 AM")
            };
            RateCalculator lod_rate_calculator = new RateCalculator();

            Assert.AreEqual((decimal)8.25, lod_rate_calculator.CalcRate(lod_taxi_ride));
        }
コード例 #4
0
        public void CalcRateTestBaseCase()
        {
            TaxiRide lod_taxi_ride = new TaxiRide()
            {
                state    = "New York",
                miles    = 2,
                minutes  = 5,
                RideTime = DateTime.Parse("10/08/2010 05:30:00 pm")
            };
            RateCalculator lod_rate_calculator = new RateCalculator();

            Assert.AreEqual((decimal)9.75, lod_rate_calculator.CalcRate(lod_taxi_ride));
        }
コード例 #5
0
        public void CalcRateTestPeakHours()
        {
            TaxiRide lod_taxi_ride = new TaxiRide()
            {
                state    = "New York",
                miles    = 1,
                minutes  = 5,
                RideTime = DateTime.Parse("10/08/2010 06:00:00 PM")
            };
            RateCalculator lod_rate_calculator = new RateCalculator();

            Assert.AreEqual((decimal)8, lod_rate_calculator.CalcRate(lod_taxi_ride));
        }