public void GivenMultipleRides_ShouldReturnTotalFare() { // creating a user id string userId = "Saksham"; // creating Ride instances for a ride Ride firstRide = new Ride(2.0, 5); Ride secondRide = new Ride(0.1, 1); // creating list of rides using ride instances List <Ride> rides = new List <Ride> { firstRide, secondRide }; // adding user and his rides to his account UserAccount.AddRides(userId, rides); // Actual : calling GetInvoiceSummary method by passing user id and storing the outcome in totalFare double totalFare = this.invoiceGenerator.GetInvoiceSummary(userId).TotalFare; // Expected : total expected fare of ride double expected = 30; Assert.AreEqual(expected, totalFare); } //// end : public void GivenMultipleRides_ShouldReturnTotalFare()
public void GivenPremiumRide_ShouldReturnInvoiceSummary() { // creating a user id string userId = "Monika"; // creating Ride instances for a ride Ride firstRide = new Ride(3.0, 5, "Premium"); Ride secondRide = new Ride(1, 1, "Normal"); // creating list of rides using ride instances List <Ride> rides = new List <Ride> { firstRide, secondRide }; // adding user and his rides to his account UserAccount.AddRides(userId, rides); // Actual : calling GetInvoiceSummary method by passing user id and storing the outcome in invoiceSummary InvoiceSummary invoiceSummary = this.invoiceGenerator.GetInvoiceSummary(userId); // Expected : expected Invoice summary InvoiceSummary expected = new InvoiceSummary { TotalNumberOfRides = 2, TotalFare = 66, AverageFarePerRide = 33 }; Assert.AreEqual(expected.TotalFare, invoiceSummary.TotalFare); } //// end : public void GivenPremiumRide_ShouldReturnInvoiceSummary()
public void GivenMultipleRides_ShouldReturnTotalFare() { Rides firstRide = new Rides(2.0, 5, "Premium"); Rides secondRide = new Rides(0.1, 1, "Normal"); List <Rides> rides = new List <Rides> { firstRide, secondRide }; UserAccount.AddRides(this.USERID, rides); InvoiceSummary invoiceSummary = this.INVOICEGENERATOR.GetInvoiceSummary(this.USERID); double expected = 30; Assert.AreEqual(expected, invoiceSummary.TotalFare); }
public void GivenMultipleRides_ShouldReturnTotalFare() { string userId = "nitin"; Rides firstRide = new Rides(2.0, 5, "Premium"); Rides secondRide = new Rides(0.1, 1, "Normal"); List <Rides> rides = new List <Rides> { firstRide, secondRide }; UserAccount.AddRides(userId, rides); InvoiceSummary invoiceSummary = this.invoiceGenerator.GetInvoiceSummary(userId); double expected = 30; Assert.AreEqual(expected, invoiceSummary.TotalFare); }
public void GivenUSerId_ShouldReturnInvoiceSummary() { Rides firstRide = new Rides(2.0, 5, "Premium"); Rides secondRide = new Rides(0.1, 1, "Normal"); List <Rides> rides = new List <Rides> { firstRide, secondRide }; UserAccount.AddRides(this.USERID, rides); InvoiceSummary invoiceSummary = this.INVOICEGENERATOR.GetInvoiceSummary(this.USERID); InvoiceSummary expected = new InvoiceSummary { TotalNumberOfRides = 2, TotalFare = 90.0, AverageFarePerRide = 23 }; Assert.AreEqual(expected.TotalFare, invoiceSummary.TotalFare); }
public void GivenPremiumRide_ShouldReturnInvoiceSummary() { string userId = "nitin"; Rides firstRide = new Rides(3.0, 5, "Premium"); Rides secondRide = new Rides(1, 1, "Normal"); List <Rides> rides = new List <Rides> { firstRide, secondRide }; UserAccount.AddRides(userId, rides); InvoiceSummary invoiceSummary = this.invoiceGenerator.GetInvoiceSummary(userId); InvoiceSummary expected = new InvoiceSummary { TotalNumberOfRides = 2, TotalFare = 106, AverageFarePerRide = 33 }; Assert.AreEqual(expected.TotalFare, invoiceSummary.TotalFare); }