Unit tests for Azure scenarios (#495)

* Test firewall rule handling is able to process through the service layer

* Additional tests for authentication and the resource wrapper code

* Positive test case for CreateFirewallRule

* Fixed copyright and usings
This commit is contained in:
Kevin Cunnane
2017-10-12 17:23:34 -07:00
committed by GitHub
parent 14e3b3a3f6
commit b416951414
14 changed files with 536 additions and 139 deletions

View File

@@ -27,7 +27,7 @@ namespace Microsoft.SqlTools.ResourceProvider.DefaultImpl
Keys.Culture = value;
}
}
public static string FailedToGetAzureDatabasesErrorMessage
{
@@ -35,7 +35,7 @@ namespace Microsoft.SqlTools.ResourceProvider.DefaultImpl
{
return Keys.GetString(Keys.FailedToGetAzureDatabasesErrorMessage);
}
}
}
public static string FailedToGetAzureSubscriptionsErrorMessage
{
@@ -43,7 +43,7 @@ namespace Microsoft.SqlTools.ResourceProvider.DefaultImpl
{
return Keys.GetString(Keys.FailedToGetAzureSubscriptionsErrorMessage);
}
}
}
public static string FailedToGetAzureResourceGroupsErrorMessage
{
@@ -51,7 +51,7 @@ namespace Microsoft.SqlTools.ResourceProvider.DefaultImpl
{
return Keys.GetString(Keys.FailedToGetAzureResourceGroupsErrorMessage);
}
}
}
public static string FailedToGetAzureSqlServersErrorMessage
{
@@ -59,7 +59,7 @@ namespace Microsoft.SqlTools.ResourceProvider.DefaultImpl
{
return Keys.GetString(Keys.FailedToGetAzureSqlServersErrorMessage);
}
}
}
public static string FailedToGetAzureSqlServersWithError
{
@@ -67,7 +67,7 @@ namespace Microsoft.SqlTools.ResourceProvider.DefaultImpl
{
return Keys.GetString(Keys.FailedToGetAzureSqlServersWithError);
}
}
}
public static string FirewallRuleCreationFailed
{
@@ -75,7 +75,7 @@ namespace Microsoft.SqlTools.ResourceProvider.DefaultImpl
{
return Keys.GetString(Keys.FirewallRuleCreationFailed);
}
}
}
public static string FirewallRuleCreationFailedWithError
{
@@ -83,7 +83,7 @@ namespace Microsoft.SqlTools.ResourceProvider.DefaultImpl
{
return Keys.GetString(Keys.FirewallRuleCreationFailedWithError);
}
}
}
public static string AzureSubscriptionFailedErrorMessage
{
@@ -91,7 +91,7 @@ namespace Microsoft.SqlTools.ResourceProvider.DefaultImpl
{
return Keys.GetString(Keys.AzureSubscriptionFailedErrorMessage);
}
}
}
public static string UnsupportedAuthType
{
@@ -99,7 +99,7 @@ namespace Microsoft.SqlTools.ResourceProvider.DefaultImpl
{
return Keys.GetString(Keys.UnsupportedAuthType);
}
}
}
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Keys
@@ -107,34 +107,34 @@ namespace Microsoft.SqlTools.ResourceProvider.DefaultImpl
static ResourceManager resourceManager = new ResourceManager("Microsoft.SqlTools.ResourceProvider.DefaultImpl.Localization.SR", typeof(SR).GetTypeInfo().Assembly);
static CultureInfo _culture = null;
public const string FailedToGetAzureDatabasesErrorMessage = "FailedToGetAzureDatabasesErrorMessage";
public const string FailedToGetAzureSubscriptionsErrorMessage = "FailedToGetAzureSubscriptionsErrorMessage";
public const string FailedToGetAzureResourceGroupsErrorMessage = "FailedToGetAzureResourceGroupsErrorMessage";
public const string FailedToGetAzureSqlServersErrorMessage = "FailedToGetAzureSqlServersErrorMessage";
public const string FailedToGetAzureSqlServersWithError = "FailedToGetAzureSqlServersWithError";
public const string FirewallRuleCreationFailed = "FirewallRuleCreationFailed";
public const string FirewallRuleCreationFailedWithError = "FirewallRuleCreationFailedWithError";
public const string AzureSubscriptionFailedErrorMessage = "AzureSubscriptionFailedErrorMessage";
public const string UnsupportedAuthType = "UnsupportedAuthType";
public const string FailedToGetAzureDatabasesErrorMessage = "FailedToGetAzureDatabasesErrorMessage";
public const string FailedToGetAzureSubscriptionsErrorMessage = "FailedToGetAzureSubscriptionsErrorMessage";
public const string FailedToGetAzureResourceGroupsErrorMessage = "FailedToGetAzureResourceGroupsErrorMessage";
public const string FailedToGetAzureSqlServersErrorMessage = "FailedToGetAzureSqlServersErrorMessage";
public const string FailedToGetAzureSqlServersWithError = "FailedToGetAzureSqlServersWithError";
public const string FirewallRuleCreationFailed = "FirewallRuleCreationFailed";
public const string FirewallRuleCreationFailedWithError = "FirewallRuleCreationFailedWithError";
public const string AzureSubscriptionFailedErrorMessage = "AzureSubscriptionFailedErrorMessage";
public const string UnsupportedAuthType = "UnsupportedAuthType";
private Keys()
{ }
@@ -155,7 +155,7 @@ namespace Microsoft.SqlTools.ResourceProvider.DefaultImpl
{
return resourceManager.GetString(key, _culture);
}
}
}
}
}
}
}

View File

@@ -120,37 +120,37 @@
<data name="FailedToGetAzureDatabasesErrorMessage" xml:space="preserve">
<value>An error occurred while getting Azure databases</value>
<comment></comment>
</data>
</data>
<data name="FailedToGetAzureSubscriptionsErrorMessage" xml:space="preserve">
<value>An error occurred while getting Azure subscriptions: {0}</value>
<comment></comment>
</data>
</data>
<data name="FailedToGetAzureResourceGroupsErrorMessage" xml:space="preserve">
<value>An error occurred while getting Azure resource groups: {0}</value>
<comment></comment>
</data>
</data>
<data name="FailedToGetAzureSqlServersErrorMessage" xml:space="preserve">
<value>An error occurred while getting Azure Sql Servers</value>
<comment></comment>
</data>
</data>
<data name="FailedToGetAzureSqlServersWithError" xml:space="preserve">
<value>An error occurred while getting Azure Sql Servers: '{0}'</value>
<comment></comment>
</data>
</data>
<data name="FirewallRuleCreationFailed" xml:space="preserve">
<value>An error occurred while creating a new firewall rule.</value>
<comment></comment>
</data>
</data>
<data name="FirewallRuleCreationFailedWithError" xml:space="preserve">
<value>An error occurred while creating a new firewall rule: '{0}'</value>
<comment></comment>
</data>
</data>
<data name="AzureSubscriptionFailedErrorMessage" xml:space="preserve">
<value>An error occurred while getting Azure subscriptions</value>
<comment></comment>
</data>
</data>
<data name="UnsupportedAuthType" xml:space="preserve">
<value>Unsupported account type '{0}' for this provider</value>
<comment></comment>
</data>
</root>
</data>
</root>