public async Task AddAsync_Gets_Added() { var newGlass = new Glass { Name = "newGlass" + DateTime.Now.Ticks }; await _glassRepository.AddAsync(newGlass); var glasses = await _glassRepository.GetAllAsync(); Assert.True(glasses.Any(o => o.Name == newGlass.Name)); }
public async Task <GlassDto> AddAsync(GlassDto glassDto) { var glass = AutoMapper.Mapper.Map <GlassDto, Glass>(glassDto); await _glassRepository.AddAsync(glass); var result = await _glassRepository.GetSingleAsync(glass.GlassId); var mappedResult = AutoMapper.Mapper.Map <Glass, GlassDto>(result); await _glassElasticsearch.UpdateAsync(mappedResult); return(mappedResult); }