diff --git a/sdk/core/Azure.Core.TestFramework/src/Instrumentation/ManagementInterceptor.cs b/sdk/core/Azure.Core.TestFramework/src/Instrumentation/ManagementInterceptor.cs
index 1a15cf8f93e6..53bd2a9308e1 100644
--- a/sdk/core/Azure.Core.TestFramework/src/Instrumentation/ManagementInterceptor.cs
+++ b/sdk/core/Azure.Core.TestFramework/src/Instrumentation/ManagementInterceptor.cs
@@ -29,19 +29,21 @@ public void Intercept(IInvocation invocation)
}
var type = result.GetType();
- if (type.Name.StartsWith("ValueTask"))
+ if (type.Name.StartsWith("ValueTask") ||
+ type.Name.StartsWith("Task") ||
+ type.Name.StartsWith("AsyncStateMachineBox")) //in .net 5 the type is not task here
{
if ((bool)type.GetProperty("IsFaulted").GetValue(result))
return;
var taskResultType = type.GetGenericArguments()[0];
- if (taskResultType.Name.StartsWith("Response") || taskResultType.Name.StartsWith("ArmResponse"))
+ if (taskResultType.Name.StartsWith("Response"))
{
var taskResult = result.GetType().GetProperty("Result").GetValue(result);
var instrumentedResult = _testBase.InstrumentClient(taskResultType, taskResult, new IInterceptor[] { new ManagementInterceptor(_testBase) });
- var genericValueTask = typeof(ValueTask<>).MakeGenericType(taskResultType);
- var vtCtor = genericValueTask.GetConstructor(new Type[] { taskResultType });
- invocation.ReturnValue = vtCtor.Invoke(new object[] { instrumentedResult });
+ invocation.ReturnValue = type.Name.StartsWith("ValueTask")
+ ? GetValueFromValueTask(taskResultType, instrumentedResult)
+ : GetValueFromOther(taskResultType, instrumentedResult);
}
}
else if (invocation.Method.Name.EndsWith("Value") && type.BaseType.Name.EndsWith("Operations"))
@@ -60,5 +62,19 @@ public void Intercept(IInvocation invocation)
invocation.ReturnValue = ctor.Invoke(new object[] { _testBase, result });
}
}
+
+ private object GetValueFromOther(Type taskResultType, object instrumentedResult)
+ {
+ var method = typeof(Task).GetMethod("FromResult", BindingFlags.Public | BindingFlags.Static);
+ var genericMethod = method.MakeGenericMethod(taskResultType);
+ return genericMethod.Invoke(null, new object[] { instrumentedResult });
+ }
+
+ private object GetValueFromValueTask(Type taskResultType, object instrumentedResult)
+ {
+ var genericValueTask = typeof(ValueTask<>).MakeGenericType(taskResultType);
+ var vtCtor = genericValueTask.GetConstructor(new Type[] { taskResultType });
+ return vtCtor.Invoke(new object[] { instrumentedResult });
+ }
}
}
diff --git a/sdk/core/Azure.Core/Azure.Core.sln b/sdk/core/Azure.Core/Azure.Core.sln
index b3237f2b976d..c4fe5fd8f833 100644
--- a/sdk/core/Azure.Core/Azure.Core.sln
+++ b/sdk/core/Azure.Core/Azure.Core.sln
@@ -31,7 +31,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Test.Perf", "..\..\..
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Core", "..\..\resourcemanager\Azure.ResourceManager.Core\src\Azure.ResourceManager.Core.csproj", "{8E60A748-3973-471A-B103-EC9406BB3313}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.AI.TextAnalytics", "..\..\textanalytics\Azure.AI.TextAnalytics\src\Azure.AI.TextAnalytics.csproj", "{B1FFA603-1CAA-4CE0-97E9-CA6CE9D498B9}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.AI.TextAnalytics", "..\..\textanalytics\Azure.AI.TextAnalytics\src\Azure.AI.TextAnalytics.csproj", "{9E2B7F26-D6AE-459B-ADFC-C34949674ED5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -95,10 +95,10 @@ Global
{8E60A748-3973-471A-B103-EC9406BB3313}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E60A748-3973-471A-B103-EC9406BB3313}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E60A748-3973-471A-B103-EC9406BB3313}.Release|Any CPU.Build.0 = Release|Any CPU
- {B1FFA603-1CAA-4CE0-97E9-CA6CE9D498B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B1FFA603-1CAA-4CE0-97E9-CA6CE9D498B9}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B1FFA603-1CAA-4CE0-97E9-CA6CE9D498B9}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B1FFA603-1CAA-4CE0-97E9-CA6CE9D498B9}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9E2B7F26-D6AE-459B-ADFC-C34949674ED5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9E2B7F26-D6AE-459B-ADFC-C34949674ED5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9E2B7F26-D6AE-459B-ADFC-C34949674ED5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9E2B7F26-D6AE-459B-ADFC-C34949674ED5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/sdk/core/Azure.Core/tests/Azure.Core.Tests.csproj b/sdk/core/Azure.Core/tests/Azure.Core.Tests.csproj
index 6d0be6600957..7b5399ef6fb3 100644
--- a/sdk/core/Azure.Core/tests/Azure.Core.Tests.csproj
+++ b/sdk/core/Azure.Core/tests/Azure.Core.Tests.csproj
@@ -19,10 +19,10 @@
+
-
diff --git a/sdk/core/Azure.Core/tests/ManagementRecordedTestBaseTests.cs b/sdk/core/Azure.Core/tests/ManagementRecordedTestBaseTests.cs
index 4835f5564d1c..f69cf17aaea1 100644
--- a/sdk/core/Azure.Core/tests/ManagementRecordedTestBaseTests.cs
+++ b/sdk/core/Azure.Core/tests/ManagementRecordedTestBaseTests.cs
@@ -2,10 +2,9 @@
// Licensed under the MIT License.
using System;
+using System.Diagnostics;
using System.Threading.Tasks;
using Azure.Core.TestFramework;
-using Azure.ResourceManager.Core;
-using Azure.ResourceManager.Resources.Models;
using Azure.ResourceManager.TestFramework;
using NUnit.Framework;
@@ -67,30 +66,6 @@ public async Task ValidateInstrumentArmResponse()
Assert.AreEqual("success", result);
}
- [Test]
- public async Task ValidateInstrumentPhArmOperation()
- {
- ManagementTestClient client = InstrumentClient(new ManagementTestClient());
- var sub = client.DefaultSubscription;
- var operation = (await sub.GetPhArmOperationAsync()).Value;
- var result = operation.Method();
-
- Assert.AreEqual("TestResourceProxy", operation.GetType().Name);
- Assert.AreEqual("success", result);
- }
-
- [Test]
- public async Task ValidateInstrumentPhArmResponse()
- {
- ManagementTestClient client = InstrumentClient(new ManagementTestClient());
- var sub = client.DefaultSubscription;
- var response = (await sub.GetPhArmOperationAsync()).Value;
- var result = response.Method();
-
- Assert.AreEqual("TestResourceProxy", response.GetType().Name);
- Assert.AreEqual("success", result);
- }
-
[Test]
[SyncOnly]
public void ValidateInstrumentGetContainer()
@@ -141,7 +116,7 @@ public void ValidateExceptionResponse()
{
ManagementTestClient client = InstrumentClient(new ManagementTestClient());
TestResourceOperations rgOp = client.GetTestResourceOperations();
- Assert.ThrowsAsync(typeof(ArgumentException), async () => await rgOp.GetArmResponseExceptionAsync());
+ Assert.ThrowsAsync(typeof(ArgumentException), async () => await rgOp.GetResponseExceptionAsync());
}
[Test]
@@ -160,5 +135,51 @@ public async Task ValidateExceptionOperationWaitForCompletion()
var testResourceOp = await rgOp.GetArmOperationAsync(true);
Assert.ThrowsAsync(typeof(ArgumentException), async () => await testResourceOp.WaitForCompletionAsync());
}
+
+ [Test]
+ public async Task ValidateLroWrapper()
+ {
+ ManagementTestClient client = InstrumentClient(new ManagementTestClient());
+ TestResourceOperations rgOp = client.GetTestResourceOperations();
+ TestResource testResource = await rgOp.LroWrapperAsync();
+ Assert.AreEqual("TestResourceProxy", testResource.GetType().Name);
+ Assert.AreEqual("success", testResource.Method());
+ }
+
+ [Test]
+ public async Task ValidateStartLroWrapper()
+ {
+ ManagementTestClient client = InstrumentClient(new ManagementTestClient());
+ TestResourceOperations rgOp = client.GetTestResourceOperations();
+ var testResourceOp = await rgOp.StartLroWrapperAsync();
+ TestResource testResource = await testResourceOp.WaitForCompletionAsync();
+ Assert.AreEqual("TestResourceProxy", testResource.GetType().Name);
+ Assert.AreEqual("success", testResource.Method());
+ }
+
+ [Test]
+ public async Task ValidateSkipWait()
+ {
+ ManagementTestClient client = InstrumentClient(new ManagementTestClient());
+ TestResourceOperations rgOp = client.GetTestResourceOperations();
+ Stopwatch timer = Stopwatch.StartNew();
+ TestResource testResource = await rgOp.LroWrapperAsync();
+ timer.Stop();
+ //method waits for 10 seconds so timer should easily be less than half of that if we skip
+ Assert.IsTrue(timer.ElapsedMilliseconds < 5000, $"WaitForCompletion took {timer.ElapsedMilliseconds}ms");
+ }
+
+ [Test]
+ public async Task ValidateStartSkipWait()
+ {
+ ManagementTestClient client = InstrumentClient(new ManagementTestClient());
+ TestResourceOperations rgOp = client.GetTestResourceOperations();
+ var testResourceOp = await rgOp.StartLroWrapperAsync();
+ Stopwatch timer = Stopwatch.StartNew();
+ TestResource testResource = await testResourceOp.WaitForCompletionAsync();
+ timer.Stop();
+ //method waits for 10 seconds so timer should easily be less than half of that if we skip
+ Assert.IsTrue(timer.ElapsedMilliseconds < 5000, $"WaitForCompletion took {timer.ElapsedMilliseconds}ms");
+ }
}
}
diff --git a/sdk/core/Azure.Core/tests/TestClients/ArmOperationTest.cs b/sdk/core/Azure.Core/tests/TestClients/ArmOperationTest.cs
index e59f29feb194..69e7129ad51f 100644
--- a/sdk/core/Azure.Core/tests/TestClients/ArmOperationTest.cs
+++ b/sdk/core/Azure.Core/tests/TestClients/ArmOperationTest.cs
@@ -13,16 +13,18 @@ public class ArmOperationTest : Operation, IOperationSource _operationHelper;
+ private int _delaySteps = 0;
protected ArmOperationTest()
{
}
- public ArmOperationTest(TestResource value, bool exceptionOnWait = false)
+ public ArmOperationTest(TestResource value, bool exceptionOnWait = false, int delaySteps = 0)
{
_value = value;
_exceptionOnWait = exceptionOnWait;
_operationHelper = new OperationOrResponseInternals(Response.FromValue(value, new MockResponse(200)));
+ _delaySteps = delaySteps;
}
public override string Id => "testId";
@@ -35,20 +37,21 @@ public ArmOperationTest(TestResource value, bool exceptionOnWait = false)
public override Response GetRawResponse() => _operationHelper.GetRawResponse();
- public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default)
+ public async override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default)
{
- if (_exceptionOnWait)
- throw new ArgumentException("FakeArg");
-
- return new ValueTask>(Response.FromValue(_value, new MockResponse(200)));
+ return await WaitForCompletionAsync(OperationInternals.DefaultPollingInterval, cancellationToken);
}
- public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken)
+ public async override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken)
{
if (_exceptionOnWait)
throw new ArgumentException("FakeArg");
- return new ValueTask>(Response.FromValue(_value, new MockResponse(200)));
+ for (int i = 0; i < _delaySteps; i++)
+ {
+ await Task.Delay(pollingInterval);
+ }
+ return Response.FromValue(_value, new MockResponse(200));
}
public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operationHelper.UpdateStatusAsync(cancellationToken);
diff --git a/sdk/core/Azure.Core/tests/TestClients/ArmResponseTest.cs b/sdk/core/Azure.Core/tests/TestClients/ArmResponseTest.cs
deleted file mode 100644
index 7d915f9307f2..000000000000
--- a/sdk/core/Azure.Core/tests/TestClients/ArmResponseTest.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-namespace Azure.Core.Tests
-{
- public class ArmResponseTest
- {
- protected ArmResponseTest()
- {
- }
-
- public ArmResponseTest(T value)
- {
- Value = value;
- }
-
- public virtual T Value { get; private set; }
- }
-}
diff --git a/sdk/core/Azure.Core/tests/TestClients/PhArmOperationTest.cs b/sdk/core/Azure.Core/tests/TestClients/PhArmOperationTest.cs
deleted file mode 100644
index c8d89274d140..000000000000
--- a/sdk/core/Azure.Core/tests/TestClients/PhArmOperationTest.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using Azure.Core.TestFramework;
-
-namespace Azure.Core.Tests
-{
- public class PhArmOperationTest : Operation
- where T : class
- {
- private OperationOrResponseInternals _operationHelper;
-
- public override T Value => _operationHelper.Value;
-
- public override bool HasValue => _operationHelper.HasValue;
-
- public override string Id => "MyId";
-
- public override bool HasCompleted => _operationHelper.HasCompleted;
-
- protected PhArmOperationTest()
- {
- }
-
- public PhArmOperationTest(T value)
- {
- _operationHelper = new OperationOrResponseInternals(Response.FromValue(value, new MockResponse(200)));
- }
-
- public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operationHelper.WaitForCompletionAsync(cancellationToken);
-
- public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken) => _operationHelper.WaitForCompletionAsync(pollingInterval, cancellationToken);
-
- public override Response GetRawResponse() => _operationHelper.GetRawResponse();
-
- public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operationHelper.UpdateStatusAsync(cancellationToken);
-
- public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operationHelper.UpdateStatus(cancellationToken);
- }
-}
diff --git a/sdk/core/Azure.Core/tests/TestClients/PhArmResponseTest.cs b/sdk/core/Azure.Core/tests/TestClients/PhArmResponseTest.cs
deleted file mode 100644
index 04c6b1760ae3..000000000000
--- a/sdk/core/Azure.Core/tests/TestClients/PhArmResponseTest.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-namespace Azure.Core.Tests
-{
- public class PhArmResponseTest : ArmResponseTest
- {
- protected PhArmResponseTest()
- {
- }
-
- public PhArmResponseTest(T value) : base(value)
- {
- }
- }
-}
diff --git a/sdk/core/Azure.Core/tests/TestClients/TestResourceContainer.cs b/sdk/core/Azure.Core/tests/TestClients/TestResourceContainer.cs
index 4e61503fd18a..547ef42e7999 100644
--- a/sdk/core/Azure.Core/tests/TestClients/TestResourceContainer.cs
+++ b/sdk/core/Azure.Core/tests/TestClients/TestResourceContainer.cs
@@ -2,11 +2,11 @@
// Licensed under the MIT License.
using System;
+using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Azure.Core.Pipeline;
-using Azure.ResourceManager.Core;
-using static Azure.Core.PageResponseEnumerator;
+using Azure.Core.TestFramework;
namespace Azure.Core.Tests
{
@@ -16,11 +16,6 @@ public class TestResourceContainer
[ForwardsClientCalls]
public virtual Pageable List(int pages = 1, CancellationToken cancellation = default)
- {
- return GetSyncResults(pages);
- }
-
- private FuncPageable GetSyncResults(int pages)
{
Page pageFunc(int? pageSizeHint)
{
@@ -30,7 +25,8 @@ Page pageFunc(int? pageSizeHint)
try
{
- return Page.FromValues(new TestResource[] { new TestResource(), new TestResource() }, null, null);
+ var result = new object[] { new object(), new object() };
+ return Page.FromValues(result.Select(o => new TestResource()), null, new MockResponse(200));
}
catch (Exception e)
{
@@ -38,16 +34,11 @@ Page pageFunc(int? pageSizeHint)
throw;
}
}
- return new FuncPageable((cToken, pageSize) => pageFunc(pageSize));
+ return PageableHelpers.CreateEnumerable(pageFunc, null);
}
[ForwardsClientCalls]
public virtual AsyncPageable ListAsync(int pages = 1, CancellationToken cancellation = default)
- {
- return GetAsyncResults(pages);
- }
-
- private FuncAsyncPageable GetAsyncResults(int pages)
{
async Task> pageFunc(int? pageSizeHint)
{
@@ -57,7 +48,8 @@ async Task> pageFunc(int? pageSizeHint)
try
{
await Task.Delay(10);
- return Page.FromValues(new TestResource[] { new TestResource(), new TestResource() }, null, null);
+ var result = new object[] { new object(), new object() };
+ return Page.FromValues(result.Select(o => new TestResource()), null, new MockResponse(200));
}
catch (Exception e)
{
@@ -65,7 +57,7 @@ async Task> pageFunc(int? pageSizeHint)
throw;
}
}
- return new FuncAsyncPageable((cToken, pageSize) => pageFunc(pageSize));
+ return PageableHelpers.CreateAsyncEnumerable(pageFunc, null);
}
public virtual string Method()
diff --git a/sdk/core/Azure.Core/tests/TestClients/TestResourceOperations.cs b/sdk/core/Azure.Core/tests/TestClients/TestResourceOperations.cs
index 2c5be8db95a0..7a4995caa05e 100644
--- a/sdk/core/Azure.Core/tests/TestClients/TestResourceOperations.cs
+++ b/sdk/core/Azure.Core/tests/TestClients/TestResourceOperations.cs
@@ -5,6 +5,8 @@
using System.Threading;
using System.Threading.Tasks;
using Azure.Core.Pipeline;
+using Azure.Core.TestFramework;
+using Azure.ResourceManager.Core;
namespace Azure.Core.Tests
{
@@ -49,14 +51,14 @@ public virtual Task GetArmOperationAsync(bool exceptionOnWait
}
}
- public virtual ArmResponseTest GetArmResponse(CancellationToken cancellationToken = default)
+ public virtual Response GetResponse(CancellationToken cancellationToken = default)
{
- using var scope = _diagnostic.CreateScope("TestResourceOperations.GetArmResponse");
+ using var scope = _diagnostic.CreateScope("TestResourceOperations.GetResponse");
scope.Start();
try
{
- return new ArmResponseTest(new TestResource());
+ return Response.FromValue(new TestResource(), new MockResponse(200));
}
catch (Exception e)
{
@@ -65,14 +67,15 @@ public virtual ArmResponseTest GetArmResponse(CancellationToken ca
}
}
- public virtual Task> GetArmResponseAsync(CancellationToken cancellationToken = default)
+ public async virtual Task> GetResponseAsync(CancellationToken cancellationToken = default)
{
- using var scope = _diagnostic.CreateScope("TestResourceOperations.GetArmResponse");
+ using var scope = _diagnostic.CreateScope("TestResourceOperations.GetResponse");
scope.Start();
try
{
- return Task.FromResult(new ArmResponseTest(new TestResource()));
+ await Task.Delay(1);
+ return Response.FromValue(new TestResource(), new MockResponse(200));
}
catch (Exception e)
{
@@ -81,14 +84,14 @@ public virtual Task> GetArmResponseAsync(Cancellat
}
}
- public virtual Operation GetPhArmOperation(CancellationToken cancellationToken = default)
+ public virtual Response GetResponseException(CancellationToken cancellationToken = default)
{
- using var scope = _diagnostic.CreateScope("TestResourceOperations.GetPhArmOperation");
+ using var scope = _diagnostic.CreateScope("TestResourceOperations.GetResponseException");
scope.Start();
try
{
- return new PhArmOperationTest(new TestResource());
+ throw new ArgumentException("FakeArg");
}
catch (Exception e)
{
@@ -97,14 +100,14 @@ public virtual Operation GetPhArmOperation(CancellationToken cance
}
}
- public virtual Task> GetPhArmOperationAsync(CancellationToken cancellationToken = default)
+ public virtual Task> GetResponseExceptionAsync(CancellationToken cancellationToken = default)
{
- using var scope = _diagnostic.CreateScope("TestResourceOperations.GetPhArmOperation");
+ using var scope = _diagnostic.CreateScope("TestResourceOperations.GetResponseException");
scope.Start();
try
{
- return Task.FromResult>(new PhArmOperationTest(new TestResource()));
+ throw new ArgumentException("FakeArg");
}
catch (Exception e)
{
@@ -113,14 +116,14 @@ public virtual Task> GetPhArmOperationAsync(Cancellation
}
}
- public virtual ArmResponseTest GetPhArmResponse(CancellationToken cancellationToken = default)
+ public virtual ArmOperationTest GetArmOperationException(CancellationToken cancellationToken = default)
{
- using var scope = _diagnostic.CreateScope("TestResourceOperations.GetPhArmResponse");
+ using var scope = _diagnostic.CreateScope("TestResourceOperations.GetArmOperationException");
scope.Start();
try
{
- return new PhArmResponseTest(new TestResource());
+ throw new ArgumentException("FakeArg");
}
catch (Exception e)
{
@@ -129,14 +132,14 @@ public virtual ArmResponseTest GetPhArmResponse(CancellationToken
}
}
- public virtual Task> GetPhArmResponseAsync(CancellationToken cancellationToken = default)
+ public virtual Task GetArmOperationExceptionAsync(CancellationToken cancellationToken = default)
{
- using var scope = _diagnostic.CreateScope("TestResourceOperations.GetPhArmResponse");
+ using var scope = _diagnostic.CreateScope("TestResourceOperations.GetArmOperationException");
scope.Start();
try
{
- return Task.FromResult>(new PhArmResponseTest(new TestResource()));
+ throw new ArgumentException("FakeArg");
}
catch (Exception e)
{
@@ -145,14 +148,15 @@ public virtual Task> GetPhArmResponseAsync(Cancell
}
}
- public virtual ArmResponseTest GetArmResponseException(CancellationToken cancellationToken = default)
+ public virtual Response LroWrapper(CancellationToken cancellationToken = default)
{
- using var scope = _diagnostic.CreateScope("TestResourceOperations.GetArmResponseException");
+ using var scope = _diagnostic.CreateScope("TestResourceOperations.LroWrapper");
scope.Start();
try
{
- throw new ArgumentException("FakeArg");
+ var operation = StartLroWrapper(cancellationToken);
+ return operation.WaitForCompletion(cancellationToken);
}
catch (Exception e)
{
@@ -161,14 +165,14 @@ public virtual ArmResponseTest GetArmResponseException(Cancellatio
}
}
- public virtual Task> GetArmResponseExceptionAsync(CancellationToken cancellationToken = default)
+ public virtual ArmOperationTest StartLroWrapper(CancellationToken cancellationToken = default)
{
- using var scope = _diagnostic.CreateScope("TestResourceOperations.GetArmResponseException");
+ using var scope = _diagnostic.CreateScope("TestResourceOperations.StartLroWrapper");
scope.Start();
try
{
- throw new ArgumentException("FakeArg");
+ return new ArmOperationTest(new TestResource());
}
catch (Exception e)
{
@@ -177,14 +181,15 @@ public virtual Task> GetArmResponseExceptionAsync(
}
}
- public virtual ArmOperationTest GetArmOperationException(CancellationToken cancellationToken = default)
+ public virtual async Task> LroWrapperAsync(CancellationToken cancellationToken = default)
{
- using var scope = _diagnostic.CreateScope("TestResourceOperations.GetArmOperationException");
+ using var scope = _diagnostic.CreateScope("TestResourceOperations.LroWrapper");
scope.Start();
try
{
- throw new ArgumentException("FakeArg");
+ var operation = await StartLroWrapperAsync(cancellationToken);
+ return await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
@@ -193,14 +198,82 @@ public virtual ArmOperationTest GetArmOperationException(CancellationToken cance
}
}
- public virtual Task GetArmOperationExceptionAsync(CancellationToken cancellationToken = default)
+ public virtual async Task StartLroWrapperAsync(CancellationToken cancellationToken = default)
{
- using var scope = _diagnostic.CreateScope("TestResourceOperations.GetArmOperationException");
+ using var scope = _diagnostic.CreateScope("TestResourceOperations.StartLroWrapper");
scope.Start();
try
{
- throw new ArgumentException("FakeArg");
+ await Task.Delay(1);
+ return new ArmOperationTest(new TestResource());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ public virtual Response LongLro(CancellationToken cancellationToken = default)
+ {
+ using var scope = _diagnostic.CreateScope("TestResourceOperations.LongLro");
+ scope.Start();
+
+ try
+ {
+ var operation = StartLongLro(cancellationToken);
+ return operation.WaitForCompletion(cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ public async virtual Task> LongLroAsync(CancellationToken cancellationToken = default)
+ {
+ using var scope = _diagnostic.CreateScope("TestResourceOperations.LongLro");
+ scope.Start();
+
+ try
+ {
+ var operation = await StartLongLroAsync(cancellationToken);
+ return await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ public virtual ArmOperationTest StartLongLro(CancellationToken cancellationToken = default)
+ {
+ using var scope = _diagnostic.CreateScope("TestResourceOperations.StartLongLro");
+ scope.Start();
+
+ try
+ {
+ return new ArmOperationTest(new TestResource(), delaySteps: 10);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ public async virtual Task StartLongLroAsync(CancellationToken cancellationToken = default)
+ {
+ using var scope = _diagnostic.CreateScope("TestResourceOperations.StartLongLro");
+ scope.Start();
+
+ try
+ {
+ await Task.Delay(1);
+ return new ArmOperationTest(new TestResource(), delaySteps: 10);
}
catch (Exception e)
{
diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ArmClientTests.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ArmClientTests.cs
index b3ca47f82fd4..031ed7a6187a 100644
--- a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ArmClientTests.cs
+++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ArmClientTests.cs
@@ -4,7 +4,7 @@
using Azure.Core.TestFramework;
using NUnit.Framework;
-namespace Azure.ResourceManager.Core.Tests.Scenario
+namespace Azure.ResourceManager.Core.Tests
{
class ArmClientTests : ResourceManagerTestBase
{
@@ -25,6 +25,22 @@ public async Task LocalOneTimeSetup()
StopSessionRecording();
}
+ [TestCase]
+ [Ignore("4622 needs complete with a Mocked example to fill in this test")]
+ public void CreateResourceFromId()
+ {
+ //TODO: 4622 needs complete with a Mocked example to fill in this test
+ //public ArmResponse CreateResource(string subscription, string resourceGroup, string name, TResource model, azure_proto_core.Location location = default)
+ }
+
+ [TestCase]
+ public void TestArmClientParamCheck()
+ {
+ Assert.Throws(() => { new ArmClient(null, null); });
+ Assert.Throws(() => { new ArmClient(baseUri: null, null, null); });
+ Assert.Throws(() => { new ArmClient(defaultSubscriptionId: null, null, null); });
+ }
+
[TestCase]
public void GetGenericOperationsTests()
{
diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientTests/ArmClientTests(False).json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientTests/ArmClientTests(False).json
index e03ebb8b3961..9dd9279b46c4 100644
--- a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientTests/ArmClientTests(False).json
+++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientTests/ArmClientTests(False).json
@@ -6,7 +6,7 @@
"RequestHeaders": {
"Accept": "application/json",
"Authorization": "Sanitized",
- "User-Agent": "azsdk-net-ResourceManager.Resources/1.0.0-preview.2 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
+ "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210616.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
"x-ms-client-request-id": "5a471502cc785e70e671623a1a452721",
"x-ms-return-client-request-id": "true"
},
@@ -14,22 +14,26 @@
"StatusCode": 200,
"ResponseHeaders": {
"Cache-Control": "no-cache",
- "Content-Length": "397",
+ "Content-Length": "450",
"Content-Type": "application/json; charset=utf-8",
- "Date": "Thu, 13 May 2021 22:40:37 GMT",
+ "Date": "Wed, 16 Jun 2021 23:46:48 GMT",
"Expires": "-1",
"Pragma": "no-cache",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
"X-Content-Type-Options": "nosniff",
- "x-ms-correlation-request-id": "db79409d-5486-4640-a33f-5cfd6529435f",
+ "x-ms-correlation-request-id": "4771a9f5-a355-449a-b60e-d774bfb56e91",
"x-ms-ratelimit-remaining-subscription-reads": "11999",
- "x-ms-request-id": "db79409d-5486-4640-a33f-5cfd6529435f",
- "x-ms-routing-request-id": "WESTUS2:20210513T224038Z:db79409d-5486-4640-a33f-5cfd6529435f"
+ "x-ms-request-id": "4771a9f5-a355-449a-b60e-d774bfb56e91",
+ "x-ms-routing-request-id": "WESTUS2:20210616T234649Z:4771a9f5-a355-449a-b60e-d774bfb56e91"
},
"ResponseBody": {
"id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c",
"authorizationSource": "RoleBased",
"managedByTenants": [],
+ "tags": {
+ "tagKey1": "tagValue1",
+ "tagKey2": "tagValue2"
+ },
"subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c",
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
"displayName": "Azure SDK sandbox",
@@ -47,8 +51,8 @@
"RequestHeaders": {
"Accept": "application/json",
"Authorization": "Sanitized",
- "traceparent": "00-f742bb62f8f4af4598f1b29eb48cf761-e07d36b4a0abcd44-00",
- "User-Agent": "azsdk-net-ResourceManager.Resources/1.0.0-preview.2 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
+ "traceparent": "00-e245f46c33ab3c4e9c7f370932ac64a6-42b1b50baf700342-00",
+ "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210616.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
"x-ms-client-request-id": "7f043350e1a08916b2e6d331bf887312",
"x-ms-return-client-request-id": "true"
},
@@ -56,22 +60,26 @@
"StatusCode": 200,
"ResponseHeaders": {
"Cache-Control": "no-cache",
- "Content-Length": "397",
+ "Content-Length": "450",
"Content-Type": "application/json; charset=utf-8",
- "Date": "Thu, 13 May 2021 22:40:38 GMT",
+ "Date": "Wed, 16 Jun 2021 23:46:48 GMT",
"Expires": "-1",
"Pragma": "no-cache",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
"X-Content-Type-Options": "nosniff",
- "x-ms-correlation-request-id": "7c513411-9fba-447a-ac08-0a85848037fc",
+ "x-ms-correlation-request-id": "ef1c16c5-d0e9-4e69-a0b2-fd476bf85900",
"x-ms-ratelimit-remaining-subscription-reads": "11998",
- "x-ms-request-id": "7c513411-9fba-447a-ac08-0a85848037fc",
- "x-ms-routing-request-id": "WESTUS2:20210513T224038Z:7c513411-9fba-447a-ac08-0a85848037fc"
+ "x-ms-request-id": "ef1c16c5-d0e9-4e69-a0b2-fd476bf85900",
+ "x-ms-routing-request-id": "WESTUS2:20210616T234649Z:ef1c16c5-d0e9-4e69-a0b2-fd476bf85900"
},
"ResponseBody": {
"id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c",
"authorizationSource": "RoleBased",
"managedByTenants": [],
+ "tags": {
+ "tagKey1": "tagValue1",
+ "tagKey2": "tagValue2"
+ },
"subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c",
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
"displayName": "Azure SDK sandbox",
@@ -91,7 +99,7 @@
"Authorization": "Sanitized",
"Content-Length": "41",
"Content-Type": "application/json",
- "User-Agent": "azsdk-net-ResourceManager.Resources/1.0.0-preview.2 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
+ "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210616.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
"x-ms-client-request-id": "1de8ca6ff16afc375aa8a238b9711bfb",
"x-ms-return-client-request-id": "true"
},
@@ -104,15 +112,15 @@
"Cache-Control": "no-cache",
"Content-Length": "237",
"Content-Type": "application/json; charset=utf-8",
- "Date": "Thu, 13 May 2021 22:40:39 GMT",
+ "Date": "Wed, 16 Jun 2021 23:46:50 GMT",
"Expires": "-1",
"Pragma": "no-cache",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
"X-Content-Type-Options": "nosniff",
- "x-ms-correlation-request-id": "fbb656b5-3b4d-4d9d-9ba0-a36f2a4ba2cc",
+ "x-ms-correlation-request-id": "f75725e7-c6d2-41b8-8b7c-4c5e0d481a88",
"x-ms-ratelimit-remaining-subscription-writes": "1199",
- "x-ms-request-id": "fbb656b5-3b4d-4d9d-9ba0-a36f2a4ba2cc",
- "x-ms-routing-request-id": "WESTUS2:20210513T224040Z:fbb656b5-3b4d-4d9d-9ba0-a36f2a4ba2cc"
+ "x-ms-request-id": "f75725e7-c6d2-41b8-8b7c-4c5e0d481a88",
+ "x-ms-routing-request-id": "WESTUS2:20210616T234651Z:f75725e7-c6d2-41b8-8b7c-4c5e0d481a88"
},
"ResponseBody": {
"id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/testRg-9828",
diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientTests/ArmClientTests(True)Async.json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientTests/ArmClientTests(True)Async.json
index d621b1cfa2e1..9f75a58006f7 100644
--- a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientTests/ArmClientTests(True)Async.json
+++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientTests/ArmClientTests(True)Async.json
@@ -6,7 +6,7 @@
"RequestHeaders": {
"Accept": "application/json",
"Authorization": "Sanitized",
- "User-Agent": "azsdk-net-ResourceManager.Resources/1.0.0-preview.2 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
+ "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210616.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
"x-ms-client-request-id": "5a471502cc785e70e671623a1a452721",
"x-ms-return-client-request-id": "true"
},
@@ -14,22 +14,26 @@
"StatusCode": 200,
"ResponseHeaders": {
"Cache-Control": "no-cache",
- "Content-Length": "397",
+ "Content-Length": "450",
"Content-Type": "application/json; charset=utf-8",
- "Date": "Thu, 13 May 2021 22:40:38 GMT",
+ "Date": "Wed, 16 Jun 2021 23:47:22 GMT",
"Expires": "-1",
"Pragma": "no-cache",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
"X-Content-Type-Options": "nosniff",
- "x-ms-correlation-request-id": "d61eac86-385d-4fac-b856-b67d7dde70f5",
+ "x-ms-correlation-request-id": "7aa001e0-fe4d-49bd-9ffd-57d08f770776",
"x-ms-ratelimit-remaining-subscription-reads": "11999",
- "x-ms-request-id": "d61eac86-385d-4fac-b856-b67d7dde70f5",
- "x-ms-routing-request-id": "WESTUS2:20210513T224038Z:d61eac86-385d-4fac-b856-b67d7dde70f5"
+ "x-ms-request-id": "7aa001e0-fe4d-49bd-9ffd-57d08f770776",
+ "x-ms-routing-request-id": "WESTUS2:20210616T234723Z:7aa001e0-fe4d-49bd-9ffd-57d08f770776"
},
"ResponseBody": {
"id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c",
"authorizationSource": "RoleBased",
"managedByTenants": [],
+ "tags": {
+ "tagKey1": "tagValue1",
+ "tagKey2": "tagValue2"
+ },
"subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c",
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
"displayName": "Azure SDK sandbox",
@@ -47,8 +51,8 @@
"RequestHeaders": {
"Accept": "application/json",
"Authorization": "Sanitized",
- "traceparent": "00-7d87511d50642d4dbc71baf8bb2620e3-9fe967510b80574b-00",
- "User-Agent": "azsdk-net-ResourceManager.Resources/1.0.0-preview.2 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
+ "traceparent": "00-4d68cdb00a80834db410fc754dd754dc-e183f5c86eeaed4b-00",
+ "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210616.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
"x-ms-client-request-id": "7f043350e1a08916b2e6d331bf887312",
"x-ms-return-client-request-id": "true"
},
@@ -56,22 +60,26 @@
"StatusCode": 200,
"ResponseHeaders": {
"Cache-Control": "no-cache",
- "Content-Length": "397",
+ "Content-Length": "450",
"Content-Type": "application/json; charset=utf-8",
- "Date": "Thu, 13 May 2021 22:40:37 GMT",
+ "Date": "Wed, 16 Jun 2021 23:47:23 GMT",
"Expires": "-1",
"Pragma": "no-cache",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
"X-Content-Type-Options": "nosniff",
- "x-ms-correlation-request-id": "ee93f15c-1051-4943-8490-1dee1ccd257e",
+ "x-ms-correlation-request-id": "a19df4d9-efba-456d-a357-c44dab0b0cf5",
"x-ms-ratelimit-remaining-subscription-reads": "11998",
- "x-ms-request-id": "ee93f15c-1051-4943-8490-1dee1ccd257e",
- "x-ms-routing-request-id": "WESTUS2:20210513T224038Z:ee93f15c-1051-4943-8490-1dee1ccd257e"
+ "x-ms-request-id": "a19df4d9-efba-456d-a357-c44dab0b0cf5",
+ "x-ms-routing-request-id": "WESTUS2:20210616T234723Z:a19df4d9-efba-456d-a357-c44dab0b0cf5"
},
"ResponseBody": {
"id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c",
"authorizationSource": "RoleBased",
"managedByTenants": [],
+ "tags": {
+ "tagKey1": "tagValue1",
+ "tagKey2": "tagValue2"
+ },
"subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c",
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
"displayName": "Azure SDK sandbox",
@@ -91,7 +99,7 @@
"Authorization": "Sanitized",
"Content-Length": "41",
"Content-Type": "application/json",
- "User-Agent": "azsdk-net-ResourceManager.Resources/1.0.0-preview.2 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
+ "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210616.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
"x-ms-client-request-id": "1de8ca6ff16afc375aa8a238b9711bfb",
"x-ms-return-client-request-id": "true"
},
@@ -104,15 +112,15 @@
"Cache-Control": "no-cache",
"Content-Length": "237",
"Content-Type": "application/json; charset=utf-8",
- "Date": "Thu, 13 May 2021 22:40:40 GMT",
+ "Date": "Wed, 16 Jun 2021 23:47:24 GMT",
"Expires": "-1",
"Pragma": "no-cache",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
"X-Content-Type-Options": "nosniff",
- "x-ms-correlation-request-id": "1f554f51-191d-4212-9d9c-0d01fc3104d6",
+ "x-ms-correlation-request-id": "fe7dc5a6-527d-445f-90fc-abd0a469f1db",
"x-ms-ratelimit-remaining-subscription-writes": "1199",
- "x-ms-request-id": "1f554f51-191d-4212-9d9c-0d01fc3104d6",
- "x-ms-routing-request-id": "WESTUS2:20210513T224040Z:1f554f51-191d-4212-9d9c-0d01fc3104d6"
+ "x-ms-request-id": "fe7dc5a6-527d-445f-90fc-abd0a469f1db",
+ "x-ms-routing-request-id": "WESTUS2:20210616T234725Z:fe7dc5a6-527d-445f-90fc-abd0a469f1db"
},
"ResponseBody": {
"id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/testRg-9828",
diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientTests/TestArmClientParamCheck().json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientTests/TestArmClientParamCheck().json
new file mode 100644
index 000000000000..9991dd1a215d
--- /dev/null
+++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientTests/TestArmClientParamCheck().json
@@ -0,0 +1,53 @@
+{
+ "Entries": [
+ {
+ "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c?api-version=2019-11-01",
+ "RequestMethod": "GET",
+ "RequestHeaders": {
+ "Accept": "application/json",
+ "Authorization": "Sanitized",
+ "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210616.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
+ "x-ms-client-request-id": "33c69a93f85bebf3c5f940f97a9e731c",
+ "x-ms-return-client-request-id": "true"
+ },
+ "RequestBody": null,
+ "StatusCode": 200,
+ "ResponseHeaders": {
+ "Cache-Control": "no-cache",
+ "Content-Length": "450",
+ "Content-Type": "application/json; charset=utf-8",
+ "Date": "Wed, 16 Jun 2021 23:46:50 GMT",
+ "Expires": "-1",
+ "Pragma": "no-cache",
+ "Strict-Transport-Security": "max-age=31536000; includeSubDomains",
+ "X-Content-Type-Options": "nosniff",
+ "x-ms-correlation-request-id": "66579fb3-4949-4424-af87-18890782672a",
+ "x-ms-ratelimit-remaining-subscription-reads": "11996",
+ "x-ms-request-id": "66579fb3-4949-4424-af87-18890782672a",
+ "x-ms-routing-request-id": "WESTUS2:20210616T234651Z:66579fb3-4949-4424-af87-18890782672a"
+ },
+ "ResponseBody": {
+ "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c",
+ "authorizationSource": "RoleBased",
+ "managedByTenants": [],
+ "tags": {
+ "tagKey1": "tagValue1",
+ "tagKey2": "tagValue2"
+ },
+ "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c",
+ "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
+ "displayName": "Azure SDK sandbox",
+ "state": "Enabled",
+ "subscriptionPolicies": {
+ "locationPlacementId": "Internal_2014-09-01",
+ "quotaId": "Internal_2014-09-01",
+ "spendingLimit": "Off"
+ }
+ }
+ }
+ ],
+ "Variables": {
+ "RandomSeed": "168997273",
+ "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c"
+ }
+}
\ No newline at end of file
diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientTests/TestArmClientParamCheck()Async.json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientTests/TestArmClientParamCheck()Async.json
new file mode 100644
index 000000000000..53c1eca7c7c6
--- /dev/null
+++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientTests/TestArmClientParamCheck()Async.json
@@ -0,0 +1,53 @@
+{
+ "Entries": [
+ {
+ "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c?api-version=2019-11-01",
+ "RequestMethod": "GET",
+ "RequestHeaders": {
+ "Accept": "application/json",
+ "Authorization": "Sanitized",
+ "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210616.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )",
+ "x-ms-client-request-id": "053e3b04d40dba15c7a3dd5c371ad85e",
+ "x-ms-return-client-request-id": "true"
+ },
+ "RequestBody": null,
+ "StatusCode": 200,
+ "ResponseHeaders": {
+ "Cache-Control": "no-cache",
+ "Content-Length": "450",
+ "Content-Type": "application/json; charset=utf-8",
+ "Date": "Wed, 16 Jun 2021 23:47:25 GMT",
+ "Expires": "-1",
+ "Pragma": "no-cache",
+ "Strict-Transport-Security": "max-age=31536000; includeSubDomains",
+ "X-Content-Type-Options": "nosniff",
+ "x-ms-correlation-request-id": "2179912f-4990-4dbb-b65a-b3023c12d7d5",
+ "x-ms-ratelimit-remaining-subscription-reads": "11996",
+ "x-ms-request-id": "2179912f-4990-4dbb-b65a-b3023c12d7d5",
+ "x-ms-routing-request-id": "WESTUS2:20210616T234725Z:2179912f-4990-4dbb-b65a-b3023c12d7d5"
+ },
+ "ResponseBody": {
+ "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c",
+ "authorizationSource": "RoleBased",
+ "managedByTenants": [],
+ "tags": {
+ "tagKey1": "tagValue1",
+ "tagKey2": "tagValue2"
+ },
+ "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c",
+ "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
+ "displayName": "Azure SDK sandbox",
+ "state": "Enabled",
+ "subscriptionPolicies": {
+ "locationPlacementId": "Internal_2014-09-01",
+ "quotaId": "Internal_2014-09-01",
+ "spendingLimit": "Off"
+ }
+ }
+ }
+ ],
+ "Variables": {
+ "RandomSeed": "2041229862",
+ "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c"
+ }
+}
\ No newline at end of file
diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ArmClientTests.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ArmClientTests.cs
deleted file mode 100644
index 949baf2be324..000000000000
--- a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ArmClientTests.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using System;
-using NUnit.Framework;
-
-namespace Azure.ResourceManager.Core.Tests
-{
- [Parallelizable]
- public class ArmClientTests
- {
- [TestCase]
- public void CreateResourceFromId()
- {
- //TODO: 4622 needs complete with a Mocked example to fill in this test
- //public ArmResponse CreateResource(string subscription, string resourceGroup, string name, TResource model, azure_proto_core.Location location = default)
- Assert.Ignore();
- }
-
- [TestCase]
- public void TestArmClientParamCheck()
- {
- Assert.Throws(() => { new ArmClient(null, null); });
- Assert.Throws(() => { new ArmClient(baseUri:null, null, null); });
- Assert.Throws(() => { new ArmClient(defaultSubscriptionId: null, null, null); });
- }
- }
-}