Beispiel #1
0
        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;
            }
        }
Beispiel #2
0
        public async Task ValidateExceptionOperationWaitForCompletion()
        {
            ManagementTestClient client = InstrumentClient(new ManagementTestClient());
            TestResource         rgOp   = client.GetTestResource();
            var testResourceOp          = await rgOp.GetLroAsync(WaitUntil.Completed, true);

            Assert.ThrowsAsync(typeof(ArgumentException), async() => await testResourceOp.WaitForCompletionAsync());
        }
Beispiel #3
0
        public async Task ValidateWaitForCompletion()
        {
            ManagementTestClient client = InstrumentClient(new ManagementTestClient());
            TestResource         rgOp   = client.GetTestResource();
            var testResourceOp          = await rgOp.GetLroAsync(WaitUntil.Completed);

            TestResource testResource = await testResourceOp.WaitForCompletionAsync();

            Assert.AreEqual("TestResourceProxy", testResource.GetType().Name);
            Assert.AreEqual("success", testResource.Method());
        }