public AreaCodeMapTest()
        {
            SortedMap <Integer, String> sortedMapForUS = new TreeMap <Integer, String>();

            sortedMapForUS.put(1212, "New York");
            sortedMapForUS.put(1480, "Arizona");
            sortedMapForUS.put(1650, "California");
            sortedMapForUS.put(1907, "Alaska");
            sortedMapForUS.put(1201664, "Westwood, NJ");
            sortedMapForUS.put(1480893, "Phoenix, AZ");
            sortedMapForUS.put(1501372, "Little Rock, AR");
            sortedMapForUS.put(1626308, "Alhambra, CA");
            sortedMapForUS.put(1650345, "San Mateo, CA");
            sortedMapForUS.put(1867993, "Dawson, YT");
            sortedMapForUS.put(1972480, "Richardson, TX");

            areaCodeMapForUS.readAreaCodeMap(sortedMapForUS);

            SortedMap <Integer, String> sortedMapForIT = new TreeMap <Integer, String>();

            sortedMapForIT.put(3902, "Milan");
            sortedMapForIT.put(3906, "Rome");
            sortedMapForIT.put(39010, "Genoa");
            sortedMapForIT.put(390131, "Alessandria");
            sortedMapForIT.put(390321, "Novara");
            sortedMapForIT.put(390975, "Potenza");

            areaCodeMapForIT.readAreaCodeMap(sortedMapForIT);
        }
Пример #2
0
        public static void SetupFixture(TestContext context)
        {
            SortedDictionary <int, String> sortedMap = new SortedDictionary <int, String>();

            sortedMap[1212]    = "New York";
            sortedMap[1480]    = "Arizona";
            sortedMap[1650]    = "California";
            sortedMap[1907]    = "Alaska";
            sortedMap[1201664] = "Westwood, NJ";
            sortedMap[1480893] = "Phoenix, AZ";
            sortedMap[1501372] = "Little Rock, AR";
            sortedMap[1626308] = "Alhambra, CA";
            sortedMap[1650345] = "San Mateo, CA";
            sortedMap[1867993] = "Dawson, YT";
            sortedMap[1972480] = "Richardson, TX";
            areaCodeMapForUS.readAreaCodeMap(sortedMap);

            sortedMap         = new SortedDictionary <int, String>();
            sortedMap[3902]   = "Milan";
            sortedMap[3906]   = "Rome";
            sortedMap[39010]  = "Genoa";
            sortedMap[390131] = "Alessandria";
            sortedMap[390321] = "Novara";
            sortedMap[390975] = "Potenza";
            areaCodeMapForIT.readAreaCodeMap(sortedMap);
        }
        [TestMethod] public void testReadWriteExternalWithFlyweightStrategy()
        {
            AreaCodeMap localAreaCodeMap = new AreaCodeMap();

            localAreaCodeMap.readAreaCodeMap(createFlyweightStorageMapCandidate());
            assertTrue(localAreaCodeMap.getAreaCodeMapStorage() is FlyweightMapStorage);

            AreaCodeMap newAreaCodeMap;

            newAreaCodeMap = createNewAreaCodeMap(localAreaCodeMap);
            assertEquals(localAreaCodeMap.toString(), newAreaCodeMap.toString());
        }