public void GetCourse_ShouldReturnCourse_WithSameId() { var context = new TestCourseContext(); context.Courses.Add(GetDemoCourse()); var controller = new CoursesController(context); var getResult = controller.GetCourse(3); var result = getResult.Result as OkNegotiatedContentResult<Course>; Assert.IsNotNull(result); Assert.AreEqual(result.Content.Id, 3); }
public void GetCourse_ShouldReturnNotFound_WhenDifferentId() { var context = new TestCourseContext(); context.Courses.Add(GetDemoCourse()); var controller = new CoursesController(context); var getResult = controller.GetCourse(999); var result = getResult.Result as NotFoundResult; Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(NotFoundResult)); }