public async Task RemoveAsync_Gets_Removed() { var newYeast = new Yeast { Name = "newYeast" + DateTime.Now.Ticks, ProductCode = "AAA", Type = "Liquid", Custom = true }; await _yeastRepository.AddAsync(newYeast); await _yeastRepository.RemoveAsync(newYeast); var yeasts = await _yeastRepository.GetAllAsync(); Assert.True(yeasts.All(o => o.YeastId != newYeast.YeastId)); }
public async Task <YeastDto> DeleteAsync(int id) { var yeast = await _yeastRepository.GetSingleAsync(id); var yeastDto = await _yeastElasticsearch.GetSingleAsync(id); if (yeast != null) { await _yeastRepository.RemoveAsync(yeast); } if (yeastDto != null) { await _yeastElasticsearch.DeleteAsync(id); } return(yeastDto ?? AutoMapper.Mapper.Map <Yeast, YeastDto>(yeast)); }