public void AddStudentToCourseReturnsStudenttCourse() { //Arrange repository.Setup(r => r.AddToCourse(It.IsAny <long>(), It.IsAny <long>())).ReturnsAsync(new StudentCourse()); repository.Setup(r => r.Exists(It.IsAny <object[]>())).ReturnsAsync(true); //Act var result = (controller.AddStudentToCourse(1, 1).Result as OkObjectResult)?.Value; //Assert Assert.IsInstanceOfType(result, typeof(StudentCourse)); }