本文整理汇总了C#中TestableVsTemplateWizard.GetConfigurationFromXmlDocument方法的典型用法代码示例。如果您正苦于以下问题:C# TestableVsTemplateWizard.GetConfigurationFromXmlDocument方法的具体用法?C# TestableVsTemplateWizard.GetConfigurationFromXmlDocument怎么用?C# TestableVsTemplateWizard.GetConfigurationFromXmlDocument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestableVsTemplateWizard
的用法示例。
在下文中一共展示了TestableVsTemplateWizard.GetConfigurationFromXmlDocument方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetConfigurationFromXmlDocument_ShowsErrorForInvalidCacheAttributeValue
public void GetConfigurationFromXmlDocument_ShowsErrorForInvalidCacheAttributeValue()
{
// Arrange
var document = BuildDocumentWithPackage("__invalid__");
var wizard = new TestableVsTemplateWizard();
// Act
ExceptionAssert.Throws<WizardBackoutException>(() => wizard.GetConfigurationFromXmlDocument(document,
@"C:\Some\file.vstemplate"));
// Assert
Assert.Equal(
"The \"repository\" attribute of the package element has an invalid value: '__invalid__'. Valid values are: 'template' or 'extension'.",
wizard.ErrorMessages.Single());
}
示例2: InvalidPackageElementHelper
private static void InvalidPackageElementHelper(XElement[] content)
{
// Arrange
var document = BuildDocument("template", content);
var wizard = new TestableVsTemplateWizard();
// Act
ExceptionAssert.Throws<WizardBackoutException>(() => wizard.GetConfigurationFromXmlDocument(document,
@"C:\Some\file.vstemplate"));
// Assert
Assert.Equal("The project template lists one or more packages with missing, empty, or invalid values for the \"id\" or \"version\" attributes. Both attributes are required and must have valid values.", wizard.ErrorMessages.Single());
}
示例3: GetConfigurationFromXmlDocument_ShowErrorForMissingRegistryValueWhenInRegistryRepositoryMode
public void GetConfigurationFromXmlDocument_ShowErrorForMissingRegistryValueWhenInRegistryRepositoryMode()
{
// Arrange
var registryPath = @"SOFTWARE\NuGet\Repository";
var registryKey = "ThisRegistryKeyDoesNotExist";
var document = BuildDocumentWithPackage("registry", new XAttribute("keyName", registryKey));
var wizard = new TestableVsTemplateWizard();
var hkcu_repository = new Mock<IRegistryKey>();
var hkcu = new Mock<IRegistryKey>();
hkcu_repository.Setup(k => k.GetValue(registryKey)).Returns(null);
hkcu.Setup(r => r.OpenSubKey(registryPath)).Returns(hkcu_repository.Object);
// Act
ExceptionAssert.Throws<WizardBackoutException>(() =>
wizard.GetConfigurationFromXmlDocument(document,
registryPath, registryKeys: new[] { hkcu.Object }));
// Assert
Assert.Equal(
String.Format("The project template has a reference to a missing Registry value. Could not find a Registry key with name '{0}' under '{1}'.", registryKey, registryPath),
wizard.ErrorMessages.Single());
}
示例4: GetConfigurationFromXmlDocument_ShowErrorForMissingRegistryKeyWhenInRegistryRepositoryMode
public void GetConfigurationFromXmlDocument_ShowErrorForMissingRegistryKeyWhenInRegistryRepositoryMode()
{
// Arrange
var registryPath = @"SOFTWARE\NuGet\Repository";
var registryKeyName = @"ThisRegistryKeyDoesNotExist";
var document = BuildDocumentWithPackage("registry", new XAttribute("keyName", registryKeyName));
var wizard = new TestableVsTemplateWizard();
var hkcu = new Mock<IRegistryKey>();
hkcu.Setup(r => r.OpenSubKey(registryPath)).Returns<IRegistryKey>(null);
var registryKey = new Mock<IRegistryKey>();
registryKey.Setup(r => r.OpenSubKey(registryPath)).Returns<IRegistryKey>(null);
// Act
ExceptionAssert.Throws<WizardBackoutException>(() =>
wizard.GetConfigurationFromXmlDocument(document,
@"C:\Some\file.vstemplate", registryKeys: new[] { hkcu.Object }));
// Assert
Assert.Equal(
String.Format("The project template is configured to use a Registry-provided package repository but there was an error accessing Registry key '{0}'.", registryPath),
wizard.ErrorMessages.Single());
}
示例5: GetConfigurationFromXmlDocument_ShowErrorForMissingKeyNameAttributeWhenInRegistryRepositoryMode
public void GetConfigurationFromXmlDocument_ShowErrorForMissingKeyNameAttributeWhenInRegistryRepositoryMode()
{
// Arrange
var document = BuildDocumentWithPackage("registry");
var wizard = new TestableVsTemplateWizard();
// Act
ExceptionAssert.Throws<WizardBackoutException>(() =>
wizard.GetConfigurationFromXmlDocument(document,
@"C:\Some\file.vstemplate", registryKeys: Enumerable.Empty<IRegistryKey>()));
// Assert
Assert.Equal(
"The project template is configured to use a Registry-provided package repository but the Registry value name has not been specified. Use the \"keyName\" attribute to specify the Registry value.",
wizard.ErrorMessages.Single());
}
示例6: GetConfigurationFromXmlDocument_ShowErrorForInvalidRepositoryIdAttributeWhenInExtensionRepositoryMode
public void GetConfigurationFromXmlDocument_ShowErrorForInvalidRepositoryIdAttributeWhenInExtensionRepositoryMode()
{
// Arrange
var document = BuildDocumentWithPackage("extension", new XAttribute("repositoryId", "myExtensionId"));
var wizard = new TestableVsTemplateWizard();
var extensionManagerMock = new Mock<IVsExtensionManager>();
IInstalledExtension extension = null;
extensionManagerMock.Setup(em => em.TryGetInstalledExtension("myExtensionId", out extension)).Returns(false);
// Act
ExceptionAssert.Throws<WizardBackoutException>(() => wizard.GetConfigurationFromXmlDocument(document,
@"C:\Some\file.vstemplate",
vsExtensionManager: extensionManagerMock.Object));
// Assert
Assert.Equal(
"The project template has a reference to a missing Extension. Could not find an Extension with ID 'myExtensionId'.",
wizard.ErrorMessages.Single());
}
示例7: GetConfigurationFromXmlDocument_ShowErrorForMissingRepositoryIdAttributeWhenInExtensionRepositoryMode
public void GetConfigurationFromXmlDocument_ShowErrorForMissingRepositoryIdAttributeWhenInExtensionRepositoryMode()
{
// Arrange
var document = BuildDocumentWithPackage("extension");
var wizard = new TestableVsTemplateWizard();
// Act
ExceptionAssert.Throws<WizardBackoutException>(() =>
wizard.GetConfigurationFromXmlDocument(document,
@"C:\Some\file.vstemplate"));
// Assert
Assert.Equal(
"The project template is configured to use an Extension-specific package repository but the Extension ID has not been specified. Use the \"repositoryId\" attribute to specify the Extension ID.",
wizard.ErrorMessages.Single());
}