Example #1
0
        public void TwoDaysRentalNewReleaseTest()
        {
            MoviePriceState moviePriceState = new MoviePriceStateNewRelease();

            int daysRented = 2;

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

            Assert.AreEqual(6, rentalPrice);
            Assert.AreEqual(2, pointsEarned);
        }
Example #2
0
        public void LessThanADaysRentalNewReleasePointsThrowsExceptionTest()
        {
            MoviePriceState moviePriceState = new MoviePriceStateNewRelease();

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