Exemplo n.º 1
0
        public void CalCulateFare()
        {
            CabInvoice obj    = new CabInvoice();
            double     result = obj.Fare(5, 15);

            Assert.AreEqual(65, result);
        }
Exemplo n.º 2
0
        public void GivenDistanceAndTime_ShouldReturnTotalFare2()
        {
            double     distance = 0.2;
            int        time     = 3;
            CabInvoice obj      = new CabInvoice("Normal");
            double     actual   = obj.CalculateFare(distance, time);
            double     expected = 5;

            Assert.AreEqual(actual, expected);
        }
Exemplo n.º 3
0
        public void Return_PartOf_Rides()
        {
            CabInvoice[] rides =
            {
                new CabInvoice(5,  15),
                new CabInvoice(12, 35),
                new CabInvoice(7, 23)
            };

            CabInvoice obj    = new CabInvoice();
            var        result = CabInvoice.totalFare(rides);
        }
Exemplo n.º 4
0
        public void CalCulateTotalFare_OfMultipleRides()
        {
            CabInvoice[] rides =
            {
                new CabInvoice(5,  15),
                new CabInvoice(12, 35),
                new CabInvoice(7, 23)
            };

            double result = CabInvoice.totalFare(rides);

            Assert.AreEqual(313, result);
        }
Exemplo n.º 5
0
        public void InvoiceGeneratorShouldTakesMultipleRide_ShouldReturnAverageFarePerRide()
        {
            Rides[] rides =
            {
                new Rides(5,  15),
                new Rides(12, 35),
                new Rides(7, 23)
            };

            CabInvoice obj    = new CabInvoice("Normal");
            double     Actual = obj.AverageFareForEachRides(rides, "Normal");

            Assert.AreEqual(Actual, 104.33333333333333d);
        }
Exemplo n.º 6
0
        public void InvoiceGeneratorShouldTakesMultipleRide_ShouldReturnTotalNoOfRides()
        {
            Rides[] rides =
            {
                new Rides(5,  15),
                new Rides(12, 35),
                new Rides(7, 23)
            };

            CabInvoice obj    = new CabInvoice();
            double     Actual = obj.TotalRides(rides);

            Assert.AreEqual(Actual, 3);
        }
Exemplo n.º 7
0
        public void InvoiceGeneratorShouldTakesMultipleRide_ShouldReturnTotalFare2()
        {
            Rides[] rides =
            {
                new Rides(5,  15),
                new Rides(12, 35),
                new Rides(7, 23)
            };

            CabInvoice obj    = new CabInvoice("Normal");
            double     Actual = obj.totalFare(rides, "Normal");

            Assert.AreEqual(Actual, 313);
        }
Exemplo n.º 8
0
        public void InvoiceGeneratorShouldTakesMultipleRide_ShouldReturnTotalFare1()
        {
            Rides[] rides =
            {
                new Rides(5,  15),
                new Rides(12, 35),
                new Rides(7, 23)
            };

            CabInvoice obj    = new CabInvoice("Premium");
            double     Actual = obj.totalFare(rides, "Premium");
            double     expect = obj.CalculateFare(5, 15) + obj.CalculateFare(12, 35) + obj.CalculateFare(7, 23);

            Assert.AreEqual(Actual, expect);
        }
Exemplo n.º 9
0
        public void Given_User_Id_AndGet_Total_Fare_User()
        {
            RideReposetory rideRepository = new RideReposetory();
            List <Rides>   rides          = new List <Rides>();

            rides.Add(new Rides(0.5, 5));
            rides.Add(new Rides(1.0, 8));
            CabInvoice obj         = new CabInvoice("Normal");
            Customer   New_Custmor = new Customer("Bdec123");

            rideRepository.AddRide(rides, New_Custmor);
            double actual   = obj.GetInvoiceSummary(New_Custmor, "Normal");
            double expected = obj.totalFare(rides.ToArray(), "Normal");

            Assert.AreEqual(actual, expected);
        }
Exemplo n.º 10
0
        public void Given_User_Id_AndGet_Total_Number_Rides()
        {
            RideReposetory rideRepository = new RideReposetory();
            List <Rides>   rides          = new List <Rides>();

            rides.Add(new Rides(0.5, 45));
            rides.Add(new Rides(1.0, 8));

            Customer custmor = new Customer("Bdec123");

            rideRepository.AddRide(rides, custmor);
            double     actual   = Invoice_Summery.GetRides(custmor);
            CabInvoice obj      = new CabInvoice();
            double     expected = obj.TotalRides(rides.ToArray());

            Assert.AreEqual(actual, expected);
        }
 public void Setup()
 {
     this.cabInvoiceGenerator = new CabInvoice();
 }