public void MergeCitiesWithNotMatchingNeighborhoodsTest() { // create two cities with a neighborhood each // first city WebLocationService.TransitCity t_instance1 = GetTransitInstance(); int id1 = EndPoint.CreateOrUpdateCity(GetAdminTicket(), t_instance1); Console.WriteLine("City 1: {0}", id1); WebLocationService.TransitNeighborhood t_nh1 = new WebLocationService.TransitNeighborhood(); t_nh1.City = t_instance1.Name; t_nh1.Country = t_instance1.Country; t_nh1.Name = GetNewString(); t_nh1.State = t_instance1.State; int nh1 = EndPoint.CreateOrUpdateNeighborhood(GetAdminTicket(), t_nh1); Console.WriteLine("Neighborhood 1: {0}", nh1); // second city WebLocationService.TransitCity t_instance2 = GetTransitInstance(); int id2 = EndPoint.CreateOrUpdateCity(GetAdminTicket(), t_instance2); Console.WriteLine("City 2: {0}", id2); WebLocationService.TransitNeighborhood t_nh2 = new WebLocationService.TransitNeighborhood(); t_nh2.City = t_instance2.Name; t_nh2.Country = t_instance2.Country; t_nh2.Name = GetNewString(); // new name t_nh2.State = t_instance2.State; int nh2 = EndPoint.CreateOrUpdateNeighborhood(GetAdminTicket(), t_nh2); Console.WriteLine("Neighborhood 2: {0}", nh2); // merge the two int count = EndPoint.MergeCities(GetAdminTicket(), id1, id2); Console.WriteLine("Merge: {0} records.", count); EndPoint.DeleteCity(GetAdminTicket(), id1); }
public void GetNeighborhoodsCompletionListTest() { NeighborhoodTest _nh = new NeighborhoodTest(); _nh.SetUp(); WebLocationService.TransitCity t_city = _nh.EndPoint.GetCityById(GetAdminTicket(), _nh._city_id); string key = string.Format("{0};{1};{2}", t_city.Country, t_city.State, t_city.Name); Console.WriteLine("Key: {0}", key); WebLocationService.TransitNeighborhood t_instance = _nh.GetTransitInstance(); int id = _nh.EndPoint.CreateOrUpdateNeighborhood(GetAdminTicket(), t_instance); string[] neighborhoods = EndPoint.GetNeighborhoodsCompletionList( t_instance.Name.Substring(0, 3), 100, key); Assert.AreEqual(1, neighborhoods.Length); Assert.AreEqual(t_instance.Name, neighborhoods[0]); Console.WriteLine(neighborhoods[0]); _nh.EndPoint.DeleteNeighborhood(GetAdminTicket(), id); _nh.TearDown(); }