public void TeacherControllerAssignExamToGroupTest() { //Arrange bool isExamAssigned = false; var group = new Mock <Group>("Test"); group.Setup(t => t.AssignExam(It.IsAny <Exam>())).Callback(() => isExamAssigned = true); Teacher teacher = new Teacher("Petro", "Petrov", "ID", "petrov"); TeacherController teacherController = new TeacherController(teacher); Exam exam = new Exam("SomeExam", 1, 3, 1); //Act teacherController.AssignExamToGroup(exam, group.Object); //Assert Assert.IsTrue(isExamAssigned); }