public async void GetMenuHandlerFailure()
        {
            GetMenuQuery        getMenuQuery   = new GetMenuQuery();
            GetMenuQueryHandler getMenuHandler = new GetMenuQueryHandler();
            var actual = await getMenuHandler.Handle(getMenuQuery, new CancellationToken());

            Assert.NotEqual(5, actual.Count());
        }
Beispiel #2
0
        public async Task Then_The_Api_Is_Called_And_The_Menu_Is_Returned(
            GetMenuQuery query,
            CmsContent apiResponse,
            MenuPageModel response,
            [Frozen] Mock <IContentService> contentService,
            [Frozen] Mock <IReliableCacheStorageService> service,
            GetMenuQueryHandler handler)
        {
            contentService.Setup(x => x.HasContent(It.IsAny <ApiResponse <CmsContent> >())).Returns(true);
            service.Setup(o =>
                          o.GetData <CmsContent>(
                              It.Is <GetMenuRequest>(c =>
                                                     c.GetUrl.Contains($"entries?content_type=navigationMenu&fields.type={query.MenuType}")),
                              $"{query.MenuType}_menu", contentService.Object.HasContent))
            .ReturnsAsync(apiResponse);

            var actual = await handler.Handle(query, CancellationToken.None);

            actual.PageModel.Should().BeEquivalentTo(response.Build(apiResponse));
        }