本文整理汇总了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);
}
示例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");
}
示例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);
}
示例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);
}