public async Task TestBaseServiceDbWrite_ShouldCreateAsync() { var service = new WikiPassageService(); await service.AddAsync(BuildOneEntity()); WikiPassage passage = service.GetById(1); Assert.NotNull(passage); }
public async Task TestBaseServiceDbUpdate_ShouldUpdate() { WikiPassageService service = new WikiPassageService(); await service.AddAsync(BuildOneEntity()); WikiPassage passage = service.GetById(1); passage.Content = "这是修改后的内容"; await service.UpdateAsync(passage); Assert.True(service.GetById(1).Content == "这是修改后的内容"); }
public async Task TestBaseServiceDbDelte_ShouldDeleteAsync() { WikiPassageService service = new WikiPassageService(); await service.AddAsync(BuildOneEntity()); WikiPassage passageToFind = service.GetById(1); await service.DeleteByIdAsync(1); WikiPassage passage = service.GetById(1); Assert.NotNull(passageToFind); Assert.Null(passage); }