public void PutNewsInstance_ShouldSuccess() { var context = new MockNewsFeedAPIContext(); var controller = new NewsInstancesController(context); context.NewsInstances.Add(GetNewsInstance()); var newInstance = GetNewsInstance(); newInstance.RateCount = 100; var result = controller.PutNewsInstance(1, newInstance) as StatusCodeResult; Assert.IsNotNull(result); Assert.AreEqual(HttpStatusCode.NoContent, result.StatusCode); }
public void PutNewsInstance_ShouldFailDifferentID() { var context = new MockNewsFeedAPIContext(); var controller = new NewsInstancesController(context); context.NewsInstances.Add(GetNewsInstance()); var newInstance = GetNewsInstance(); newInstance.RateCount = 100; var result = controller.PutNewsInstance(3, newInstance); Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(BadRequestErrorMessageResult)); }