Exemplo n.º 1
0
        /// <summary>
        /// The level 3 suggestions for the given location names.
        /// </summary>
        /// <param name="level1">The level 1 location name.</param>
        /// <param name="level2">The level 2 location name.</param>
        /// <param name="level3">The level 3 location name.</param>
        /// <returns>List of suggested locations and their coeficient.</returns>
        public List <MatchResult> Level3Suggestions(
            string level1,
            string level2,
            string level3)
        {
            IList <string> locationList = gazetteerNames.Level3AllLocationNames(
                level1,
                level2);

            return(Suggestions(level3, locationList));
        }
        public void Level3AllLocationNames_SearchNamesCaseDiffToGaz_ListIsSame()
        {
            // arrange
            GazetteerNames gazetteerNames = new GazetteerNames(
                GazetteerTestData.TestData1());

            // act
            IList<string> result1 = gazetteerNames.Level3AllLocationNames("P2A", "T2A");
            IList<string> result2 = gazetteerNames.Level3AllLocationNames("p2a", "t2a");

            // assert
            // expected that the results are the same
            Assert.AreEqual(result1.Count, result2.Count);
            IEnumerable<string> dif = result1.Except(result2);
            Assert.AreEqual(0, dif.Count());
        }
        public void Level3AllLocationNames_NoBlankOrNullReturned()
        {
            // arrange
            GazetteerNames gazetteerNames = new GazetteerNames(
                GazetteerTestData.TestData1());

            // act
            IList<string> result = gazetteerNames.Level3AllLocationNames("P1A", "T1A");

            // assert
            // no null or empty strings
            Assert.IsFalse(result.Contains(""));
            Assert.IsFalse(result.Contains(null));
        }
        public void Level3AllLocationNames_MainLevel1And2Names_MainAndAltNamesReturned()
        {
            // arrange
            GazetteerNames gazetteerNames = new GazetteerNames(
                GazetteerTestData.TestData1());

            // act
            IList<string> result = gazetteerNames.Level3AllLocationNames("P2", "T2");

            // assert
            // expected V1,V2, V3, V1A
            Assert.AreEqual(4, result.Count);
            List<string> expected = new List<string> {"V1", "V2", "V3", "V1A"};
            IEnumerable<string> dif = result.Except(expected);
            Assert.AreEqual(0, dif.Count());
        }