Skip to content

Commit 9045a4c

Browse files
author
Hovsep Mkrtchyan
committed
Fixed CanClearStorageAccountForSMProfile test
1 parent c91c91a commit 9045a4c

File tree

2 files changed

+22
-20
lines changed

2 files changed

+22
-20
lines changed

src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/ProfileClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ public AzureSubscription SetSubscriptionAsDefault(Guid id, string accountName)
656656
{
657657
if (subscription.IsPropertySet(AzureSubscription.Property.StorageAccount))
658658
{
659-
subscription.SetProperty(AzureSubscription.Property.StorageAccount, null);
659+
GeneralUtilities.ClearCurrentStorageAccount();
660660
}
661661

662662
Profile.DefaultSubscription = subscription;

src/ResourceManager/Profile/Commands.Profile.Test/CommonDataCmdletTests.cs

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,22 @@ public static AzureRMProfile CreateAzureRMProfile(string storageAccount)
3939
AccountType = "User"
4040
},
4141
Environment = (PSAzureEnvironment)AzureEnvironment.PublicEnvironments[EnvironmentName.AzureCloud],
42-
Subscription =
43-
new PSAzureSubscription {
42+
Subscription =
43+
new PSAzureSubscription
44+
{
4445
CurrentStorageAccount = storageAccount,
45-
CurrentStorageAccountName= PSAzureSubscription.GetAccountName(storageAccount),
46+
CurrentStorageAccountName = PSAzureSubscription.GetAccountName(storageAccount),
4647
SubscriptionId = subscriptionId.ToString(),
4748
SubscriptionName = "Test Subscription 1",
4849
TenantId = tenantId.ToString()
4950
},
5051
Tenant = new PSAzureTenant
5152
{
52-
Domain=domain,
53+
Domain = domain,
5354
TenantId = tenantId.ToString()
5455
}
5556
};
56-
return new AzureRMProfile() { Context = context};
57+
return new AzureRMProfile() { Context = context };
5758
}
5859

5960
public static AzureSMProfile CreateAzureSMProfile(string storageAccount)
@@ -99,13 +100,14 @@ public static void RunDataProfileTest(AzureRMProfile rmProfile, AzureSMProfile s
99100
AzureRmProfileProvider.Instance.Profile = savedRmProfile;
100101
AzureSMProfileProvider.Instance.Profile = savedSmProfile;
101102
}
102-
}
103+
}
104+
103105
[Theory,
104106
InlineData(null, null),
105107
InlineData("", null),
106108
InlineData("AccountName=myAccount", "AccountName=myAccount")]
107109
[Trait(Category.AcceptanceType, Category.CheckIn)]
108-
public void CanClearStorageAccountForSMProfile(string connectionString, string expected)
110+
public void CanClearStorageAccountForSMProfile(string connectionString, string expected)
109111
{
110112
RunDataProfileTest(
111113
CreateAzureRMProfile(null),
@@ -121,9 +123,9 @@ public void CanClearStorageAccountForSMProfile(string connectionString, string e
121123
[Theory,
122124
InlineData(null, null),
123125
InlineData("", null),
124-
InlineData("AccountName=myAccount","AccountName=myAccount")]
126+
InlineData("AccountName=myAccount", "AccountName=myAccount")]
125127
[Trait(Category.AcceptanceType, Category.CheckIn)]
126-
public void CanClearStorageAccountForRMProfile(string connectionString, string expected)
128+
public void CanClearStorageAccountForRMProfile(string connectionString, string expected)
127129
{
128130
RunDataProfileTest(
129131
CreateAzureRMProfile(connectionString),
@@ -138,18 +140,18 @@ public void CanClearStorageAccountForRMProfile(string connectionString, string e
138140

139141
[Fact]
140142
[Trait(Category.AcceptanceType, Category.CheckIn)]
141-
public void CanClearStorageAccountForEmptyProfile()
143+
public void CanClearStorageAccountForEmptyProfile()
142144
{
143145
var rmProfile = new AzureRMProfile();
144146
rmProfile.Context = new AzureContext(null, null, null, null);
145-
RunDataProfileTest(
146-
rmProfile,
147-
new AzureSMProfile(),
148-
() =>
149-
{
150-
GeneralUtilities.ClearCurrentStorageAccount(true);
151-
Assert.True(string.IsNullOrEmpty(AzureSMProfileProvider.Instance.Profile.Context.GetCurrentStorageAccountName()));
152-
});
147+
RunDataProfileTest(
148+
rmProfile,
149+
new AzureSMProfile(),
150+
() =>
151+
{
152+
GeneralUtilities.ClearCurrentStorageAccount(true);
153+
Assert.True(string.IsNullOrEmpty(AzureSMProfileProvider.Instance.Profile.Context.GetCurrentStorageAccountName()));
154+
});
153155
}
154-
}
156+
}
155157
}

0 commit comments

Comments
 (0)