public void CtorShouldValidate()
        {
            var codeLetterLookup = new BiDictionary <int, string>();

            codeLetterLookup.Add(0, "AA");
            codeLetterLookup.Add(1, "BB");

            var fullNameLookup = new Dictionary <string, string>()
            {
                { "AA", "Country A" },
                { "XX", "Country X" }
            };

            var manager = new CountryCodeManager(codeLetterLookup, fullNameLookup);

            Assert.AreEqual(2, manager.CodeToLetterLookup.Count);
            Assert.IsTrue(manager.CodeToLetterLookup.Contains(
                              new KeyValuePair <int, string>(0, "AA")));
            Assert.IsTrue(manager.CodeToLetterLookup.Contains(
                              new KeyValuePair <int, string>(1, "BB")));

            Assert.AreEqual(2, manager.FullNameLookup.Count);
            Assert.IsTrue(manager.FullNameLookup.Contains(
                              new KeyValuePair <string, string>("AA", "Country A")));
            Assert.IsTrue(manager.FullNameLookup.ContainsKey("BB"));
        }
Пример #2
0
        public void Init(CountryCodeManager countryCodes)
        {
            listView.CheckBoxes = true;
            this.countryCodes   = countryCodes;
            AddItems();

            showSelectedCheckBox.CheckedChanged +=
                ShowSelectedCheckBoxChanged;

            codeTxtBox.TextChanged    += CodeTxtChanged;
            countryTxtBox.TextChanged += CountryTxtChanged;

            new ListViewSortEnabler(listView).EnableSort();
            ResizeListView();
        }
Пример #3
0
        /// <exception cref="WaypointFileReadException"></exception>
        /// <exception cref="LoadCountryNamesException"></exception>
        public LoadResult LoadFromFile()
        {
            var wptList      = new WaypointList();
            var countryCodes = new FixesLoader(wptList, Logger.Instance)
                               .ReadFromFile(waypointsFilePath);

            var err = AtsFileLoader.ReadFromFile(wptList, atsFilePath);

            if (err != null)
            {
                LoggerInstance.Log(err);
            }

            var countryFullNames = FullNamesLoader.Load();
            var countryManager   = new CountryCodeManager(countryCodes, countryFullNames);

            return(new LoadResult()
            {
                WptList = wptList,
                CountryCodes = countryManager
            });
        }