public void TeacherControllerCreateExamTest() { //Arrange var examAccess = new Mock <ExamAccess>(new DBAccess()); examAccess.Setup(t => t.InsertExamToDB(It.IsAny <Exam>(), It.IsAny <int>())); Teacher teacher = new Teacher("Petro", "Petrov", "ID", "petrov"); ResultAccess resultAccess = new ResultAccess(new DBAccess()); StudentAccess studentAccess = new StudentAccess(new DBAccess()); TeacherController teacherController = new TeacherController(teacher, resultAccess, studentAccess, examAccess.Object); Question question1 = new Question("Some question1", "Correct answer1", new List <String> { "Answer11", "Answer12" }); Question question2 = new Question("Some question2", "Correct answer2", new List <String> { "Answer21", "Answer22" }); List <Question> questions = new List <Question> { question1, question2 }; Subject subject = new Subject("Subject"); //Act bool isExamCreated = teacherController.CreateExam("SomeExam", 1, 3, questions, subject); //Assert Assert.IsTrue(isExamCreated); }