public async Task <AddCardCommand> MapToAddCommand(YugiohCard yugiohCard) { ICollection <Category> categories = await _categoryService.AllCategories(); ICollection <SubCategory> subCategories = await _subCategoryService.AllSubCategories(); var command = new AddCardCommand { Card = await MapToCardInputModel(yugiohCard, new CardInputModel(), categories, subCategories) }; return(command); }
public async Task Given_An_AllSubCategories_Query_Should_Return_All_SubCategories() { // Arrange const int expected = 2; _subCategoryService.AllSubCategories().Returns(new List <SubCategory> { new SubCategory(), new SubCategory() }); // Act var result = await _sut.Handle(new AllSubCategoriesQuery(), CancellationToken.None); // Assert result.Should().HaveCount(expected); }
public void SetUp() { _categoryService = Substitute.For <ICategoryService>(); _subCategoryService = Substitute.For <ISubCategoryService>(); _typeService = Substitute.For <ITypeService>(); _attributeService = Substitute.For <IAttributeService>(); _linkArrowService = Substitute.For <ILinkArrowService>(); _categoryService.AllCategories().Returns(TestData.AllCategories()); _subCategoryService.AllSubCategories().Returns(TestData.AllSubCategories()); _typeService.AllTypes().Returns(TestData.AllTypes()); _attributeService.AllAttributes().Returns(TestData.AllAttributes()); _linkArrowService.AllLinkArrows().Returns(TestData.AllLinkArrows()); _sut = new CardCommandMapper ( _categoryService, _subCategoryService, _typeService, _attributeService, _linkArrowService ); }
public async Task <IEnumerable <SubCategoryOutputModel> > Handle(AllSubCategoriesQuery request, CancellationToken cancellationToken) { var formats = await _subCategoryService.AllSubCategories(); return(formats.MapToOutputModels()); }