Skip to content

Commit

Permalink
chore: improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
bmazzarol committed Jun 23, 2024
1 parent 1c14797 commit 91ab2f9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
3 changes: 3 additions & 0 deletions BunsenBurner.Tests/AaaTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ public async Task Case12()
async () => await Arrange(() => 1).Act(x => x + 2).Assert(x => x > 4 && x < 6)
);
Assert.Equal("x => ((x > 4) AndAlso (x < 6)) is not true for input '3'", exception.Message);
Assert.NotNull(exception.Expression);
Assert.NotNull(exception.Result);
Assert.Null(exception.TestData);
}

[Fact(DisplayName = "Expression based assertions with data work")]
Expand Down
24 changes: 20 additions & 4 deletions BunsenBurner.Tests/ManualDisposalTests.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using System.Diagnostics.CodeAnalysis;
namespace BunsenBurner.Tests;

namespace BunsenBurner.Tests;

[SuppressMessage("Major Code Smell", "S3881:\"IDisposable\" should be implemented correctly")]
sealed class TestDisposable : IDisposable
{
public bool IsDisposed;
Expand All @@ -13,6 +10,17 @@ public void Dispose()
}
}

sealed class TestAsyncDisposable : IAsyncDisposable
{
public bool IsDisposed;

public ValueTask DisposeAsync()
{
IsDisposed = true;
return ValueTask.CompletedTask;
}
}

public static class ManualDisposalTests
{
[Fact(DisplayName = "Disposal is automatic")]
Expand All @@ -30,4 +38,12 @@ public static async Task Case2()
await disposable.Arrange().Act(d => d).Assert(r => !r.IsDisposed).NoDisposal();
Assert.False(disposable.IsDisposed);
}

[Fact(DisplayName = "Async disposal is automatic")]
public static async Task Case3()
{
var disposable = new TestAsyncDisposable();
await disposable.Arrange().Act(d => d).Assert(r => !r.IsDisposed);
Assert.True(disposable.IsDisposed);
}
}

0 comments on commit 91ab2f9

Please sign in to comment.