예제 #1
0
        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));
        }
예제 #2
0
파일: RentalTests.cs 프로젝트: Sivsu/Abcam
        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);
        }
예제 #3
0
파일: Movie.cs 프로젝트: Sivsu/Abcam
 public bool Equals(Movie other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return Equals(other.title, title);
 }
예제 #4
0
파일: Cart.cs 프로젝트: Sivsu/Abcam
 public void AddMovie(Movie movie, int period)
 {
     order.Add(new Rental(movie, period));
 }
예제 #5
0
파일: MovieTests.cs 프로젝트: Sivsu/Abcam
 public void ShouldContainTitle()
 {
     var movie = new Movie("Avatar");
     Assert.That(movie.Title, Is.EqualTo("Avatar"));
 }
예제 #6
0
파일: MovieTests.cs 프로젝트: Sivsu/Abcam
 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());
 }
예제 #7
0
파일: MovieTests.cs 프로젝트: Sivsu/Abcam
 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());
 }
예제 #8
0
파일: MovieTests.cs 프로젝트: Sivsu/Abcam
 public void EnsureThatIfAMovieIsNewItsDisplayNameHasNewAppended()
 {
     var model = new Movie("Jaws", true);
     Assert.AreEqual("Jaws *new", model.GetDisplayName());
 }
예제 #9
0
파일: MovieTests.cs 프로젝트: Sivsu/Abcam
 public void EnsureThatIfAMoveIsNotNewItsDisplayNameIsItsTitle()
 {
     var model = new Movie("Jaws", false);
     Assert.AreEqual(model.Title, model.GetDisplayName());
 }
예제 #10
0
 public Rental(Movie movie, int periodInDays)
 {
     this.movie = movie;
     this.periodInDays = periodInDays;
 }
예제 #11
0
파일: RentalTests.cs 프로젝트: Sivsu/Abcam
 public void EnsureRentalsOfRegularMoviesReceiveOneFreeDayForEveryThreeDays()
 {
     var movie = new Movie("Hook", false);
     var model = new Rental(movie, 7);
     Assert.AreEqual(2, model.NumberOfFreeDays);
 }
예제 #12
0
파일: RentalTests.cs 프로젝트: Sivsu/Abcam
 public void EnsureRentalsOfNewMoviesReceiveOneFreeDayForPeriodsOverSixDays()
 {
     var movie = new Movie("Hook", true);
     var model = new Rental(movie, 7);
     Assert.AreEqual(1, model.NumberOfFreeDays);
 }
예제 #13
0
파일: RentalTests.cs 프로젝트: Sivsu/Abcam
 public void EnsureCustomersAreNotChargedForFreeDays()
 {
     var periodInDays = 7;
     var movie = new Movie("Hook", true);
     Assert.AreEqual(7, movie.GetCharge(periodInDays));
 }
예제 #14
0
 public void AddMovie(Movie movie)
 {
     rentals.Add(new Rental(movie, 1));
 }