Skip to content

Commit cafa38f

Browse files
committed
Fixing Sql Server Database Context Test
1 parent 9e74167 commit cafa38f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/NewAzureSqlDatabaseServerContextTests.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
using System.Management.Automation;
2020
using Microsoft.VisualStudio.TestTools.UnitTesting;
2121
using Microsoft.Azure.Common.Authentication.Models;
22+
using Microsoft.Azure.Common.Authentication;
2223
using Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet;
2324
using Microsoft.WindowsAzure.Commands.SqlDatabase.Properties;
2425
using Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Common;
@@ -42,6 +43,19 @@ public void CleanupTest()
4243
public void TestGetManageUrl()
4344
{
4445
NewAzureSqlDatabaseServerContext contextCmdlet = new NewAzureSqlDatabaseServerContext();
46+
var profile = new AzureProfile();
47+
var account = new AzureAccount {Id = "mockAccount", Type = AzureAccount.AccountType.User};
48+
var subscription = new AzureSubscription
49+
{
50+
Account = "mockAccount",
51+
Environment = EnvironmentName.AzureCloud,
52+
Id = Guid.NewGuid(),
53+
Name = "mockSubscription"
54+
};
55+
profile.Accounts.Add(account.Id, account);
56+
profile.Subscriptions.Add(subscription.Id, subscription);
57+
profile.DefaultSubscription = subscription;
58+
contextCmdlet.Profile = profile;
4559

4660
// Make sure that server name to Manage Url conversion is working
4761
contextCmdlet.ServerName = "server0001";

0 commit comments

Comments
 (0)