本文整理汇总了C#中VsPackageSourceProvider.GetPackageSources方法的典型用法代码示例。如果您正苦于以下问题:C# VsPackageSourceProvider.GetPackageSources方法的具体用法?C# VsPackageSourceProvider.GetPackageSources怎么用?C# VsPackageSourceProvider.GetPackageSources使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VsPackageSourceProvider
的用法示例。
在下文中一共展示了VsPackageSourceProvider.GetPackageSources方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CtorAddsAggregrateIfAggregateWasPersistedIntoSettingsManager
public void CtorAddsAggregrateIfAggregateWasPersistedIntoSettingsManager()
{
// 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);
// Act
var sources = provider.GetPackageSources().ToList();
// Assert
Assert.AreEqual(2, sources.Count);
Assert.AreEqual(provider.AggregateSource, sources[0]);
Assert.AreEqual(new PackageSource("a", "a"), sources[1]);
}
示例2: AggregateSourceWithoutIsAggregateFlagSetFlagToTrue
public void AggregateSourceWithoutIsAggregateFlagSetFlagToTrue()
{
// 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><Name>All</Name><Source>(Aggregate source)</Source></PackageSource><PackageSource><IsAggregate>false</IsAggregate><Name>NuGet official package source</Name><Source>https://go.microsoft.com/fwlink/?LinkID=206669</Source></PackageSource></ArrayOfPackageSource>";
var provider = new VsPackageSourceProvider(registrySettingsManager, userSettingsManager);
// Act
var sources = provider.GetPackageSources().ToList();
// Assert
Assert.AreEqual(2, sources.Count);
Assert.IsTrue(sources[0].IsAggregate);
}
示例3: CtorAddsDefaultSourceIfAnotherDefaultWasPreviouslyRegistered
public void CtorAddsDefaultSourceIfAnotherDefaultWasPreviouslyRegistered()
{
// Arrange
var registrySettingsManager = new MockPackageSourceSettingsManager();
var userSettingsManager = new MockUserSettingsManager();
registrySettingsManager.PackageSourcesString = "<ArrayOfPackageSource xmlns=\"http://schemas.datacontract.org/2004/07/NuGet\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"><PackageSource><Name>NuGet official package source</Name><Source>http://some/old/feed</Source></PackageSource></ArrayOfPackageSource>";
registrySettingsManager.ActivePackageSourceString = "<PackageSource xmlns=\"http://schemas.datacontract.org/2004/07/NuGet\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"><IsAggregate>true</IsAggregate><Name>All</Name><Source>(Aggregate source)</Source></PackageSource>";
var provider = new VsPackageSourceProvider(registrySettingsManager, userSettingsManager);
// Act
var sources = provider.GetPackageSources().ToList();
// Assert
Assert.AreEqual(2, sources.Count);
Assert.AreEqual(VsPackageSourceProvider.DefaultPackageSource, sources[1].Source);
}
示例4: CtorIfFirstRunningAddsDefaultSource
public void CtorIfFirstRunningAddsDefaultSource()
{
// Arrange
var registrySettingsManager = new MockPackageSourceSettingsManager();
var userSettingsManager = new MockUserSettingsManager();
var provider = new VsPackageSourceProvider(registrySettingsManager, userSettingsManager);
// Act
var sources = provider.GetPackageSources().ToList();
// Assert
Assert.AreEqual(2, sources.Count);
Assert.AreEqual(VsPackageSourceProvider.DefaultPackageSource, sources[1].Source);
}
示例5: CtorAddsAggregrateIfNothingWasPersistedIntoSettingsManager
public void CtorAddsAggregrateIfNothingWasPersistedIntoSettingsManager()
{
// Arrange
var registrySettingsManager = new MockPackageSourceSettingsManager();
var userSettingsManager = new MockUserSettingsManager();
var provider = new VsPackageSourceProvider(registrySettingsManager, userSettingsManager);
// Act
var sources = provider.GetPackageSources().ToList();
// Assert
Assert.AreEqual(2, sources.Count);
Assert.AreEqual(provider.AggregateSource, sources[0]);
}