Newer
Older
percord / extra / admin-api / Tests / Spacebar.Tests / Extensions / TestBedFixtureExtensions.cs
@Rory& Rory& on 9 Jun 386 bytes Clean up tests a little
using Xunit.Microsoft.DependencyInjection.Abstracts;

namespace Spacebar.Tests.Extensions;

public static class TestBedFixtureExtensions {
    extension(TestBedFixture tbf) {
        public T GetRequiredService<T>(ITestOutputHelper toh) {
            return tbf.GetService<T>(toh) ?? throw new InvalidOperationException($"Failed to get service: {typeof(T).FullName}");
        }
    }
}