コード例 #1
0
        public void GetMoviesWithUnchangedPricesForRegularCustomer()
        {
            var customer = new Customer
            {
                Name   = "Milicevic Miroslav",
                Id     = "0ffs1",
                Email  = "*****@*****.**",
                Status = new CustomerStatusRegular()
            };

            var offers = _movieCatalog.GetMovies(customer);

            Assert.Equal(1, offers.Count);
            Assert.Equal(MovieId, offers.First().MovieId);
            Assert.Equal(MovieName, offers.First().Title);
            Assert.Equal(TwoDaysMoviePrice, offers.First().Price.TwoDays);
            Assert.Equal(LifeLongMoviePrice, offers.First().Price.LifeLong);
        }
コード例 #2
0
        public Result <MovieCatalogDto> GetCatalog(string customerId)
        {
            var customer = _customersGetter.Get(customerId);

            if (customer.HasNoValue)
            {
                return(Result.Fail <MovieCatalogDto>(Errors.CustomerNotFound));
            }

            var movies = _moviesGetter.GetAll();

            var movieCatalog = new MovieCatalog(movies, new MoviePriceCalculatorFactory());
            var movieOffers  = movieCatalog.GetMovies(customer.Value);

            return(Result.Ok(MovieCatalogDtoMapper.MapToDto(movieOffers)));
        }