test(theme): verify bUnit 2.7.2 with patched DOM parser
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using Bunit;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Xunit;
|
||||
public sealed class AsyncLifecycleTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task Context_awaits_async_service_disposal()
|
||||
{
|
||||
var context = new BunitContext();
|
||||
context.Services.AddScoped<AsyncResource>();
|
||||
var resource = context.Services.GetRequiredService<AsyncResource>();
|
||||
Assert.False(resource.Disposed);
|
||||
await context.DisposeAsync();
|
||||
Assert.True(resource.Disposed);
|
||||
}
|
||||
public sealed class AsyncResource : IAsyncDisposable
|
||||
{
|
||||
public bool Disposed { get; private set; }
|
||||
public async ValueTask DisposeAsync()
|
||||
{
|
||||
await Task.Yield();
|
||||
Disposed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user