public static Customer GetCustomer() { const string customerName = "Romnaka"; var regularMovie = new RegularMovie("Harry Potter"); var childrensMovie = new ChildrensMovie("The Lion King"); var newReleaseMovie = new NewReleaseMovie("Van Helsing"); var customer = new Customer(customerName, new[] { new Rental(regularMovie, 5), new Rental(childrensMovie, 4), new Rental(newReleaseMovie, 3) }); return(customer); }
public void Should_rent_new_release_for_1_day() { Movie movie = new NewReleaseMovie(NewReleaseMovie); Rental rental = new Rental(movie, 1); Customer customer = new CustomerBuilder() .WithName(CustomerName) .WithRentals(rental) .Build(); string expected = "Rental Record for " + CustomerName + "\n" + "\t" + NewReleaseMovie + "\t" + 3 + "\n" + "Amount owed is " + 3 + "\n" + "You earned " + 1 + " frequent renter points"; string statement = customer.Statement(); Assert.AreEqual(expected, statement); }
public void GetStatement_WhenCustomerHaveMultipleRentals_ShouldPass(int regularMovieDays, int childrensMovieDays, int newReleaseMovieDays, double expectedTotalAmount, int expectedFrequentRenterPoints) { const string customerName = "Romnaka"; var regularMovie = new RegularMovie("Harry Potter"); var childrensMovie = new ChildrensMovie("The Lion King"); var newReleaseMovie = new NewReleaseMovie("Van Helsing"); var customer = new Customer(customerName, new[] { new Rental(regularMovie, regularMovieDays), new Rental(childrensMovie, childrensMovieDays), new Rental(newReleaseMovie, newReleaseMovieDays) }); customer.GetStatement(new StandardFormatter()); Assert.Equal(expectedTotalAmount, customer.TotalAmount); Assert.Equal(expectedFrequentRenterPoints, customer.FrequentRenterPoints); }
public void GetStatement_WhenCustomerHaveMultipleRentals_ShouldPass(int regularMovieDays, int childrensMovieDays, int newReleaseMovieDays, double expectedTotalAmount, int expectedFrequentRenterPoints) { const string customerName = "Romnaka"; var regularMovie = new RegularMovie("Harry Potter"); var childrensMovie = new ChildrensMovie("The Lion King"); var newReleaseMovie = new NewReleaseMovie("Van Helsing"); var customer = new Customer(customerName, new[] { new Rental(regularMovie, regularMovieDays), new Rental(childrensMovie, childrensMovieDays), new Rental(newReleaseMovie, newReleaseMovieDays) }); customer.GetStatement(new StandardFormatter()); Assert.Equal(expectedTotalAmount, customer.TotalAmount); Assert.Equal(expectedFrequentRenterPoints, customer.FrequentRenterPoints); }
public void StatementForManyMovies() { Movie movie1 = new ChildrenMovie("Madagascar"); Rental rental1 = new Rental(movie1, 6); // 6 day rental Movie movie2 = new NewReleaseMovie("Star Wars"); Rental rental2 = new Rental(movie2, 2); // 2 day rental Movie movie3 = new RegularMovie("Gone with the Wind"); Rental rental3 = new Rental(movie3, 8); // 8 day rental Customer customer = new CustomerBuilder() .WithName("David") .WithRentals(rental1, rental2, rental3) .Build(); string expected = "Rental Record for David\n" + "\tMadagascar\t6\n" + "\tStar Wars\t6\n" + "\tGone with the Wind\t11\n" + "Amount owed is 23\n" + "You earned 4 frequent renter points"; string statement = customer.Statement(); Assert.AreEqual(expected, statement); }
public static Customer GetCustomer() { const string customerName = "Romnaka"; var regularMovie = new RegularMovie("Harry Potter"); var childrensMovie = new ChildrensMovie("The Lion King"); var newReleaseMovie = new NewReleaseMovie("Van Helsing"); var customer = new Customer(customerName, new[] { new Rental(regularMovie, 5), new Rental(childrensMovie, 4), new Rental(newReleaseMovie, 3) }); return customer; }