Exemplo n.º 1
0
        public void TestGetQualificationLevels()
        {
            var list = new List <QualLevel>
            {
                new QualLevel {
                    Display = true, Key = "Key1", Level = "Level1", Text = "Text1"
                },
                new QualLevel {
                    Display = false, Key = "Key2", Level = "Level2", Text = "Text2"
                },
                new QualLevel {
                    Display = true, Key = "Key3", Level = "Level3", Text = "Text3"
                },
            };

            MockFileHelper.Setup(x => x.LoadQualificationLevels()).Returns(list);

            var expected = new List <SelectListItem>
            {
                new SelectListItem {
                    Text = "Text1", Value = "Key1"
                },
                new SelectListItem {
                    Text = "Text3", Value = "Key3"
                }
            };

            var actual = CourseDirectory.GetQualificationLevels();

            expected.IsSame(actual);
        }
Exemplo n.º 2
0
        public void TestAutoSuggestCourseNameWithoutMissSpellings()
        {
            var doc      = CreateTestSynonymsDoc();
            var expected = new[] { "1", "2" };

            MockFileHelper.Setup(x => x.LoadSynonyms()).Returns(doc);
            MockCourseDirectoryHelper.Setup(x => x.GetMatches(It.IsAny <string>(), It.IsAny <XmlNodeList>()))
            .Returns(new[] { "1", "2" });
            MockCourseDirectoryHelper.Setup(x => x.GetMissSpellings(It.IsAny <string>(), It.IsAny <XmlDocument>(), It.IsAny <XmlNodeList>()))
            .Returns(new[] { "3", "4" });

            var actual = CourseDirectory.AutoSuggestCourseName("AB");

            expected.IsSame(actual);
        }