public void StatementForChildrensMovie()
        {
            var movie1  = new Movie("Madagascar", Movie.CHILDRENS);
            var rental1 = new Rental(movie1, 3); // 3 day rental
            var customer2
                = new CustomerBuilder()
                  .WithName("Sallie")
                  .WithRentals(rental1)
                  .Build();
            var expected = "Rental Record for Sallie\n" +
                           "\tMadagascar\t1.5\n" +
                           "Amount owed is 1.5\n" +
                           "You earned 1 frequent renter points";
            var statement = customer2.Statement();

            statement.Should().Be(expected);
        }
        public void StatementForNewReleaseMovie()
        {
            Movie    movie1    = new Movie("Star Wars", Movie.NEW_RELEASE);
            Rental   rental1   = new Rental(movie1, 3); // 3 day rental
            Customer customer2 =
                new CustomerBuilder()
                .WithName("Sallie")
                .WithRentals(rental1)
                .Build();
            var expected = "Rental Record for Sallie\n" +
                           "\tStar Wars\t9.0\n" +
                           "Amount owed is 9.0\n" +
                           "You earned 2 frequent renter points";
            var statement = customer2.Statement();

            statement.Should().Be(expected);
        }
        public void StatementForRegularMovie()
        {
            var movie1    = new Movie("Gone with the Wind", Movie.REGULAR);
            var rental1   = new Rental(movie1, 3); // 3 day rental
            var customer2 =
                new CustomerBuilder()
                .WithName("Sallie")
                .WithRentals(rental1)
                .Build();
            var expected = "Rental Record for Sallie\n" +
                           "\tGone with the Wind\t3.5\n" +
                           "Amount owed is 3.5\n" +
                           "You earned 1 frequent renter points";
            var statement = customer2.Statement();

            statement.Should().Be(expected);
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        public void Should_rent_children_movie_for_3_days()
        {
            Movie    movie  = new ChildrenMovie(ChildrenMovie);
            Rental   rental = new Rental(movie, 3); // 3 day rental
            Customer customer
                = new CustomerBuilder()
                  .WithName(CustomerName)
                  .WithRentals(rental)
                  .Build();
            string expected = "Rental Record for " + CustomerName + "\n" +
                              "\t" + ChildrenMovie + "\t" + 1.5 + "\n" +
                              "Amount owed is " + 1.5 + "\n" +
                              "You earned " + 1 + " frequent renter points";

            string statement = customer.Statement();

            Assert.AreEqual(expected, statement);
        }
Esempio n. 6
0
        public void Should_rent_regular_movie_for_less_than_2_days(int days)
        {
            Movie    movie    = new RegularMovie(RegularMovie);
            Rental   rental   = new Rental(movie, days);
            Customer customer =
                new CustomerBuilder()
                .WithName(CustomerName)
                .WithRentals(rental)
                .Build();
            var    expectedUnitPrice   = 2;
            var    expectedRenterPoint = 1;
            string expected            =
                "Rental Record for " + CustomerName + "\n" +
                "\t" + RegularMovie + "\t" + expectedUnitPrice + "\n" +
                "Amount owed is " + expectedUnitPrice + "\n" +
                "You earned " + expectedRenterPoint + " frequent renter points";

            string statement = customer.Statement();

            Assert.AreEqual(expected, statement);
        }
        public void StatementForManyMovies()
        {
            var movie1  = new Movie("Madagascar", Movie.CHILDRENS);
            var rental1 = new Rental(movie1, 6); // 6 day rental
            var movie2  = new Movie("Star Wars", Movie.NEW_RELEASE);
            var rental2 = new Rental(movie2, 2); // 2 day rental
            var movie3  = new Movie("Gone with the Wind", Movie.REGULAR);
            var rental3 = new Rental(movie3, 8); // 8 day rental
            var customer1
                = new CustomerBuilder()
                  .WithName("David")
                  .WithRentals(rental1, rental2, rental3)
                  .Build();
            var expected = "Rental Record for David\n" +
                           "\tMadagascar\t6.0\n" +
                           "\tStar Wars\t6.0\n" +
                           "\tGone with the Wind\t11.0\n" +
                           "Amount owed is 23.0\n" +
                           "You earned 4 frequent renter points";
            var statement = customer1.Statement();

            statement.Should().Be(expected);
        }
Esempio n. 8
0
        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);
        }