public void UpdateWithValidDataShouldReturnOk()
 {
     var controller = new CategoriesController(categories);
     var result = controller.Update(1, "new title");
     var okResult = result as OkResult;
     Assert.IsNotNull(okResult, "Update with valid id should return OK");
 }
 public void UpdateWithNotExistingCategoryShouldReturnBadRequest()
 {
     var controller = new CategoriesController(categories);
     var result = controller.Update(120, "fail");
     var badResult = result as BadRequestErrorMessageResult;
     Assert.IsNotNull(badResult, "Update with invalid id should return bad request");
 }
 public void AddShouldReturnOK()
 {
     var controller = new CategoriesController(categories);
     var result = controller.Add("test");
     var okResult = result as OkNegotiatedContentResult<int>;
     Assert.IsNotNull(okResult, "Add should return OK");
     Assert.AreEqual(2, okResult.Content);
 }
        public void GetShouldReturnOk()
        {
            var controller = new CategoriesController(categories);

            var result = controller.Get();
            var okResult = result as OkNegotiatedContentResult<List<Category>>;
            Assert.IsNotNull(okResult, "Should return OK");
            Assert.AreEqual(1, okResult.Content.Count);
        }