public void UpdateOneAsync() { Task.Run(async() => { CategoryDocument category = new CategoryDocument() { Id = Guid.NewGuid().ToString(), Name = "Machine Learning" }; CategoryDocument modifiedCategory = new CategoryDocument() { Id = category.Id, Name = "Algorithm" }; await _categoryRepository.AddOneAsync(category); await _categoryRepository.UpdateOneAsync(modifiedCategory); CategoryDocument dbCategory = await _categoryRepository.GetByIdAsync(category.Id); Assert.NotNull(dbCategory); Assert.Equal(modifiedCategory.Id, dbCategory.Id); Assert.Equal(modifiedCategory.Name, dbCategory.Name); }).GetAwaiter().GetResult(); }
public void DeleteByIdAsync() { Task.Run(async() => { CategoryDocument category = new CategoryDocument() { Id = Guid.NewGuid().ToString(), Name = "Machine Learning" }; await _categoryRepository.AddOneAsync(category); await _categoryRepository.DeleteByIdAsync(category.Id); CategoryDocument dbCategory = await _categoryRepository.GetByIdAsync(category.Id); Assert.Null(dbCategory); }).GetAwaiter().GetResult(); }