Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ResourceGroupOperations tests #21893

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
10f6ad0
Change the accessbility to virtual for Resource.Id
YalinLi0312 Mar 24, 2021
ccc17c7
merge from usptream
Apr 5, 2021
5060f5c
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
m-nash Apr 12, 2021
9a9a651
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
m-nash Apr 21, 2021
7764cb5
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
YalinLi0312 Apr 23, 2021
832483a
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
YalinLi0312 Apr 28, 2021
3066cd2
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
YalinLi0312 May 6, 2021
9597dc7
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
YalinLi0312 May 6, 2021
86547b0
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
m-nash May 10, 2021
4fa650c
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
m-nash May 10, 2021
6f858c5
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
m-nash May 17, 2021
fb80156
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
m-nash May 25, 2021
4f1408d
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
YalinLi0312 Jun 4, 2021
0bcb9e4
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
YalinLi0312 Jun 7, 2021
2a78d80
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
YalinLi0312 Jun 11, 2021
576b392
Add ResourceGroupOperations tests
YalinLi0312 Jun 15, 2021
317204a
Remove parallelizable tag
YalinLi0312 Jun 16, 2021
4e5ae1b
Update session records
YalinLi0312 Jun 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure.Core.TestFramework;
Expand Down Expand Up @@ -76,6 +77,8 @@ public async Task Update()
Assert.AreEqual(rg1.Data.Location, rg2.Data.Location);
Assert.AreEqual(rg1.Data.ManagedBy, rg2.Data.ManagedBy);
Assert.AreEqual(rg1.Data.Tags, rg2.Data.Tags);

Assert.ThrowsAsync<ArgumentNullException>(async () => _ = await rg1.UpdateAsync(null));
}

[TestCase]
Expand All @@ -87,6 +90,12 @@ public async Task StartExportTemplate()
parameters.Resources.Add("*");
var expOp = await rg.StartExportTemplateAsync(parameters);
await expOp.WaitForCompletionAsync();

Assert.ThrowsAsync<ArgumentNullException>(async () =>
{
var expOp = await rg.StartExportTemplateAsync(null);
_ = await expOp.WaitForCompletionAsync();
});
}

[TestCase]
Expand All @@ -104,6 +113,9 @@ public async Task AddTag()
Assert.AreEqual(rg1.Data.Properties.ProvisioningState, rg2.Data.Properties.ProvisioningState);
Assert.AreEqual(rg1.Data.Location, rg2.Data.Location);
Assert.AreEqual(rg1.Data.ManagedBy, rg2.Data.ManagedBy);

Assert.ThrowsAsync<ArgumentException>(async () => _ = await rg1.AddTagAsync(null, "value"));
Assert.ThrowsAsync<ArgumentException>(async () => _ = await rg1.AddTagAsync(" ", "value"));
}

[TestCase]
Expand All @@ -123,6 +135,17 @@ public async Task StartAddTag()
Assert.AreEqual(rg1.Data.Properties.ProvisioningState, rg2.Data.Properties.ProvisioningState);
Assert.AreEqual(rg1.Data.Location, rg2.Data.Location);
Assert.AreEqual(rg1.Data.ManagedBy, rg2.Data.ManagedBy);

Assert.ThrowsAsync<ArgumentException>(async () =>
{
var addTagOp = await rg1.StartAddTagAsync(null, "value");
_ = await addTagOp.WaitForCompletionAsync();
});
Assert.ThrowsAsync<ArgumentException>(async () =>
{
var addTagOp = await rg1.StartAddTagAsync(" ", "value");
_ = await addTagOp.WaitForCompletionAsync();
});
}

[TestCase]
Expand All @@ -143,6 +166,8 @@ public async Task SetTags()
Assert.AreEqual(rg1.Data.Properties.ProvisioningState, rg2.Data.Properties.ProvisioningState);
Assert.AreEqual(rg1.Data.Location, rg2.Data.Location);
Assert.AreEqual(rg1.Data.ManagedBy, rg2.Data.ManagedBy);

Assert.ThrowsAsync<ArgumentNullException>(async () => _ = await rg1.SetTagsAsync(null));
}

[TestCase]
Expand All @@ -165,6 +190,12 @@ public async Task StartSetTags()
Assert.AreEqual(rg1.Data.Properties.ProvisioningState, rg2.Data.Properties.ProvisioningState);
Assert.AreEqual(rg1.Data.Location, rg2.Data.Location);
Assert.AreEqual(rg1.Data.ManagedBy, rg2.Data.ManagedBy);

Assert.ThrowsAsync<ArgumentNullException>(async () =>
{
var setTagOp = await rg1.StartSetTagsAsync(null);
_ = await setTagOp.WaitForCompletionAsync();
});
}

[TestCase]
Expand All @@ -190,6 +221,9 @@ public async Task RemoveTag()
Assert.AreEqual(rg1.Data.Properties.ProvisioningState, rg2.Data.Properties.ProvisioningState);
Assert.AreEqual(rg1.Data.Location, rg2.Data.Location);
Assert.AreEqual(rg1.Data.ManagedBy, rg2.Data.ManagedBy);

Assert.ThrowsAsync<ArgumentException>(async () => _ = await rg1.RemoveTagAsync(null));
Assert.ThrowsAsync<ArgumentException>(async () => _ = await rg1.RemoveTagAsync(" "));
}

[TestCase]
Expand Down Expand Up @@ -218,6 +252,17 @@ public async Task StartRemoveTag()
Assert.AreEqual(rg1.Data.Properties.ProvisioningState, rg2.Data.Properties.ProvisioningState);
Assert.AreEqual(rg1.Data.Location, rg2.Data.Location);
Assert.AreEqual(rg1.Data.ManagedBy, rg2.Data.ManagedBy);

Assert.ThrowsAsync<ArgumentException>(async () =>
{
var removeTagOp = await rg1.StartRemoveTagAsync(null);
_ = await removeTagOp.WaitForCompletionAsync();
});
Assert.ThrowsAsync<ArgumentException>(async () =>
{
var removeTagOp = await rg1.StartRemoveTagAsync(" ");
_ = await removeTagOp.WaitForCompletionAsync();
});
}

[TestCase]
Expand Down Expand Up @@ -257,6 +302,8 @@ public async Task MoveResources()
countRg2 = await GetResourceCountAsync(genericResources, rg2);
Assert.AreEqual(0, countRg1);
Assert.AreEqual(1, countRg2);

Assert.ThrowsAsync<ArgumentNullException>(async () => _ = await rg1.MoveResourcesAsync(null));
}

[TestCase]
Expand Down Expand Up @@ -286,6 +333,12 @@ public async Task StartMoveResources()
countRg2 = await GetResourceCountAsync(genericResources, rg2);
Assert.AreEqual(0, countRg1);
Assert.AreEqual(1, countRg2);

Assert.ThrowsAsync<ArgumentNullException>(async () =>
{
var moveOp = await rg1.StartMoveResourcesAsync(null);
_ = await moveOp.WaitForCompletionResponseAsync();
});
}

[TestCase]
Expand All @@ -302,6 +355,8 @@ public async Task ValidateMoveResources()
Response response = await rg1.ValidateMoveResourcesAsync(moveInfo);

Assert.AreEqual(204, response.Status);

Assert.ThrowsAsync<ArgumentNullException>(async () => _ = await rg1.ValidateMoveResourcesAsync(null));
}

[TestCase]
Expand All @@ -322,6 +377,12 @@ public async Task StartValidateMoveResources()
Response response = await validateOp.WaitForCompletionResponseAsync();

Assert.AreEqual(204, response.Status);

Assert.ThrowsAsync<ArgumentNullException>(async () =>
{
var moveOp = await rg1.StartValidateMoveResourcesAsync(null);
_ = await moveOp.WaitForCompletionResponseAsync();
});
}

[TestCase]
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading