コード例 #1
0
        public void Remove_should_remove_definition_from_collection()
        {
            _loader.Load(_userRoaming).Count.Should().Be(1);
            _loader.Load(_repoDistributed).Count.Should().Be(3);

            var manager = new ExternalLinksManager(_repoLocal);

            var effective = manager.GetEffectiveSettings();

            // 1 comes from the user roaming settings
            // 3 come from the distributed
            // 1 comes from the local
            effective.Count.Should().Be(5);

            manager.Remove(effective.Last());

            manager.Save();

            var effectiveSettings = manager.GetEffectiveSettings();

            // 0 comes from the user roaming settings
            // 3 come from the distributed
            // 1 comes from the local
            effectiveSettings.Count.Should().Be(4);

            _loader.Load(_userRoaming).Count.Should().Be(0);
            _loader.Load(_repoDistributed).Count.Should().Be(3);
        }
コード例 #2
0
        public void Add_should_add_new_definition_to_the_lowest_level_level3()
        {
            _loader.Load(_userRoaming).Count.Should().Be(1);

            var manager = new ExternalLinksManager(_repoLocal);

            // 1 comes from the user roaming settings
            // 3 come from the distributed
            // 1 comes from the local
            manager.GetEffectiveSettings().Count.Should().Be(5);

            var definition = new ExternalLinkDefinition
            {
                Name          = "test",
                SearchPattern = "pattern"
            };

            manager.Add(definition);

            var effectiveSettings = manager.GetEffectiveSettings();

            // 1 comes from the local
            // 3 come from the distributed
            // 2 comes from the local
            effectiveSettings.Count.Should().Be(6);

            manager.Save();

            _loader.Load(_userRoaming).Count.Should().Be(2);
        }
コード例 #3
0
        public void Add_should_add_definition_present_in_lower_level_to_higher_level()
        {
            _loader.Load(_userRoaming).Count.Should().Be(1);
            _loader.Load(_repoDistributed).Count.Should().Be(3);

            var manager = new ExternalLinksManager(_repoLocal);

            // 1 comes from the user roaming settings
            // 3 come from the distributed
            // 1 comes from the local
            manager.GetEffectiveSettings().Count.Should().Be(5);

            var definition = new ExternalLinkDefinition
            {
                Name          = "Stash",
                SearchPattern = "pattern"
            };

            manager.Add(definition);

            var effectiveSettings = manager.GetEffectiveSettings();

            // 1 comes from the user roaming settings
            // 4 come from the distributed
            // 1 comes from the local
            effectiveSettings.Count.Should().Be(6);

            manager.Save();

            _loader.Load(_userRoaming).Count.Should().Be(1);
            _loader.Load(_repoDistributed).Count.Should().Be(4);
        }
コード例 #4
0
        protected override void SettingsToPage()
        {
            _externalLinksManager = new ExternalLinksManager(CurrentSettings);

            ReloadCategories();
            if (_NO_TRANSLATE_Categories.Items.Count > 0)
            {
                _NO_TRANSLATE_Categories.SelectedIndex = 0;
            }
            CategoryChanged();
        }