public void Fill_ShouldFillTheRightElements() { var parser = new SvgMapGraphicParser(); var map = parser.ParseFromFile(@"Texas.svg"); map.Fill(Color.Beige, "TX_Crosby", "TX_Lubbock", "TX_Floyd"); map.Fill(Color.Gainsboro, "TX_Bailey", "TX_Lubbock", "TX_Briscoe"); var document = map.GetSvgXmlDocument(); var colorDefault = ColorTranslator.FromHtml("#D0D0D0"); var color_TX_Crosby = ColorTranslator.FromHtml(document.GetElementById("TX_Crosby").GetAttribute("fill")); var color_TX_Lubbock = ColorTranslator.FromHtml(document.GetElementById("TX_Lubbock").GetAttribute("fill")); var color_TX_Floyd = ColorTranslator.FromHtml(document.GetElementById("TX_Floyd").GetAttribute("fill")); var color_TX_Bailey = ColorTranslator.FromHtml(document.GetElementById("TX_Bailey").GetAttribute("fill")); var color_TX_Briscoe = ColorTranslator.FromHtml(document.GetElementById("TX_Briscoe").GetAttribute("fill")); var color_TX_Red_River = ColorTranslator.FromHtml(document.GetElementById("TX_Red_River").GetAttribute("fill")); Assert.AreEqual(Color.Gainsboro, color_TX_Bailey); Assert.AreEqual(Color.Gainsboro, color_TX_Lubbock); Assert.AreEqual(Color.Gainsboro, color_TX_Briscoe); Assert.AreEqual(Color.Beige, color_TX_Crosby); Assert.AreEqual(Color.Beige, color_TX_Floyd); Assert.AreEqual(colorDefault, color_TX_Red_River); }
public void MapGraphic_GetSvgXmlDocument_ShouldNotBeNull() { var parser = new SvgMapGraphicParser(); var map = parser.ParseFromFile(@"Texas.svg"); var document = map.GetSvgXmlDocument(); Assert.IsNotNull(document); }
public void CountiesElements() { var reader = new SvgMapGraphicParser(); var map = reader.ParseFromFile(@"Texas.svg"); var document = map.GetSvgXmlDocument(); var idList = new List <string>(); ExtractIds(document, idList); var countyIds = idList.Where(x => x.StartsWith("TX_")).OrderBy(x => x).Where(x => !x.EndsWith("_Name")).ToArray(); #region expected var expected = new[] { "TX_Anderson", "TX_Andrews", "TX_Angelina", "TX_Archer", "TX_Arkansas", "TX_Armstrong", "TX_Atascosa", "TX_Austin", "TX_Bailey", "TX_Bandera", "TX_Bastrop", "TX_Baylor", "TX_Bee", "TX_Bell", "TX_Bexar", "TX_Blanco", "TX_Borden", "TX_Bosque", "TX_Bowie", "TX_Brazoria", "TX_Brazos", "TX_Brewster", "TX_Briscoe", "TX_Brooks", "TX_Brown", "TX_Burleson", "TX_Burnet", "TX_Caldwell", "TX_Calhoun", "TX_Callahan", "TX_Cameron", "TX_Camp", "TX_Carson", "TX_Cass", "TX_Castro", "TX_Chambers", "TX_Cherokee", "TX_Childress", "TX_Clay", "TX_Cochran", "TX_Coke", "TX_Coleman", "TX_Collin", "TX_Collingsworth", "TX_Colorado", "TX_Comal", "TX_Comanche", "TX_Concho", "TX_Cooke", "TX_Coryell", "TX_Cottle", "TX_Crane", "TX_Crockett", "TX_Crosby", "TX_Culberson", "TX_Dallam", "TX_Dallas", "TX_Dawson", "TX_Deaf_Smith", "TX_Delta", "TX_Denton", "TX_DeWitt", "TX_Dickens", "TX_Dimmit", "TX_Donley", "TX_Duval", "TX_Eastland", "TX_Ector", "TX_Edwards", "TX_El_Paso", "TX_Ellis", "TX_Erath", "TX_Falls", "TX_Fannin", "TX_Fayette", "TX_Fisher", "TX_Floyd", "TX_Foard", "TX_Fort_Bend", "TX_Franklin", "TX_Freestone", "TX_Frio", "TX_Gaines", "TX_Galveston", "TX_Garza", "TX_Gillespie", "TX_Glasscock", "TX_Goliad", "TX_Gonzales", "TX_Gray", "TX_Grayson", "TX_Gregg", "TX_Grimes", "TX_Guadalupe", "TX_Hale", "TX_Hall", "TX_Hamilton", "TX_Hansford", "TX_Hardeman", "TX_Hardin", "TX_Harris", "TX_Harrison", "TX_Hartley", "TX_Haskell", "TX_Hays", "TX_Hemphill", "TX_Henderson", "TX_Hidalgo", "TX_Hill", "TX_Hockley", "TX_Hood", "TX_Hopkins", "TX_Houston", "TX_Howard", "TX_Hudspeth", "TX_Hunt", "TX_Hutchinson", "TX_Irion", "TX_Jack", "TX_Jackson", "TX_Jasper", "TX_Jeff_Davis", "TX_Jefferson", "TX_Jim_Hogg", "TX_Jim_Wells", "TX_Johnson", "TX_Jones", "TX_Karnes", "TX_Kaufman", "TX_Kendall", "TX_Kenedy", "TX_Kent", "TX_Kerr", "TX_Kimble", "TX_King", "TX_Kinney", "TX_Kleberg", "TX_Knox", "TX_La_Salle", "TX_Lamar", "TX_Lamb", "TX_Lampasas", "TX_Lavaca", "TX_Lee", "TX_Leon", "TX_Liberty", "TX_Limestone", "TX_Lipscomb", "TX_Live_Oak", "TX_Llano", "TX_Loving", "TX_Lubbock", "TX_Lynn", "TX_Madison", "TX_Marion", "TX_Martin", "TX_Mason", "TX_Matagorda", "TX_Maverick", "TX_McCulloch", "TX_McLennan", "TX_McMullen", "TX_Medina", "TX_Menard", "TX_Midland", "TX_Milam", "TX_Mills", "TX_Mitchell", "TX_Montague", "TX_Montgomery", "TX_Moore", "TX_Morris", "TX_Motley", "TX_Nacogdoches", "TX_Navarro", "TX_Newton", "TX_Nolan", "TX_Nueces", "TX_Ochiltree", "TX_Oldham", "TX_Orange", "TX_Palo_Pinto", "TX_Panola", "TX_Parker", "TX_Parmer", "TX_Pecos", "TX_Polk", "TX_Potter", "TX_Presidio", "TX_Rains", "TX_Randall", "TX_Reagan", "TX_Real", "TX_Red_River", "TX_Reeves", "TX_Refugio", "TX_Roberts", "TX_Robertson", "TX_Rockwall", "TX_Runnels", "TX_Rusk", "TX_Sabine", "TX_San_Augustine", "TX_San_Jacinto", "TX_San_Patricio", "TX_San_Saba", "TX_Schleicher", "TX_Scurry", "TX_Shackelford", "TX_Shelby", "TX_Sherman", "TX_Smith", "TX_Somervell", "TX_Starr", "TX_Stephens", "TX_Sterling", "TX_Stonewall", "TX_Sutton", "TX_Swisher", "TX_Tarrant", "TX_Taylor", "TX_Terrell", "TX_Terry", "TX_Throckmorton", "TX_Titus", "TX_Tom_Green", "TX_Travis", "TX_Trinity", "TX_Tyler", "TX_Upshur", "TX_Upton", "TX_Uvalade", "TX_Val_Verde", "TX_Van_Zandt", "TX_Victoria", "TX_Walker", "TX_Waller", "TX_Ward", "TX_Washington", "TX_Webb", "TX_Wharton", "TX_Wheeler", "TX_Wichita", "TX_Wilbarger", "TX_Willacy", "TX_Williamson", "TX_Wilson", "TX_Winkler", "TX_Wise", "TX_Wood", "TX_Yoakum", "TX_Young", "TX_Zapata", "TX_Zavala" }.ToArray(); #endregion CollectionAssert.AreEqual(expected, countyIds); }