public void Level1AllLocationNames_NoBlankOrNullReturned() { // arrange GazetteerNames gazetteerNames = new GazetteerNames( GazetteerTestData.TestData1()); // act IList <string> result = gazetteerNames.Level1AllLocationNames(); // assert // no null or empty strings Assert.IsFalse(result.Contains("")); Assert.IsFalse(result.Contains(null)); }
public void Level1AllLocationNames_LeadingAndTrailingSpacesRemoved() { // arrange GazetteerNames gazetteerNames = new GazetteerNames( GazetteerTestData.TestData1()); // act IList <string> result = gazetteerNames.Level1AllLocationNames(); // assert // no leading or trailing spaces Assert.IsFalse(result.Any(x => x.StartsWith(" "))); Assert.IsFalse(result.Any(x => x.EndsWith(" "))); }
/// <summary> /// Sets the gazetteer columns that hold the data to provide the codes /// </summary> /// <param name="columnHeaders">The column names.</param> /// <param name="saveSelection">If true, the selected column names are saved to the database</param> public void SetGazetteerColumns( GazetteerColumnHeaders columnHeaders, bool saveSelection = true) { gazetteerData.ColumnHeaders = columnHeaders; coder = new Coder(gazetteerData.LocationList, matchProvider); gazetteerNames = new GazetteerNames(gazetteerData.LocationList); if (saveSelection) { SaveUserSelection(columnHeaders, gazetteerFileName); } }
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 Level2AllLocationNames_MainLevel1Name_MainAndAltNamesReturned() { // arrange GazetteerNames gazetteerNames = new GazetteerNames( GazetteerTestData.TestData1()); // act IList <string> result = gazetteerNames.Level2AllLocationNames("P1"); // assert // expected T1,T2, T1A, T2A Assert.AreEqual(4, result.Count); List <string> expected = new List <string> { "T1", "T2", "T1A", "T2A" }; IEnumerable <string> dif = result.Except(expected); Assert.AreEqual(0, dif.Count()); }
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()); }
/// <summary> /// Sets the gazetteer columns that hold the data to provide the codes /// </summary> /// <param name="columnHeaders">The column names.</param> /// <param name="saveSelection">If true, the selected column names are saved to the database</param> public void SetGazetteerColumns( GazetteerColumnHeaders columnHeaders, bool saveSelection = true) { gazetteerData.ColumnHeaders = columnHeaders; coder = new Coder(gazetteerData.LocationList, matchProvider); gazetteerNames = new GazetteerNames(gazetteerData.LocationList); if (saveSelection) SaveUserSelection(columnHeaders, gazetteerFileName); }