-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Dispose Requests on JobPool.Dispose()
- Loading branch information
Showing
5 changed files
with
83 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using FakeItEasy; | ||
using Sally7.RequestExecutor; | ||
|
||
namespace Sally7.Tests.RequestExecutor; | ||
|
||
public class RequestTests | ||
{ | ||
[Fact] | ||
public void Completes_On_Dispose() | ||
{ | ||
// Arrange | ||
var sut = new Request(); | ||
var callback = A.Fake<Action>(); | ||
sut.OnCompleted(callback); | ||
|
||
// Act | ||
sut.Dispose(); | ||
|
||
// Assert | ||
A.CallTo(() => callback.Invoke()).MustHaveHappenedOnceExactly(); | ||
} | ||
|
||
[Fact] | ||
public async Task Throws_When_Awaited_After_Dispose() | ||
{ | ||
// Arrange | ||
var sut = new Request(); | ||
|
||
// Act | ||
sut.Dispose(); | ||
|
||
// Assert | ||
await Should.ThrowAsync<ObjectDisposedException>(async () => await sut); | ||
} | ||
} |
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