当前位置: 首页>>代码示例>>C#>>正文


C# VsPackageSourceProvider.RemovePackageSource方法代码示例

本文整理汇总了C#中VsPackageSourceProvider.RemovePackageSource方法的典型用法代码示例。如果您正苦于以下问题:C# VsPackageSourceProvider.RemovePackageSource方法的具体用法?C# VsPackageSourceProvider.RemovePackageSource怎么用?C# VsPackageSourceProvider.RemovePackageSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VsPackageSourceProvider的用法示例。


在下文中一共展示了VsPackageSourceProvider.RemovePackageSource方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RemovingUnknownPackageSourceReturnsFalse

        public void RemovingUnknownPackageSourceReturnsFalse()
        {
            // Arrange
            var userSettingsManager = new MockUserSettingsManager();
            var registrySettingsManager = new MockPackageSourceSettingsManager();
            var provider = new VsPackageSourceProvider(registrySettingsManager, userSettingsManager);

            // Act
            bool result = provider.RemovePackageSource(new PackageSource("a", "a"));

            // Assert
            Assert.IsFalse(result);
        }
开发者ID:grendello,项目名称:nuget,代码行数:13,代码来源:VsPackageSourceProviderTest.cs

示例2: RemoveSourceThrowsIfSourceIsNull

        public void RemoveSourceThrowsIfSourceIsNull()
        {
            // Arrange
            var userSettingsManager = new MockUserSettingsManager();
            var registrySettingsManager = new MockPackageSourceSettingsManager();
            var provider = new VsPackageSourceProvider(registrySettingsManager, userSettingsManager);

            // Act
            ExceptionAssert.ThrowsArgNull(() => provider.RemovePackageSource(null), "source");
        }
开发者ID:grendello,项目名称:nuget,代码行数:10,代码来源:VsPackageSourceProviderTest.cs

示例3: RemovingExistingPackageSourceReturnsFalse

        public void RemovingExistingPackageSourceReturnsFalse()
        {
            // 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>a</Name><Source>a</Source></PackageSource></ArrayOfPackageSource>";
            var provider = new VsPackageSourceProvider(registrySettingsManager, userSettingsManager);
            var packageSource = new PackageSource("a", "a");

            // Act
            bool result = provider.RemovePackageSource(packageSource);

            // Assert
            Assert.IsTrue(result);

            // values should be null because we don't persist aggregate source into user settings file
            var values = userSettingsManager.GetValues(VsPackageSourceProvider.FileSettingsSectionName);
            Assert.IsNull(values);
        }
开发者ID:grendello,项目名称:nuget,代码行数:19,代码来源:VsPackageSourceProviderTest.cs

示例4: RemovingActivePackageSourceSetsActivePackageSourceToNull

        public void RemovingActivePackageSourceSetsActivePackageSourceToNull()
        {
            // Arrange
            var userSettingsManager = new MockUserSettingsManager();
            var packageSourceProvider = new MockPackageSourceProvider();
            var provider = new VsPackageSourceProvider(userSettingsManager, packageSourceProvider);
            var packageSource = new PackageSource("a", "a");
            provider.SavePackageSources(new[] { packageSource });
            provider.ActivePackageSource = packageSource;

            // Act
            bool result = provider.RemovePackageSource(packageSource);

            // Assert
            Assert.True(result);
            Assert.Null(provider.ActivePackageSource);

            // values should be null because we don't persist aggregate source into user settings file
            var values = userSettingsManager.GetValues(PackageSourceProvider.PackageSourcesSectionName);
            Assert.Null(values);
        }
开发者ID:monoman,项目名称:NugetCracker,代码行数:21,代码来源:VsPackageSourceProviderTest.cs


注:本文中的VsPackageSourceProvider.RemovePackageSource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。