Exemplo n.º 1
0
        public void Statement_WhenCustomerHaveNoRentals_ShouldPass()
        {
            const double expectedTotalAmount          = 0;
            const int    expectedFrequentRenterPoints = 0;

            StatementFactory.GetCustomerRental(CustomerName, null);
            var statement = StatementFactory.BuildStatement();

            TestsHelper.SetCustomerInformation(CustomerName, expectedTotalAmount, expectedFrequentRenterPoints);
            TestsHelper.SetMovieInformation(new Dictionary <string, double>());

            Assert.True(TestsHelper.CheckStatement(statement));
            Assert.True(TestsHelper.CheckStringStatement(StatementFactory.BuildStringStatement()));
            Assert.True(TestsHelper.CheckJsonStatement(StatementFactory.BuildJsonStatement()));
            Assert.True(TestsHelper.CheckUniversalStatement(StatementFactory.BuildUniversalStatement()));
        }
Exemplo n.º 2
0
        public void Statement_WhenCustomerHaveSingleRental_Shouldpass()
        {
            const int    daysRented                   = 3;
            const double expectedTotalAmount          = 9;
            const int    expectedFrequentRenterPoints = 2;

            RentalFactory.GetRentalInformation(Titles[0], TypeOfMovie.NewRelease, daysRented);
            var customerRentals = RentalFactory.Build();

            StatementFactory.GetCustomerRental(CustomerName, customerRentals);
            var statement = StatementFactory.BuildStatement();

            TestsHelper.SetCustomerInformation(CustomerName, expectedTotalAmount, expectedFrequentRenterPoints);
            TestsHelper.SetMovieInformation(TestsHelper.GetMoviesWithPrice(customerRentals));

            Assert.True(TestsHelper.CheckStatement(statement));
            Assert.True(TestsHelper.CheckStringStatement(StatementFactory.BuildStringStatement()));
            Assert.True(TestsHelper.CheckJsonStatement(StatementFactory.BuildJsonStatement()));
            Assert.True(TestsHelper.CheckUniversalStatement(StatementFactory.BuildUniversalStatement()));
        }
Exemplo n.º 3
0
        public void Statement__WhenCustomerHaveMultipleRentals_Shouldpass(int regularMovieDays, int childrensMovieDays,
                                                                          int newReleaseMovieDays,
                                                                          double expectedTotalAmount, int expectedFrequentRenterPoints)
        {
            var days = new[] { newReleaseMovieDays, regularMovieDays, childrensMovieDays };

            RentalFactory.GetRentalInformation(Titles, Types, days);
            var customerRentals = RentalFactory.Build();

            StatementFactory.GetCustomerRental(CustomerName, customerRentals);
            var statement = StatementFactory.BuildStatement();

            TestsHelper.SetCustomerInformation(CustomerName, expectedTotalAmount, expectedFrequentRenterPoints);
            TestsHelper.SetMovieInformation(TestsHelper.GetMoviesWithPrice(customerRentals));

            Assert.True(TestsHelper.CheckStatement(statement));
            Assert.True(TestsHelper.CheckStringStatement(StatementFactory.BuildStringStatement()));
            Assert.True(TestsHelper.CheckJsonStatement(StatementFactory.BuildJsonStatement()));
            Assert.True(TestsHelper.CheckUniversalStatement(StatementFactory.BuildUniversalStatement()));
        }