예제 #1
0
        public void GetsMovieCatalog()
        {
            var customerId = "jkbfblf";

            _getCustomersMock.Setup(getCustomers => getCustomers.Get(customerId))
            .Returns(new Customer
            {
                Id     = customerId,
                Name   = "Djuro Djuric",
                Email  = "*****@*****.**",
                Status = new CustomerStatusRegular()
            });
            _getMoviesMock.Setup(x => x.GetAll()).Returns(new List <Movie>
            {
                new Movie
                {
                    Id    = "abc",
                    Price = new MoviePrice(12m, 12m),
                    Title = "Movie Title"
                }
            });
            var movieCatalogDto = _service.GetCatalog(customerId);

            Assert.True(movieCatalogDto.IsSuccess);
        }
예제 #2
0
        public IActionResult GetMovieCatalog(string customerId)
        {
            var result = _viewCatalogService.GetCatalog(customerId);

            if (result.IsSuccess)
            {
                return(Ok(result.Value));
            }
            else if (result.Error.Equals(Errors.CustomerNotFound))
            {
                return(NotFound(result.Error));
            }

            return(BadRequest());
        }