-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copy Directory from AzureTenant and Type from AzureEnvironment in De…
…epCopy of Azure Context (#402) * Define and implement DeepCloneable interface for Azure* class such as AzureContext 1. Define and implementation `IDeepCloneable` interface 2. Remove unused codes in `DefaultProfile` * Address the review comments * Address review comments
- Loading branch information
Showing
3 changed files
with
26 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,16 +34,18 @@ public void TestDeepCopy() | |
IAzureAccount account = new AzureAccount() | ||
{ | ||
Id = "[email protected]", | ||
Type = "User" | ||
Type = AzureAccount.AccountType.User | ||
}; | ||
|
||
IAzureEnvironment environment = new AzureEnvironment() | ||
{ | ||
Name = "my environment" | ||
Name = "my environment", | ||
Type = AzureEnvironment.TypeDiscovered | ||
}; | ||
IAzureTenant tenant = new AzureTenant() | ||
{ | ||
Id = "DDDDDDDD-DDDD-DDDD-DDDD-DDDDDDDDDDDD" | ||
Id = "DDDDDDDD-DDDD-DDDD-DDDD-DDDDDDDDDDDD", | ||
Directory = SubHomeTenant | ||
}; | ||
IAzureContext original = new AzureContext(subscription, account, environment, tenant); | ||
const string PropertyKey = "customPropertyKey"; | ||
|
@@ -68,6 +70,13 @@ public void TestDeepCopy() | |
// custom property | ||
Assert.Equal(SubHomeTenant, clone.Subscription.GetHomeTenant()); | ||
Assert.Equal(PropertyValue, clone.GetProperty(PropertyKey)); | ||
|
||
// implementation specific attributes | ||
Assert.Equal(((AzureEnvironment)original.Environment).Type, ((AzureEnvironment)clone.Environment).Type); | ||
Assert.Equal(((AzureTenant)original.Tenant).Directory, ((AzureTenant)clone.Tenant).Directory); | ||
|
||
//tokenCache checking | ||
Assert.Null(clone.TokenCache.CacheData); | ||
} | ||
|
||
[Fact] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters