Esempio n. 1
0
        public void FourDaysRentalChildrensTest()
        {
            MoviePriceState moviePriceState = new MoviePriceStateChildrens();

            int daysRented = 4;

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

            Assert.AreEqual(3, rentalPrice);
            Assert.AreEqual(1, pointsEarned);
        }
Esempio n. 2
0
        public void LessThanADaysRentalChildrensPointsThrowsExceptionTest()
        {
            MoviePriceState moviePriceState = new MoviePriceStateChildrens();

            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);
        }