GetValue() public method

public GetValue ( string section, string key ) : string
section string
key string
return string
        public void SetActivePackageSourcePersistsItToSettingsManager()
        {
            // Arrange
            var userSettingsManager     = new MockUserSettingsManager();
            var registrySettingsManager = new MockPackageSourceSettingsManager();

            registrySettingsManager.PackageSourcesString = "<ArrayOfPackageSource xmlns=\"http://schemas.datacontract.org/2004/07/NuGet\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"><PackageSource><IsAggregate>false</IsAggregate><Name>name</Name><Source>source</Source></PackageSource></ArrayOfPackageSource>";
            var provider = new VsPackageSourceProvider(registrySettingsManager, userSettingsManager);

            // Act
            provider.ActivePackageSource = new PackageSource("source", "name");

            // Assert
            var activeValue = userSettingsManager.GetValue(VsPackageSourceProvider.FileSettingsActiveSectionName, "name");

            Assert.AreEqual("source", activeValue);

            var invalidActiveValue = userSettingsManager.GetValue(VsPackageSourceProvider.FileSettingsActiveSectionName, "invalidName");

            Assert.IsNull(invalidActiveValue);

            Assert.IsNull(registrySettingsManager.ActivePackageSourceString);
        }
        public void ActivePackageSourceIsMigratedToUserSettings()
        {
            // Arrange
            var userSettingsManager     = new MockUserSettingsManager();
            var registrySettingsManager = new MockPackageSourceSettingsManager();

            registrySettingsManager.PackageSourcesString      = "<ArrayOfPackageSource xmlns=\"http://schemas.datacontract.org/2004/07/NuGet\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"><PackageSource><IsAggregate>false</IsAggregate><Name>name1</Name><Source>source1</Source></PackageSource><PackageSource><IsAggregate>false</IsAggregate><Name>name2</Name><Source>source2</Source></PackageSource><PackageSource><IsAggregate>false</IsAggregate><Name>name3</Name><Source>source3</Source></PackageSource></ArrayOfPackageSource>";
            registrySettingsManager.ActivePackageSourceString = "<PackageSource xmlns=\"http://schemas.datacontract.org/2004/07/NuGet\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"><IsAggregate>false</IsAggregate><Name>name2</Name><Source>source2</Source></PackageSource>";

            // Act
            var provider = new VsPackageSourceProvider(registrySettingsManager, userSettingsManager);

            // Assert
            var activeValue = userSettingsManager.GetValue(VsPackageSourceProvider.FileSettingsActiveSectionName, "name2");

            Assert.AreEqual("source2", activeValue);

            var invalidActiveValue = userSettingsManager.GetValue(VsPackageSourceProvider.FileSettingsActiveSectionName, "invalidName");

            Assert.IsNull(invalidActiveValue);

            // also verify that the registry setting is deleted
            Assert.IsNull(registrySettingsManager.ActivePackageSourceString);
        }