public void DestinationSet_Mapping_RSI_SwedenMobileExample()
        {
            ExplicitDestinationSet<string> ds1 = new ExplicitDestinationSet<string>();
             ds1.AddArea("SWEDEN", 46);
             ds1.AddArea("SWEDEN-MOBILE", 467);

             //define just main destinations
             ExplicitDestinationSet<string> ds2 = new ExplicitDestinationSet<string>();
             ds2.AddArea("SWEDEN", 46);
             ds2.UpdateDestination("SWEDEN-MOBILE 1", "4670-4675");
             ds2.UpdateDestination("SWEDEN-MOBILE 2", "4676-4678");

             DestinationSetBase.MappingResult<string> maps = ds1.MapToDestinationSet(ds2);
             Assert.AreEqual<int>(3, maps.GetMappedDestination("SWEDEN-MOBILE").Count());
             Assert.AreEqual<int>(1, maps.GetMappedDestination("SWEDEN").Count());
             Assert.IsTrue(maps["SWEDEN"].IsFullyMapped);
             Assert.IsTrue(maps["SWEDEN-MOBILE"].IsMultiMapped);
             Assert.AreEqual<string>("4670-4675", maps.Maps[new KeyValuePair<string, string>("SWEDEN-MOBILE", "SWEDEN-MOBILE 1")].ToString());
             Assert.AreEqual<string>("4676-4678", maps.Maps[new KeyValuePair<string, string>("SWEDEN-MOBILE", "SWEDEN-MOBILE 2")].ToString());
             Assert.AreEqual<string>("4679", maps.Maps[new KeyValuePair<string, string>("SWEDEN-MOBILE", "SWEDEN")].ToString());
        }
        public void DestinationSet_Mapping_RSI_SameDestSetWithoutChanges()
        {
            ExplicitDestinationSet<string> ds1 = new ExplicitDestinationSet<string>();
             ds1.AddArea("AFGHANISTAN-FIX", 93);
             ds1.AddArea("AFGHANISTAN-MOBILE OTHERS", 937);
             ds1.AddArea("AFGHANISTAN-MOBILE AREEBA", 9377);
             ds1.AddArea("AFGHANISTAN-MOBILE ETISALAT", 9378);
             ds1.AddArea("AFGHANISTAN-MOBILE ROSHAN", 9379);
             ds1.AddArea("ALBANIA", 355);
             ds1.UpdateDestination("ALBANIA-MOBILE", "35566 - 35569");
             ds1.AddArea("ALBANIA-TIRANA", 3554);
             ds1.AddArea("ALGERIA", 213);
             ds1.UpdateDestination("ALGERIA-MOBILE ORASCOM", "21377; 213780; 21379".Replace(';', ','));
             ds1.UpdateDestination("ALGERIA-MOBILE OTHERS", "213659; 21366; 213670; 21369; 21396190-21396192".Replace(';', ','));
             ds1.AddArea("ALGERIA-MOBILE WATANIYA", 2135);
             ds1.AddArea("AMERICAN SAMOA", 1684);
             ds1.AddArea("ANDORRA", 376);
             ds1.UpdateDestination("ANDORRA-MOBILE", "3763 - 3766");

             //add same set with different order of the elements, map should be 1:1
             ExplicitDestinationSet<string> ds2 = new ExplicitDestinationSet<string>();
             ds2.AddArea("AFGHANISTAN-FIX", 93);
             ds2.AddArea("AFGHANISTAN-MOBILE OTHERS", 937);
             ds2.AddArea("AFGHANISTAN-MOBILE ROSHAN", 9379);
             ds2.AddArea("AFGHANISTAN-MOBILE AREEBA", 9377);
             ds2.AddArea("AFGHANISTAN-MOBILE ETISALAT", 9378);
             ds2.AddArea("ANDORRA", 376);
             ds2.UpdateDestination("ANDORRA-MOBILE", "3763 - 3766");
             ds2.AddArea("ALBANIA", 355);
             ds2.AddArea("ALBANIA-TIRANA", 3554);
             ds2.UpdateDestination("ALBANIA-MOBILE", "35566 - 35569");
             ds2.AddArea("ALGERIA", 213);
             ds2.UpdateDestination("ALGERIA-MOBILE OTHERS", "213659; 21366; 213670; 21369; 21396190-21396192".Replace(';', ','));
             ds2.UpdateDestination("ALGERIA-MOBILE ORASCOM", "21377; 213780; 21379".Replace(';', ','));
             ds2.AddArea("ALGERIA-MOBILE WATANIYA", 2135);
             ds2.AddArea("AMERICAN SAMOA", 1684);

             DestinationSetBase.MappingResult<string> maps = ds1.MapToDestinationSet(ds2);
             Assert.AreEqual<int>(15, maps.Maps.Count, "Fully mapped destinations");
             Assert.AreEqual<int>(0, maps.LostAreaCodes.Count, "Lost areas");
             Assert.AreEqual<int>(0, maps.GainedAreaCodes.Count, "Gained areas");
             foreach (string sDestinationName in ds2.Destinations.Select(x => x.Key))
             {
            Assert.IsTrue(maps[sDestinationName].HasMapping);
            Assert.IsTrue(maps[sDestinationName].IsFullyMapped);
            Assert.IsFalse(maps[sDestinationName].IsMultiMapped);
            Assert.IsFalse(maps[sDestinationName].IsPartiallyMapped);
             }
        }
        public void DestinationSet_Mapping_RSI_ChildDestinationSwap()
        {
            ExplicitDestinationSet<string> ds1 = new ExplicitDestinationSet<string>();
             ds1.AddArea("AFGHANISTAN-FIX", 93);
             ds1.AddArea("AFGHANISTAN-MOBILE OTHERS", 937);
             ds1.AddArea("AFGHANISTAN-MOBILE AREEBA", 9377);
             //do not include AFGHANISTAN-MOBILE ETISALAT
             ds1.AddArea("AFGHANISTAN-MOBILE ROSHAN", 9379);

             ExplicitDestinationSet<string> ds2 = new ExplicitDestinationSet<string>();
             ds2.AddArea("AFGHANISTAN-FIX", 93);
             ds2.AddArea("AFGHANISTAN-MOBILE OTHERS", 937);
             ds2.AddArea("AFGHANISTAN-MOBILE AREEBA", 9377);
             ds2.AddArea("AFGHANISTAN-MOBILE ETISALAT", 9378);
             //do not include AFGHANISTAN-MOBILE ROSHAN

             DestinationSetBase.MappingResult<string> maps = ds1.MapToDestinationSet(ds2);

             Assert.AreEqual<int>(5, maps.Count);
             Assert.AreEqual<int>(2, maps.LostAreaCodes.Count);
             Assert.AreEqual<int>(2, maps.GainedAreaCodes.Count);
             Assert.AreEqual<string>("9379", maps.LostAreaCodes["AFGHANISTAN-MOBILE ROSHAN"].ToString());
             Assert.AreEqual<string>("9378", maps.LostAreaCodes["AFGHANISTAN-MOBILE OTHERS"].ToString());
             Assert.AreEqual<string>("9378", maps.GainedAreaCodes["AFGHANISTAN-MOBILE ETISALAT"].ToString());
             Assert.AreEqual<string>("9379", maps.GainedAreaCodes["AFGHANISTAN-MOBILE OTHERS"].ToString());
        }
        public void DestinationSet_Mapping_ChildDestinationMovedToMain()
        {
            ExplicitDestinationSet<string> ds1 = new ExplicitDestinationSet<string>();
             ds1.AddArea("AFGHANISTAN-FIX", 93);
             ds1.AddArea("AFGHANISTAN-MOBILE OTHERS", 937);
             ds1.AddArea("AFGHANISTAN-MOBILE AREEBA", 9377);
             ds1.AddArea("AFGHANISTAN-MOBILE ETISALAT", 9378);
             ds1.AddArea("AFGHANISTAN-MOBILE ROSHAN", 9379);
             ds1.AddArea("ALBANIA", 355);
             ds1.UpdateDestination("ALBANIA-MOBILE", "35566 - 35569");
             ds1.AddArea("ALBANIA-TIRANA", 3554);

             //define just main destinations
             ExplicitDestinationSet<string> ds2 = new ExplicitDestinationSet<string>();
             ds2.AddArea("AFGHANISTAN-FIX", 93);
             ds2.AddArea("ALBANIA", 355);

             DestinationSetBase.MappingResult<string> maps = ds1.MapToDestinationSet(ds2);
             //maps
             Assert.AreEqual<int>(8, maps.Maps.Count, "Fully mapped destinations");
             Assert.AreEqual<string>("930-936,938-939", maps.Maps[new KeyValuePair<string, string>("AFGHANISTAN-FIX", "AFGHANISTAN-FIX")].ToString());
             Assert.AreEqual<string>("9370-9376", maps.Maps[new KeyValuePair<string, string>("AFGHANISTAN-MOBILE OTHERS", "AFGHANISTAN-FIX")].ToString());
             Assert.AreEqual<string>("9377", maps.Maps[new KeyValuePair<string, string>("AFGHANISTAN-MOBILE AREEBA", "AFGHANISTAN-FIX")].ToString());
             Assert.AreEqual<string>("9378", maps.Maps[new KeyValuePair<string, string>("AFGHANISTAN-MOBILE ETISALAT", "AFGHANISTAN-FIX")].ToString());
             Assert.AreEqual<string>("9379", maps.Maps[new KeyValuePair<string, string>("AFGHANISTAN-MOBILE ROSHAN", "AFGHANISTAN-FIX")].ToString());
             Assert.AreEqual<string>("3550-3553,35550-35565,3557-3559", maps.Maps[new KeyValuePair<string, string>("ALBANIA", "ALBANIA")].ToString());
             Assert.AreEqual<string>("35566-35569", maps.Maps[new KeyValuePair<string, string>("ALBANIA-MOBILE", "ALBANIA")].ToString());
             Assert.AreEqual<string>("3554", maps.Maps[new KeyValuePair<string, string>("ALBANIA-TIRANA", "ALBANIA")].ToString());
             //lost area codes
             Assert.AreEqual<int>(6, maps.LostAreaCodes.Count, "Lost areas");
             Assert.AreEqual<string>("9370-9376", maps.LostAreaCodes["AFGHANISTAN-MOBILE OTHERS"].ToString());
             Assert.AreEqual<string>("9377", maps.LostAreaCodes["AFGHANISTAN-MOBILE AREEBA"].ToString());
             Assert.AreEqual<string>("9378", maps.LostAreaCodes["AFGHANISTAN-MOBILE ETISALAT"].ToString());
             Assert.AreEqual<string>("9379", maps.LostAreaCodes["AFGHANISTAN-MOBILE ROSHAN"].ToString());
             Assert.AreEqual<string>("35566-35569", maps.LostAreaCodes["ALBANIA-MOBILE"].ToString());
             Assert.AreEqual<string>("3554", maps.LostAreaCodes["ALBANIA-TIRANA"].ToString());
             //gained area codes
             Assert.AreEqual<int>(2, maps.GainedAreaCodes.Count, "Gained areas");
             Assert.AreEqual<string>("937", maps.GainedAreaCodes["AFGHANISTAN-FIX"].ToString());
             Assert.AreEqual<string>("3554,35566-35569", maps.GainedAreaCodes["ALBANIA"].ToString());
        }
        public void DestinationSet_Diff_Dest_Map_Overlap()
        {
            ExplicitDestinationSet<string> ds1 = new ExplicitDestinationSet<string>();
             ExplicitDestinationSet<string> ds2 = new ExplicitDestinationSet<string>();
             ds1.AddArea("ds1a", 33);
             ds1.AddArea("ds1b", 332);
             ds2.AddArea("ds2a", 33);
             ds2.AddArea("ds2b", 334);
             DestinationSetBase.MappingResult<string> maps = ds1.MapToDestinationSet(ds2);

             Assert.AreEqual<int>(3, maps.Count);
             Assert.AreEqual<string>("330-331,333,335-339", maps.GetMappedAreas("ds1a", "ds2a"));
             Assert.AreEqual<string>("334", maps.GetMappedAreas("ds1a", "ds2b"));
             Assert.AreEqual<string>("332", maps.GetMappedAreas("ds1b", "ds2a"));

             Assert.AreEqual<int>(2, maps.LostAreaCodes.Count);
             Assert.AreEqual<string>("332", maps.LostAreaCodes["ds1b"].ToString());
             Assert.AreEqual<string>("330-331,333-339", maps.LostAreaCodes["ds1a"].ToString());

             Assert.AreEqual<int>(2, maps.GainedAreaCodes.Count);
             Assert.AreEqual<string>("330-333,335-339", maps.GainedAreaCodes["ds2a"].ToString());
             Assert.AreEqual<string>("334", maps.GainedAreaCodes["ds2b"].ToString());
        }
        public void DestinationSet_Dest_Map_Identity()
        {
            ExplicitDestinationSet<string> ds1 = new ExplicitDestinationSet<string>();
             ExplicitDestinationSet<string> ds2 = new ExplicitDestinationSet<string>();
             ds1.AddArea("a", 33);
             ds1.AddArea("b", 332);
             ds2.AddArea("a", 33);
             ds2.AddArea("b", 332);
             DestinationSetBase.MappingResult<string> maps = ds1.MapToDestinationSet(ds2);

             Assert.AreEqual<int>(2, maps.Count);
             Assert.AreEqual<string>("330-331,333-339", maps.GetMappedAreas("a", "a"));
             Assert.AreEqual<string>("332", maps.GetMappedAreas("b", "b"));
        }