public void EditShouldReturnNotFoundForBadId() { var controller = TestData.CreateReferenceController(); var update = new TestArticle { UserId = "10000" }; var result = (NotFoundResult)controller.Edit(update); Assert.Equal(404, result.StatusCode); }
public void CreateShouldSaveANewReference() { var controller = TestData.CreateReferenceController(); var article = new TestArticle(); var result = (OkObjectResult)controller.Create(article); Assert.Equal(200, result.StatusCode); var value = (Article)result.Value; Assert.Equal(4, value.Id); Assert.Equal(TestData.NameIdentifier, value.UserId); }
public void EditShouldUpdateAReference() { var controller = TestData.CreateReferenceController(); var update = new TestArticle { Id = 1, Title = "New Title", Year = 3000 }; var result = (OkObjectResult)controller.Edit(update); Assert.Equal(200, result.StatusCode); var value = (Article)result.Value; Assert.Equal("New Title", value.Title); Assert.Equal(3000, value.Year); }