diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-09-19 00:16:36 +0200 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-09-19 00:16:36 +0200 |
commit | f5447484512d726f4403f0d7725777d0a95601fb (patch) | |
tree | 47fe88a4c021f62ff42663f6d8c5229e71d21813 /Tests/LibMatrix.Tests/Fixtures/TestFixture.cs | |
parent | Improve README (diff) | |
download | LibMatrix-f5447484512d726f4403f0d7725777d0a95601fb.tar.xz |
Add more stuff, add unit tests
Diffstat (limited to '')
-rw-r--r-- | Tests/LibMatrix.Tests/Fixtures/TestFixture.cs | 37 |
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 }; + } +} |