コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }