Beispiel #1
0
            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);
            }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
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);
        }
Beispiel #5
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);
        }
Beispiel #6
0
            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;
            }
Beispiel #7
0
 public static void SetUp()
 {
     movie = new RegularMovie(name: "TestMovie");
 }