public async Task RemoveAsync_Gets_Removed() { var newGlass = new Glass { Name = "newGlass" + DateTime.Now.Ticks }; await _glassRepository.AddAsync(newGlass); await _glassRepository.RemoveAsync(newGlass); var glasses = await _glassRepository.GetAllAsync(); Assert.True(glasses.All(o => o.GlassId != newGlass.GlassId)); }
public async Task <GlassDto> DeleteAsync(int id) { var glass = await _glassRepository.GetSingleAsync(id); var glassDto = await _glassElasticsearch.GetSingleAsync(id); if (glass != null) { await _glassRepository.RemoveAsync(glass); } if (glassDto != null) { await _glassElasticsearch.DeleteAsync(id); } return(glassDto ?? AutoMapper.Mapper.Map <Glass, GlassDto>(glass)); }