-
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 mock test autorest file * fix added test * tests and assets changes * add new delete test recordings * added test recording
- Loading branch information
1 parent
67aa322
commit 4e2262d
Showing
7 changed files
with
165 additions
and
11 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
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
50 changes: 50 additions & 0 deletions
50
sdk/avs/Azure.ResourceManager.Avs/tests/Scenario/IscsiPathResourceTest.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,50 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Azure.Core; | ||
using Azure.Core.TestFramework; | ||
using Azure.ResourceManager.Avs.Models; | ||
using NUnit.Framework; | ||
|
||
namespace Azure.ResourceManager.Avs.Tests.Scenario | ||
{ | ||
public class IscsiPathResourceTest : AvsManagementTestBase | ||
{ | ||
public IscsiPathResourceTest(bool isAsync) : base(isAsync) | ||
{ | ||
} | ||
|
||
[TestCase, Order(1)] | ||
[RecordedTest] | ||
public async Task Create() | ||
{ | ||
IscsiPathData data = new IscsiPathData() | ||
{ | ||
NetworkBlock = "172.16.0.0/24", | ||
}; | ||
ArmOperation<IscsiPathResource> lro = await getIscsiPathResource().CreateOrUpdateAsync(WaitUntil.Completed, data); | ||
IscsiPathResource result = lro.Value; | ||
Assert.AreEqual(result.Data.Name, ISCSI_PATH_NAME); | ||
} | ||
|
||
[TestCase, Order(2)] | ||
[RecordedTest] | ||
public async Task Get() | ||
{ | ||
IscsiPathResource iscsiPath = await getIscsiPathResource().GetAsync(); | ||
Assert.AreEqual(iscsiPath.Data.Name, ISCSI_PATH_NAME); | ||
} | ||
|
||
[TestCase, Order(3)] | ||
[RecordedTest] | ||
public async Task Delete() | ||
{ | ||
ArmOperation lro = await getIscsiPathResource().DeleteAsync(WaitUntil.Started); | ||
} | ||
} | ||
} |
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
80 changes: 80 additions & 0 deletions
80
sdk/avs/Azure.ResourceManager.Avs/tests/Scenario/WorkloadNetworkVmGroupCollectionTest.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,80 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Azure.Core; | ||
using Azure.Core.TestFramework; | ||
using Azure.ResourceManager.Avs.Models; | ||
using NUnit.Framework; | ||
|
||
namespace Azure.ResourceManager.Avs.Tests.Scenario | ||
{ | ||
public class WorkloadNetworkVmGroupCollectionTest: AvsManagementTestBase | ||
{ | ||
public WorkloadNetworkVmGroupCollectionTest(bool isAsync) : base(isAsync) | ||
{ | ||
} | ||
|
||
[TestCase, Order(1)] | ||
[RecordedTest] | ||
public async Task GetCollection() | ||
{ | ||
WorkloadNetworkVmGroupCollection collection = getWorkloadNetworkResource().GetWorkloadNetworkVmGroups(); | ||
var workloadNetworksList = new List<WorkloadNetworkVmGroupResource>(); | ||
await foreach (WorkloadNetworkVmGroupResource item in collection.GetAllAsync()) | ||
{ | ||
workloadNetworksList.Add(item); | ||
} | ||
|
||
Assert.IsTrue(workloadNetworksList.Any()); | ||
} | ||
|
||
[TestCase, Order(1)] | ||
[RecordedTest] | ||
public async Task GetCollectionOld() | ||
{ | ||
WorkloadNetworkVmGroupCollection collection = getWorkloadNetworkResourceOld().GetWorkloadNetworkVmGroups(); | ||
var workloadNetworksList = new List<WorkloadNetworkVmGroupResource>(); | ||
await foreach (WorkloadNetworkVmGroupResource item in collection.GetAllAsync()) | ||
{ | ||
workloadNetworksList.Add(item); | ||
} | ||
|
||
Assert.IsTrue(workloadNetworksList.Any()); | ||
} | ||
|
||
[TestCase, Order(2)] | ||
[RecordedTest] | ||
public async Task GetResource() | ||
{ | ||
WorkloadNetworkVmGroupCollection collection = getWorkloadNetworkResource().GetWorkloadNetworkVmGroups(); | ||
WorkloadNetworkVmGroupResource result = await collection.GetAsync(WORKLOAD_NETWORK_NAME); | ||
Assert.AreEqual(result.Data.Name, WORKLOAD_NETWORK_NAME); | ||
} | ||
|
||
[TestCase, Order(3)] | ||
[RecordedTest] | ||
public async Task resourceExisits() | ||
{ | ||
WorkloadNetworkVmGroupCollection collection = getWorkloadNetworkResource().GetWorkloadNetworkVmGroups(); | ||
bool result = await collection.ExistsAsync(WORKLOAD_NETWORK_NAME); | ||
Assert.True(result); | ||
result = await collection.ExistsAsync("wn1"); | ||
Assert.False(result); | ||
} | ||
[TestCase, Order(4)] | ||
[RecordedTest] | ||
public async Task getIfExisits() | ||
{ | ||
WorkloadNetworkVmGroupCollection collection = getWorkloadNetworkResource().GetWorkloadNetworkVmGroups(); | ||
NullableResponse<WorkloadNetworkVmGroupResource> response = await collection.GetIfExistsAsync(WORKLOAD_NETWORK_NAME); | ||
WorkloadNetworkVmGroupResource result = response.HasValue ? response.Value : null; | ||
Assert.NotNull(result); | ||
Assert.AreEqual(result.Data.Name, WORKLOAD_NETWORK_NAME); | ||
} | ||
} | ||
} |