public async void DeleteAuthorTest() { AuthorController authorController = new AuthorController(new AuthorRepository(_dataContext)); var author = (Author)((OkObjectResult)await authorController.GetAuthorByName("Daniel")).Value; await authorController.Delete(author); var result = (Author)((OkObjectResult)await authorController.GetAuthorByName("Daniel")).Value; Assert.Null(result); }
public async void CreateAuthorTest() { AuthorController authorController = new AuthorController(new AuthorRepository(_dataContext)); await authorController.Post(_author); var result = (OkObjectResult)await authorController.GetAuthorByName("TesteController"); Assert.NotNull(result.Value); }
public async void UpdateAuthorTest() { AuthorController authorController = new AuthorController(new AuthorRepository(_dataContext)); var author = (Author)((OkObjectResult)await authorController.GetAuthorByName("TesteController")).Value; author.Name = "Daniel"; await authorController.Put(author); var result = (OkObjectResult)await authorController.Get("Daniel"); Assert.NotNull(result.Value); }