-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update test classes to use new pattern
- Loading branch information
Showing
3 changed files
with
59 additions
and
36 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
30 changes: 28 additions & 2 deletions
30
sdk/core/Azure.Core/tests/TestClients/PhArmOperationTest.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 |
---|---|---|
@@ -1,17 +1,43 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Azure.ResourceManager.Core; | ||
|
||
namespace Azure.Core.Tests | ||
{ | ||
public class PhArmOperationTest<T> : ArmOperationTest<T> | ||
public class PhArmOperationTest<T> : ArmOperation<T> | ||
where T : class | ||
{ | ||
private OperationOrResponseInternals<T> _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) : base(value) | ||
public PhArmOperationTest(T value) | ||
{ | ||
_operationHelper = new OperationOrResponseInternals<T>(Response.FromValue(value, null)); | ||
} | ||
|
||
public override ValueTask<Response<T>> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operationHelper.WaitForCompletionAsync(cancellationToken); | ||
|
||
public override ValueTask<Response<T>> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken) => _operationHelper.WaitForCompletionAsync(pollingInterval, cancellationToken); | ||
|
||
public override Response GetRawResponse() => _operationHelper.GetRawResponse(); | ||
|
||
public override ValueTask<Response> UpdateStatusAsync(CancellationToken cancellationToken = default) => _operationHelper.UpdateStatusAsync(cancellationToken); | ||
|
||
public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operationHelper.UpdateStatus(cancellationToken); | ||
} | ||
} |
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