예제 #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);
        }
예제 #2
0
        public void LessThanADaysRentalChildrensPriceThrowsExceptionTest()
        {
            MoviePriceState moviePriceState = new MoviePriceStateChildrens();

            int       daysRented        = 0;
            Exception expectedException = null;

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

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