Test.StudentModelTest.getAllTest C# (CSharp) Méthode

getAllTest() private méthode

private getAllTest ( ) : void
Résultat void
        public void getAllTest()
        {
            List<string> matricId = new List<string>();
            matricId.Add("test");
            matricId.Add("test2");
            matricId.Add("test3");

            Dictionary<string, Student> expected = new Dictionary<string, Student>();

            for (int i = 0; i < matricId.Count; i++)
            {
                Student temp = new Student();
                temp = StudentModel.getByMatricId(matricId[i]);
                expected.Add(matricId[i], temp);
            }

            Dictionary<string, Student> actual;
            actual = StudentModel.getAll();

            Assert.AreEqual(expected.Count, actual.Count);
            bool isEqual = true;
            foreach (KeyValuePair<string, Student> pair in expected)
            {
                isEqual = actual.ContainsKey(pair.Key);
            }
            Assert.IsTrue(isEqual);
        }