示例#1
0
        public void GivenMultipleRides_WhenInvoiceGenerator_thenShouldReturnFollowingInvoiceSummary()
        {
            invoiceGenerator = new InvoiceGenerator(RideType.NORMAL);
            Ride[]         rides           = { new Ride(2.0, 5), new Ride(0.1, 1) };
            InvoiceSummary invoiceSummary  = invoiceGenerator.CalculateAvrageFare(rides);
            InvoiceSummary expectedSummary = new InvoiceSummary(2, 30.0, 15);

            Assert.AreEqual(expectedSummary, invoiceSummary);
        }
示例#2
0
        public void GivenMultipleRides_WhenUserId_thenShouldReturn_InvoiceSummary()
        {
            invoiceGenerator = new InvoiceGenerator(RideType.NORMAL);
            Ride[]         rides          = { new Ride(2.0, 5), new Ride(0.1, 1) };
            RideRepository rideRepository = new RideRepository();
            string         userId         = "Sanju";

            rideRepository.AddRides(userId, rides);

            rideRepository.AddRides("Priyanshu", new Ride[] { new Ride(3.0, 6), new Ride(4.0, 8) });
            rideRepository.AddRides("Himanshu", new Ride[] { new Ride(3.0, 6), new Ride(4.0, 8) });

            Ride[]         rideData        = rideRepository.GetRides(userId);
            InvoiceSummary invoiceSummary  = invoiceGenerator.CalculateAvrageFare(rideData);
            InvoiceSummary expectedSummary = new InvoiceSummary(2, 30.0, 15);

            Assert.AreEqual(expectedSummary, invoiceSummary);
        }