public void TestDetails() { var teacherTestData = new List <Student>() { new Student { id = 1, Name = "Andrei", Surname = "Andrei", CNP = "0000000000001", Email = "*****@*****.**" }, new Student { id = 2, Name = "Ion1", Surname = "Gheorghe1", CNP = "0000000000002", Email = "*****@*****.**" }, }; var students = MockDbSet(teacherTestData); //Set up mocks for db sets var dbContext = new Mock <IDbContext>(); dbContext.Setup(m => m.StudentViewModel).Returns(students.Object); var studentsController = new StudentController(dbContext.Object, null, null, null, null); //Act var student = studentsController.DoDetails(1); //Assert Assert.IsTrue(student != null); Assert.IsTrue(student.id == 1); Assert.IsTrue(student.Name.CompareTo("Andrei") == 0); Assert.IsTrue(student.Surname.CompareTo("Andrei") == 0); Assert.IsTrue(student.Email.CompareTo("*****@*****.**") == 0); }