Beispiel #1
0
        public void TwoDaysSetsTwoDaysPrice()
        {
            var movieOffer = new MovieOffer
            {
                MovieId = "123asd",
                Title   = "Movie title",
                Price   = new MoviePrice(_twoDaysPrice, _lifeLongPrice)
            };

            var purchasedMovie = PurchasedMovie.TwoDays(movieOffer);

            Assert.Equal(_twoDaysPrice, purchasedMovie.Price);
        }
Beispiel #2
0
        public void TwoDaysSetsExpirationTwoDaysInFuture()
        {
            var movieOffer = new MovieOffer
            {
                MovieId = "123asd",
                Title   = "Movie title",
                Price   = new MoviePrice(_twoDaysPrice, _lifeLongPrice)
            };

            _dateProviderMock.Setup(dateProvider => dateProvider.Now())
            .Returns(new DateTime(2019, 7, 15));

            var purchasedMovie = PurchasedMovie.TwoDays(movieOffer);

            Assert.Equal(new DateTime(2019, 7, 17), purchasedMovie.Expiration);
        }
Beispiel #3
0
        public void PurchaseMovie(Customer customer, Movie movie)
        {
            DateTime?expirationDate = _movieService.GetExpirationDate(movie.LicensingModel);
            decimal  price          = CalculatePrice(customer.Status, customer.StatusExpirationDate, movie.LicensingModel);

            var purchasedMovie = new PurchasedMovie
            {
                MovieId        = movie.Id,
                CustomerId     = customer.Id,
                ExpirationDate = expirationDate,
                Price          = price
            };

            customer.PurchasedMovies.Add(purchasedMovie);
            customer.MoneySpent += price;
        }