public async Task CreateCatalogItem() { var commonId = 1; var catalogItem = new CatalogItemAM { Kind = CatalogItemKind.Brand, Name = "Запорожец", Value = 0 }; var catalogId = commonId++; var domainCatalogItem = new CatalogItem { Id = commonId++, Kind = catalogItem.Kind, Name = catalogItem.Name, Value = catalogItem.Value }; Suite.DomainCatalogItemServiceMock .Setup(m => m.Create(catalogId, catalogItem.Kind, catalogItem.Name, catalogItem.Value)) .ReturnsAsync(domainCatalogItem); var result = await Suite.CatalogService.CreateCatalogItem(catalogId, catalogItem); Assert.Equal(domainCatalogItem.Id, result.Id); Assert.Equal(domainCatalogItem.Kind, result.Kind); Assert.Equal(domainCatalogItem.Name, result.Name); Assert.Equal(domainCatalogItem.Value, result.Value); }
private CatalogItemAM FromDomainEntity(CatalogItem source) { var destination = new CatalogItemAM(); return(MappingService.Map(source, destination)); }
public async Task <CatalogItemAM> CreateCatalogItem(int catalogId, CatalogItemAM item) { var domainResult = await DomainCatalogItemService.Create(catalogId, item.Kind, item.Name, item.Value); return(FromDomainEntity(domainResult)); }