Exemple #1
0
        public void FourDaysRentalRrgularTest()
        {
            MoviePriceState moviePriceState = new MoviePriceStateRegular();

            int daysRented = 4;

            var rentalPrice  = moviePriceState.GetRentalPrice(daysRented);
            var pointsEarned = moviePriceState.GetFrecuentRentalPoints(daysRented);

            Assert.AreEqual(5, rentalPrice);
            Assert.AreEqual(1, pointsEarned);
        }
Exemple #2
0
        public void LessThanADaysRentalRegularPointsThrowsExceptionTest()
        {
            MoviePriceState moviePriceState = new MoviePriceStateRegular();

            int       daysRented        = 0;
            Exception expectedException = null;

            try
            {
                var result = moviePriceState.GetFrecuentRentalPoints(daysRented);
            }
            catch (Exception ex)
            {
                expectedException = ex;
            }

            Assert.IsNotNull(expectedException);
            Assert.IsInstanceOfType(expectedException, typeof(ArgumentException));
            Assert.AreEqual("Days rented must be positive.", expectedException.Message);
        }