public void ValidateForwardClientCallTrue() { ManagementTestClient client = InstrumentClient(new ManagementTestClient()); TestResource testResource = client.GetTestResource(); Assert.AreEqual("TestResourceProxy", testResource.GetType().Name); Assert.DoesNotThrowAsync(async() => testResource = await testResource.GetForwardsCallTrueAsync()); Assert.AreEqual("TestResourceProxy", testResource.GetType().Name); }
public async Task ValidateWaitOverride(RecordedTestMode mode) { // keep the curent test mode and restore it back when finished, otherwise it will invoke unnecessary clean-up var currentMode = Mode; Mode = mode; try { ManagementTestClient testClient = InstrumentClient(new ManagementTestClient()); TestResource testResource = testClient.GetTestResource(); Stopwatch sw = Stopwatch.StartNew(); testResource = (await testResource.GetLroAsync(WaitUntil.Completed)).Value; sw.Stop(); Assert.AreEqual("TestResourceProxy", testResource.GetType().Name); if (mode == RecordedTestMode.Playback) { Assert.Less(sw.ElapsedMilliseconds, 1000); } else { Assert.That(sw.ElapsedMilliseconds, Is.GreaterThanOrEqualTo(1000).Within(25)); } } finally { Mode = currentMode; } }
public async Task ValidateLroWrapper() { ManagementTestClient client = InstrumentClient(new ManagementTestClient()); TestResource rgOp = client.GetTestResource(); TestResource testResource = await rgOp.LroWrapperAsync(); Assert.AreEqual("TestResourceProxy", testResource.GetType().Name); Assert.AreEqual("success", testResource.Method()); }
public void ValidateForwardClientCallDefault() { ManagementTestClient client = InstrumentClient(new ManagementTestClient()); TestResource testResource = client.GetTestResource(); Assert.AreEqual("TestResourceProxy", testResource.GetType().Name); var ex = Assert.ThrowsAsync <InvalidOperationException>(async() => testResource = await testResource.GetForwardsCallDefaultAsync()); Assert.AreEqual(ex.Message, "Expected some diagnostic scopes to be created, found none"); }
public void ValidateForwardClientCallFalse() { ManagementTestClient client = InstrumentClient(new ManagementTestClient()); TestResource testResource = client.GetTestResource(); Assert.AreEqual("TestResourceProxy", testResource.GetType().Name); var ex = Assert.ThrowsAsync <InvalidOperationException>(async() => testResource = await testResource.GetForwardsCallFalseAsync()); StringAssert.Contains("Expected some diagnostic scopes to be created other than the Azure.Core scopes", ex.Message); }
public async Task ValidateStartLroWrapper() { ManagementTestClient client = InstrumentClient(new ManagementTestClient()); TestResource rgOp = client.GetTestResource(); var testResourceOp = await rgOp.StartLroWrapperAsync(WaitUntil.Completed); TestResource testResource = await testResourceOp.WaitForCompletionAsync(); Assert.AreEqual("TestResourceProxy", testResource.GetType().Name); Assert.AreEqual("success", testResource.Method()); }
public async Task ValidateWaitForCompletion() { ManagementTestClient client = InstrumentClient(new ManagementTestClient()); TestResourceOperations rgOp = client.GetTestResourceOperations(); var testResourceOp = await rgOp.GetArmOperationAsync(); TestResource testResource = await testResourceOp.WaitForCompletionAsync(); Assert.AreEqual("TestResourceProxy", testResource.GetType().Name); Assert.AreEqual("success", testResource.Method()); }