-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: fix brittle
EventTests
(#599)
The `FileSystemWatcher.EventTests` sometimes fail, due to race-condition. Therefore make the following changes: - Continually make the triggering changes in a background task, until the `CancellationToken` is cancelled at the end of the test - Add and listen to separate triggers for when the triggering change was made and when the change was detected in the callback - Make tests synchronous - Add class `TestBase` with common timeout settings and use them throughout the Testably.Abstractions.Tests project.
- Loading branch information
Showing
17 changed files
with
136 additions
and
97 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
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
22 changes: 22 additions & 0 deletions
22
Tests/Helpers/Testably.Abstractions.TestHelpers/TestBase.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 @@ | ||
namespace Testably.Abstractions.TestHelpers; | ||
|
||
/// <summary> | ||
/// Base class for generated tests. | ||
/// </summary> | ||
public abstract class TestBase | ||
{ | ||
/// <summary> | ||
/// The delay in milliseconds when wanting to ensure a timeout in the test. | ||
/// </summary> | ||
public const int EnsureTimeout = 500; | ||
|
||
/// <summary> | ||
/// The delay in milliseconds when expecting a success in the test. | ||
/// </summary> | ||
public const int ExpectSuccess = 30000; | ||
|
||
/// <summary> | ||
/// The delay in milliseconds when expecting a timeout in the test. | ||
/// </summary> | ||
public const int ExpectTimeout = 30; | ||
} |
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
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
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
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
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
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
Oops, something went wrong.