public async Task ConvertAsync_WithItemCategoryAndManufacturer_ShouldConvertToReadModel()
        {
            // Arrange
            var local   = new LocalFixture();
            var service = local.CreateService();

            var item         = local.CreateItem();
            var availability = item.Availabilities.First();
            var itemCategory = local.CreateItemCategory(item.ItemCategoryId);
            var manufacturer = local.CreateManufacturer(item.ManufacturerId);
            var store        = local.CreateStore(availability.StoreId, availability.DefaultSectionId);

            local.ItemCategoryRepositoryMock.SetupFindByAsync(item.ItemCategoryId, itemCategory);
            local.ManufacturerRepositoryMock.SetupFindByAsync(item.ManufacturerId, manufacturer);
            local.StoreRepositoryMock.SetupFindByAsync(availability.StoreId.ToMonoList(), store.ToMonoList());

            // Act
            var result = await service.ConvertAsync(item, default);

            // Assert
            var expected = local.ToSimpleReadModel(item, itemCategory, manufacturer, store);

            using (new AssertionScope())
            {
                result.Should().BeEquivalentTo(expected);
            }
        }
        public async Task ConvertAsync_WithInvalidItemCategoryId_ShouldConvertToReadModel()
        {
            // Arrange
            var local   = new LocalFixture();
            var service = local.CreateService();

            var item         = local.CreateItem();
            var availability = item.Availabilities.First();
            var manufacturer = local.CreateManufacturer(item.ManufacturerId);
            var store        = local.CreateStore(availability.StoreId, availability.DefaultSectionId);

            local.ItemCategoryRepositoryMock.SetupFindByAsync(item.ItemCategoryId, null);
            local.ManufacturerRepositoryMock.SetupFindByAsync(item.ManufacturerId, manufacturer);
            local.StoreRepositoryMock.SetupFindByAsync(availability.StoreId.ToMonoList(), store.ToMonoList());

            // Act
            Func <Task <StoreItemReadModel> > function = async() => await service.ConvertAsync(item, default);

            // Assert
            using (new AssertionScope())
            {
                (await function.Should().ThrowAsync <DomainException>())
                .Where(ex => ex.Reason.ErrorCode == ErrorReasonCode.ItemCategoryNotFound);
            }
        }
        public async Task ValidateAsync_WithValidManufacturerId_ShouldNotThrow()
        {
            // Arrange
            var local   = new LocalFixture();
            var service = local.CreateService();

            var manufacturer = local.CreateManufacturer();

            local.ManufacturerRepositoryMock.SetupFindByAsync(manufacturer.Id, manufacturer);

            // Act
            Func <Task> function = async() => await service.ValidateAsync(manufacturer.Id, default);

            // Assert
            using (new AssertionScope())
            {
                await function.Should().NotThrowAsync();
            }
        }