Ejemplo n.º 1
0
        public async Task <IList <Domain.ShowDomain.Show> > GetShowAsync(GetShowRequest getShowRequest)
        {
            var shows = await _decorated.GetShowAsync(getShowRequest);

            if (getShowRequest.ShowsIds != null)
            {
                shows = shows.Where(x => getShowRequest.ShowsIds.Contains(x.Id)).ToList();
            }

            var paginatedShows = ApplyPagination(getShowRequest, shows);

            OrderCastByBirtdayDesc(paginatedShows);

            return(paginatedShows);
        }
        private void MockDecoratedService()
        {
            var response = new List <Domain.ShowDomain.Show>();

            for (int i = 0; i < 20; i++)
            {
                response.Add(new Domain.ShowDomain.Show(i, $"Show: {i}", new List <Domain.ShowDomain.Cast>()
                {
                    new Domain.ShowDomain.Cast(1, "Older Cast", new DateTime(1970, 12, 12)),
                    new Domain.ShowDomain.Cast(2, "Younger Cast", new DateTime(2000, 12, 12))
                }));
            }

            _decorated.GetShowAsync(_getShowRequest).Returns(response);
        }
        public void SetUp()
        {
            _mazeCacheConfig = Substitute.For <IOptions <MazeCacheConfig> >();
            _mazeCacheConfig.Value.Returns(new MazeCacheConfig()
            {
                DbCacheSecond = 60
            });
            _showRepository = Substitute.For <IShowRepository>();
            _decorated      = Substitute.For <IShowApplication>();
            _sut            = new CachedShowApplication(_showRepository, _mazeCacheConfig, _decorated);

            _decoratedShows = new List <Domain.ShowDomain.Show>();
            _getShowRequest = new GetShowRequest();
            _decorated.GetShowAsync(_getShowRequest).Returns(_decoratedShows);
        }
 private void MockDecoratedGetShowAsync()
 {
     _decorated.GetShowAsync(new GetShowRequest()).Returns(_decoratedShows);
 }
Ejemplo n.º 5
0
 public async Task <IList <Show> > Get([FromQuery] GetShowRequest request)
 {
     return(await _showApplication.GetShowAsync(request));
 }