-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add WritableSubResource tests (#22618)
* Change the accessbility to virtual for Resource.Id * Add SubscriptionContainer tests (#22348) * Change SubResource constructors to protected * Fix a bug in ReferenceType tests * Add WritableSubResource tests * Delete not in use class UpdateResourceGroupOperation * Update unit test * Update reference type tests Co-authored-by: m-nash <prognash@microsoft.com> Co-authored-by: m-nash <prognash@gmail.com>
- Loading branch information
1 parent
a07759e
commit 61189f1
Showing
6 changed files
with
55 additions
and
77 deletions.
There are no files selected for viewing
62 changes: 0 additions & 62 deletions
62
sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/UpdateResourceGroupOperation.cs
This file was deleted.
Oops, something went wrong.
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
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
27 changes: 27 additions & 0 deletions
27
sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/WritableSubResourceTests.cs
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System.Text.Json; | ||
using Azure.ResourceManager.TestFramework; | ||
using NUnit.Framework; | ||
|
||
namespace Azure.ResourceManager.Core.Tests | ||
{ | ||
[Parallelizable] | ||
public class WritableSubResourceTests | ||
{ | ||
[Test] | ||
public void Deserialization() | ||
{ | ||
var id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.ClassicStorage/storageAccounts/account1"; | ||
var expected = "{\"id\":\"" + id + "\"}"; | ||
var resource1 = new WritableSubResource(id); | ||
var jsonString = JsonHelper.SerializeToString(resource1); | ||
var json = JsonDocument.Parse(jsonString).RootElement; | ||
var resource2 = WritableSubResource.DeserializeWritableSubResource(json); | ||
Assert.AreEqual(expected, jsonString); | ||
Assert.AreEqual(jsonString, JsonHelper.SerializeToString(resource2)); | ||
|
||
var resource3 = new WritableSubResource(); | ||
resource3.Id = id; | ||
Assert.AreEqual(jsonString, JsonHelper.SerializeToString(resource3)); | ||
} | ||
} | ||
} |