summary refs log tree commit diff
path: root/extra/admin-api/Tests/Spacebar.Tests/Extensions/TestBedFixtureExtensions.cs
blob: 53113f975000ed540de70f9f31804de3358d13c0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
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}");
        }
    }
}