public void Test_Index() { //Arrange MockHandler mock = new MockHandler(); User user = new User() { Username = "******", langPref = "NL" }; Glossary glos = new Glossary() { GlossaryId = 1, Dutch = "Hallo", English = "Hello", Spanish = "Ola" }; mock.Glossaries = new List <Glossary>() { glos }; mock.Users = new List <User>() { user }; mock.SetTempUsername(null, "*****@*****.**"); mock.SetTempRole(null, "Student"); HomeController cont = new HomeController(null, mock); //Act cont.Index("SP"); string role = mock.GetTempRole(null); var result = mock.GetUsers().FirstOrDefault(); //Assert Assert.Equal("Student", role); Assert.Equal("SP", result.langPref); }