public GetValues ( string section ) : string>>.IList |
||
section | string | |
Résultat | string>>.IList |
public void SavePackageSourcesSaveCorrectDataToSettingsWhenSomePackgeSourceIsDisabled() { // Arrange var settings = new MockUserSettingsManager(); var provider = CreatePackageSourceProvider(settings); var sources = new[] { new PackageSource("one"), new PackageSource("two"), new PackageSource("three", "three", isEnabled: false) }; // Act provider.SavePackageSources(sources); // Assert var values = settings.GetValues(PackageSourceProvider.PackageSourcesSectionName); Assert.Equal(3, values.Count); Assert.Equal("one", values[0].Key); Assert.Equal("two", values[1].Key); Assert.Equal("three", values[2].Key); var disabledValues = settings.GetValues(PackageSourceProvider.DisabledPackageSourcesSectionName); Assert.NotNull(disabledValues); Assert.Equal(1, disabledValues.Count); Assert.Equal("three", disabledValues[0].Key); }
public void LoadPackageSourcesPerformMigrationIfSpecified() { // Arrange var settings = new MockUserSettingsManager(); settings.SetValues( PackageSourceProvider.PackageSourcesSectionName, new KeyValuePair<string, string>[] { new KeyValuePair<string, string>("one", "onesource"), new KeyValuePair<string, string>("two", "twosource"), new KeyValuePair<string, string>("three", "threesource"), } ); // disable package "three" settings.SetValue( PackageSourceProvider.DisabledPackageSourcesSectionName, "three", "threesource"); var provider = new PackageSourceProvider( settings, null, new Dictionary<PackageSource, PackageSource> { { new PackageSource("onesource", "one"), new PackageSource("goodsource", "good") }, { new PackageSource("foo", "bar"), new PackageSource("foo", "bar") }, { new PackageSource("threesource", "three"), new PackageSource("awesomesource", "awesome") } } ); // Act var values = provider.LoadPackageSources().ToList(); // Assert Assert.Equal(3, values.Count); AssertPackageSource(values[0], "good", "goodsource", true); AssertPackageSource(values[1], "two", "twosource", true); AssertPackageSource(values[2], "awesome", "awesomesource", false); var savedSettingValues = settings.GetValues(PackageSourceProvider.PackageSourcesSectionName); Assert.Equal(3, savedSettingValues.Count); Assert.Equal("good", savedSettingValues[0].Key); Assert.Equal("goodsource", savedSettingValues[0].Value); Assert.Equal("two", savedSettingValues[1].Key); Assert.Equal("twosource", savedSettingValues[1].Value); Assert.Equal("awesome", savedSettingValues[2].Key); Assert.Equal("awesomesource", savedSettingValues[2].Value); }
public void SavePackageSourcesSaveCorrectDataToSettings() { // Arrange var settings = new MockUserSettingsManager(); var provider = CreatePackageSourceProvider(settings); var sources = new[] { new PackageSource("one"), new PackageSource("two"), new PackageSource("three") }; // Act provider.SavePackageSources(sources); // Assert var values = settings.GetValues(PackageSourceProvider.PackageSourcesSectionName); Assert.Equal(3, values.Count); Assert.Equal("one", values[0].Key); Assert.Equal("two", values[1].Key); Assert.Equal("three", values[2].Key); }