예제 #1
0
        public void Linq23_2Points()
        {
            var universities = GetAllCroatianUniversities();

            Student[] getAllStudents = HomeworkLinqQueries.Linq2_3(universities);

            Assert.AreEqual(31, getAllStudents.Length);
        }
예제 #2
0
        public void Linq22_1Point()
        {
            var universities = GetAllCroatianUniversities();

            University[] underAverageStudentNumberUniversities = HomeworkLinqQueries.Linq2_2(universities);

            Assert.AreEqual(4, underAverageStudentNumberUniversities.Length);
        }
예제 #3
0
        public void Linq21_1Point()
        {
            var universities = GetAllCroatianUniversities();

            University[] maleOnlyUniversities = HomeworkLinqQueries.Linq2_1(universities);

            Assert.AreEqual(2, maleOnlyUniversities.Length);
            Assert.IsTrue(maleOnlyUniversities.Any(u => u.Name == "Uni1"));
            Assert.IsTrue(maleOnlyUniversities.Any(u => u.Name == "Uni6"));
        }
예제 #4
0
        public void Linq25_3Points()
        {
            var universities = GetAllCroatianUniversities();

            Student[] studentsOnMultipleUniversities = HomeworkLinqQueries.Linq2_5(universities);

            Assert.AreEqual(3, studentsOnMultipleUniversities.Length);
            Assert.IsTrue(studentsOnMultipleUniversities.Any(s => s.Jmbag == "1"));
            Assert.IsTrue(studentsOnMultipleUniversities.Any(s => s.Jmbag == "2"));
            Assert.IsTrue(studentsOnMultipleUniversities.Any(s => s.Jmbag == "4"));
        }
예제 #5
0
        public void Linq1_1Point()
        {
            int[] integers = new[] { 1, 3, 3, 4, 2, 2, 2, 3, 3, 4, 5 };

            string[] result = HomeworkLinqQueries.Linq1(integers);

            Assert.AreEqual("broj 1 ponavlja se 1 puta", result[0].ToLower());
            Assert.AreEqual("broj 2 ponavlja se 3 puta", result[1].ToLower());
            Assert.AreEqual("broj 3 ponavlja se 4 puta", result[2].ToLower());
            Assert.AreEqual("broj 4 ponavlja se 2 puta", result[3].ToLower());
            Assert.AreEqual("broj 5 ponavlja se 1 puta", result[4].ToLower());
        }
예제 #6
0
        public void Linq24_2Points()
        {
            var universities = GetAllCroatianUniversities();

            Student[] oneGenderUniversityStudents = HomeworkLinqQueries.Linq2_4(universities);

            Assert.AreEqual(7, oneGenderUniversityStudents.Length);
            Assert.IsTrue(oneGenderUniversityStudents.Any(s => s.Jmbag == "1"));
            Assert.IsTrue(oneGenderUniversityStudents.Any(s => s.Jmbag == "2"));
            Assert.IsTrue(oneGenderUniversityStudents.Any(s => s.Jmbag == "30"));
            Assert.IsTrue(oneGenderUniversityStudents.Any(s => s.Jmbag == "31"));
            Assert.IsTrue(oneGenderUniversityStudents.Any(s => s.Jmbag == "32"));
            Assert.IsTrue(oneGenderUniversityStudents.Any(s => s.Jmbag == "2"));
            Assert.IsTrue(oneGenderUniversityStudents.Any(s => s.Jmbag == "3"));
        }