public async Task GetAsync_Mediator_Send_CalledOnce()
        {
            var context         = CatalogueItemsControllerTestContext.Create();
            var catalogueItemId = context.GetCatalogueItemDtoResult.CatalogueItemId;

            await context.Controller.GetAsync(catalogueItemId);

            context.MediatorMock.Verify(m => m.Send(It.IsNotNull <GetCatalogueItemByIdQuery>(), default));
        }
        public async Task ListAsync_NoCatalogueItemsExist_ReturnsEmptyList()
        {
            var context  = CatalogueItemsControllerTestContext.Create();
            var response = await context.Controller.ListAsync(
                "sup1",
                CatalogueItemType.Solution,
                PublishedStatus.Published);

            response.Value.Should().BeEmpty();
        }
        public async Task ListAsync_Mediator_Send_CalledOnce()
        {
            var context = CatalogueItemsControllerTestContext.Create();
            await context.Controller.ListAsync(
                "sup1",
                CatalogueItemType.Solution,
                PublishedStatus.Published);

            context.MediatorMock.Verify(m => m.Send(It.IsNotNull <ListCatalogueItemQuery>(), default));
        }
        public async Task GetAsync_CatalogueItemFound_ReturnsExpectedResponse()
        {
            var context  = CatalogueItemsControllerTestContext.Create();
            var response = await context.Controller.GetAsync(context.GetCatalogueItemDtoResult.CatalogueItemId);

            var expected = GetCatalogueItemResultBuilder
                           .Create()
                           .WithCatalogueItemId(context.GetCatalogueItemDtoResult.CatalogueItemId)
                           .WithName(context.GetCatalogueItemDtoResult.Name)
                           .Build();

            response.Value.Should().BeEquivalentTo(expected);
        }
        public async Task GetAsync_NullCatalogueItem_ReturnsEmptyGetCatalogueItemResult()
        {
            var context = CatalogueItemsControllerTestContext.Create();

            context.GetCatalogueItemDtoResult = null;

            var response = await context.Controller.GetAsync(string.Empty);

            var expected = GetCatalogueItemResultBuilder
                           .Create()
                           .WithCatalogueItemId(null)
                           .WithName(null)
                           .Build();

            response.Value.Should().BeEquivalentTo(expected);
        }
        public async Task ListAsync_CatalogueItemsExist_ReturnsExpectedResponse()
        {
            var context        = CatalogueItemsControllerTestContext.Create();
            var catalogueItem1 = CatalogueItemDtoBuilder
                                 .Create()
                                 .Build();

            var catalogueItem2 = CatalogueItemDtoBuilder
                                 .Create()
                                 .Build();

            context.ListCatalogueItemsDtoResult.Add(catalogueItem1);
            context.ListCatalogueItemsDtoResult.Add(catalogueItem2);

            var response = await context.Controller.ListAsync(
                "sup1",
                CatalogueItemType.Solution,
                PublishedStatus.Published);

            var expected = context.ListCatalogueItemsDtoResult.Select(CatalogueItemResultBuilder).ToList();

            response.Value.Should().BeEquivalentTo(expected);
        }