public void NonEmpty() { const string expected = "Rental Record for John Smith\n" + " Monty Python and the Holy Grail - $3.50\n" + " Ran - $2.00\n" + " LA Confidential - $6.00\n" + " Star Trek 13.2 - $3.00\n" + " Wallace and Gromit - $6.00\n" + "Amount charged is $20.50\n" + "You have a new total of 6 frequent renter points"; var customer = new Customer("John Smith"); var montyPython = new Movie("Monty Python and the Holy Grail", new RegularPrice()); var ran = new Movie("Ran", new RegularPrice()); var laConfidential = new Movie("LA Confidential", new NewReleasePrice()); var starTrek = new Movie("Star Trek 13.2", new NewReleasePrice()); var wallaceAndGromit = new Movie("Wallace and Gromit", new ChildrensPrice()); var mixedRentals = new List<Rental>(); mixedRentals.Add(new Rental(montyPython, 3)); mixedRentals.Add(new Rental(ran, 1)); mixedRentals.Add(new Rental(laConfidential, 2)); mixedRentals.Add(new Rental(starTrek, 1)); mixedRentals.Add(new Rental(wallaceAndGromit, 6)); Assert.AreEqual(expected, customer.Statement(mixedRentals)); }
public void For_A_Childrens_Release_Every_three_day_rentals_get_two_additional_days_free() { var isNewMovie = false; var isChildrensMovie = true; var childsMovie = new Movie("A Childrens Movie", isNewMovie, isChildrensMovie); var model = new Rental(childsMovie, 2); Assert.AreEqual(1, model.NumberOfFreeDays); }
public bool Equals(Movie other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Equals(other.title, title); }
public void AddMovie(Movie movie, int period) { order.Add(new Rental(movie, period)); }
public void ShouldContainTitle() { var movie = new Movie("Avatar"); Assert.That(movie.Title, Is.EqualTo("Avatar")); }
public void Ensure_that_a_new_childs_movie_has_new_and_childrens_in_its_display_name() { var model = new Movie("A new childs movie", true, true); Assert.AreEqual("A new childs movie *new *childrens", model.GetDisplayName()); }
public void Ensure_that_a_childs_movie_has_Childrens_in_its_display_name() { var model = new Movie("A childs movie", false, true); Assert.AreEqual("A childs movie *childrens", model.GetDisplayName()); }
public void EnsureThatIfAMovieIsNewItsDisplayNameHasNewAppended() { var model = new Movie("Jaws", true); Assert.AreEqual("Jaws *new", model.GetDisplayName()); }
public void EnsureThatIfAMoveIsNotNewItsDisplayNameIsItsTitle() { var model = new Movie("Jaws", false); Assert.AreEqual(model.Title, model.GetDisplayName()); }
public Rental(Movie movie, int periodInDays) { this.movie = movie; this.periodInDays = periodInDays; }
public void EnsureRentalsOfRegularMoviesReceiveOneFreeDayForEveryThreeDays() { var movie = new Movie("Hook", false); var model = new Rental(movie, 7); Assert.AreEqual(2, model.NumberOfFreeDays); }
public void EnsureRentalsOfNewMoviesReceiveOneFreeDayForPeriodsOverSixDays() { var movie = new Movie("Hook", true); var model = new Rental(movie, 7); Assert.AreEqual(1, model.NumberOfFreeDays); }
public void EnsureCustomersAreNotChargedForFreeDays() { var periodInDays = 7; var movie = new Movie("Hook", true); Assert.AreEqual(7, movie.GetCharge(periodInDays)); }
public void AddMovie(Movie movie) { rentals.Add(new Rental(movie, 1)); }