Exemplo n.º 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);
        }
Exemplo n.º 2
0
        public void LessThanADaysRentalRegularPriceThrowsExceptionTest()
        {
            MoviePriceState moviePriceState = new MoviePriceStateRegular();

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