-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
275f176
commit aeccb48
Showing
4 changed files
with
62 additions
and
12 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
src/TestFramework/TestFramework/Attributes/TestMethod/DelayBackoffType.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,22 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
/// <summary> | ||
/// Specifies a backoff type for the delay between retries. | ||
/// </summary> | ||
public enum DelayBackoffType | ||
{ | ||
/// <summary> | ||
/// Specifies a constant backoff type. Meaning the delay between retries is constant. | ||
/// </summary> | ||
Constant, | ||
|
||
/// <summary> | ||
/// Specifies an exponential backoff type. | ||
/// The delay is calculated as the base delay * 2^(n-1) where n is the retry attempt. | ||
/// For example, if the base delay is 1000ms, the delays will be 1000ms, 2000ms, 4000ms, 8000ms, etc. | ||
/// </summary> | ||
Exponential, | ||
} |
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
15 changes: 15 additions & 0 deletions
15
src/TestFramework/TestFramework/Attributes/TestMethod/RetryResult.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,15 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
public sealed class RetryResult | ||
{ | ||
private readonly List<TestResult[]> _testResults = new(); | ||
|
||
public void AddResult(TestResult[] testResults) | ||
=> _testResults.Add(testResults); | ||
|
||
internal TestResult[]? TryGetLast() | ||
=> _testResults.Count > 0 ? _testResults[_testResults.Count - 1] : null; | ||
} |
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