about summary refs log tree commit diff
path: root/Tests/LibMatrix.Tests/Fixtures
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/LibMatrix.Tests/Fixtures')
-rw-r--r--Tests/LibMatrix.Tests/Fixtures/TestFixture.cs37
1 files changed, 37 insertions, 0 deletions
diff --git a/Tests/LibMatrix.Tests/Fixtures/TestFixture.cs b/Tests/LibMatrix.Tests/Fixtures/TestFixture.cs
new file mode 100644
index 0000000..ef49b3e
--- /dev/null
+++ b/Tests/LibMatrix.Tests/Fixtures/TestFixture.cs
@@ -0,0 +1,37 @@
+using ArcaneLibs.Extensions;
+using LibMatrix.Services;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+using Xunit.Microsoft.DependencyInjection;
+using Xunit.Microsoft.DependencyInjection.Abstracts;
+
+namespace LibMatrix.Tests.Fixtures;
+
+public class TestFixture : TestBedFixture {
+    protected override void AddServices(IServiceCollection services, IConfiguration? configuration) {
+        services.AddSingleton<TieredStorageService>(x =>
+            new TieredStorageService(
+                cacheStorageProvider: null,
+                dataStorageProvider: null
+            )
+        );
+
+        services.AddRoryLibMatrixServices();
+
+        services.AddSingleton<Config>(config => {
+            var conf = new Config();
+            configuration?.GetSection("Configuration").Bind(conf);
+
+            File.WriteAllText("configuration.json", conf.ToJson());
+
+            return conf;
+        });
+    }
+
+    protected override ValueTask DisposeAsyncCore()
+        => new();
+
+    protected override IEnumerable<TestAppSettings> GetTestAppSettings() {
+        yield return new TestAppSettings { Filename = "appsettings.json", IsOptional = true };
+    }
+}