public void ShouldGetEventForACategoryAndDate()
        {
            // Arrange
            var dateFrom = new DateTime(2016, 07, 28);
            var dateTo   = new DateTime(2017, 02, 15);

            _mockTimeProvider.Setup(o => o.Now()).Returns(new DateTime(2017, 08, 08));
            var contentfulCategory1 = new ContentfulEventCategory {
                Name = "Category 1", Slug = "category-1"
            };
            var contentfulCategory2 = new ContentfulEventCategory {
                Name = "Category 2", Slug = "category-2"
            };
            var contentfulCategory3 = new ContentfulEventCategory {
                Name = "Category 3", Slug = "category-3"
            };

            var event1 =
                new ContentfulEventBuilder().EventCategoryList(new List <ContentfulEventCategory>()
            {
                contentfulCategory1
            })
                .EventDate(new DateTime(2017, 08, 01))
                .Build();
            var event2 =
                new ContentfulEventBuilder().EventCategoryList(new List <ContentfulEventCategory>()
            {
                contentfulCategory2
            })
                .EventDate(new DateTime(2016, 08, 01))
                .Build();
            var event3 =
                new ContentfulEventBuilder().EventCategoryList(new List <ContentfulEventCategory>()
            {
                contentfulCategory3
            })
                .EventDate(new DateTime(2016, 08, 01))
                .Build();

            var events = new List <ContentfulEvent> {
                event1, event2, event3
            };

            _eventCategoryFactory.Setup(o => o.ToModel(contentfulCategory1)).Returns(new EventCategory("Category 1", "category-1", "icon1"));
            _eventCategoryFactory.Setup(o => o.ToModel(contentfulCategory2)).Returns(new EventCategory("Category 2", "category-2", "icon2"));
            _eventCategoryFactory.Setup(o => o.ToModel(contentfulCategory3)).Returns(new EventCategory("Category 3", "category-3", "icon3"));

            _cacheWrapper.Setup(o => o.GetFromCacheOrDirectlyAsync(It.Is <string>(s => s == "event-all"), It.IsAny <Func <Task <IList <ContentfulEvent> > > >(), It.Is <int>(s => s == 60))).ReturnsAsync(events);

            // Act
            var response = AsyncTestHelper.Resolve(_repository.Get(dateFrom, dateTo, "Category 3", 0, null, null, null, 0, 0));

            // Assert
            response.StatusCode.Should().Be(HttpStatusCode.OK);
            var eventCalender = response.Get <EventCalender>();

            eventCalender.Events.Should().HaveCount(1);
        }
        public void ShouldGetOneEventForACategory()
        {
            // Arrange
            var contentfulCategory1 = new ContentfulEventCategory {
                Name = "Category 1", Slug = "category-1"
            };
            var contentfulCategory2 = new ContentfulEventCategory {
                Name = "Category 2", Slug = "category-2"
            };
            var category1 = new EventCategory("Category 1", "category-1", "icon1");
            var category2 = new EventCategory("Category 2", "category-2", "icon2");
            var anEvent   =
                new ContentfulEventBuilder().EventCategoryList(new List <ContentfulEventCategory>()
            {
                contentfulCategory1, contentfulCategory2
            }).Build();
            var anotherEvent = new ContentfulEventBuilder().EventCategoryList(new List <ContentfulEventCategory>()
            {
                new ContentfulEventCategory {
                    Name = "Category 2", Slug = "category-2"
                }
            }).Build();
            var events = new List <ContentfulEvent> {
                anEvent, anotherEvent
            };

            _eventCategoryFactory.Setup(o => o.ToModel(contentfulCategory1)).Returns(category1);
            _eventCategoryFactory.Setup(o => o.ToModel(contentfulCategory2)).Returns(category2);

            _cacheWrapper.Setup(o => o.GetFromCacheOrDirectlyAsync(It.Is <string>(s => s == "event-all"), It.IsAny <Func <Task <IList <ContentfulEvent> > > >(), It.Is <int>(s => s == 60))).ReturnsAsync(events);

            // Act
            var response = AsyncTestHelper.Resolve(_repository.Get(null, null, "category 1", 0, null, null, null, 0, 0));

            // Assert
            response.StatusCode.Should().Be(HttpStatusCode.OK);
            var eventCalender = response.Get <EventCalender>();

            eventCalender.Events.Should().HaveCount(1);
        }