Beispiel #1
0
        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);
        }
Beispiel #2
0
        public void Test_GetUserRole()
        {
            //Arrange
            MockHandler mock = new MockHandler();

            mock.SetTempRole(null, "Student");
            HomeController cont = new HomeController(null, mock);

            //Act
            var result1 = mock.GetTempRole(null);

            //Assert
            Assert.Equal("Student", result1);
        }