baseline: 小军 WMS 二开代码原始快照(含 SynOABusiness.cs Debugger.Break)
This commit is contained in:
commit
c2b0e7be0d
6522 files changed
+3530643
No files matched your search
Executable
+32
@@ -0,0 +1,32 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.Test
|
||||
{
|
||||
[Xunit.Collection("TestCollection")]
|
||||
public class TestBase
|
||||
{
|
||||
protected readonly IServiceProvider ServiceProvider;
|
||||
protected readonly IConfiguration Configuration;
|
||||
|
||||
public TestBase(TestStartupFixture fixture)
|
||||
{
|
||||
ServiceProvider = fixture.Services;
|
||||
|
||||
this.Configuration = ServiceProvider.GetService<IConfiguration>();
|
||||
}
|
||||
|
||||
protected virtual T GetConfigSection<T>(string key)
|
||||
{
|
||||
var targetSection = Configuration.GetSection(key);
|
||||
targetSection = targetSection ?? throw new ArgumentException($"Not Exists Config Key: {key}");
|
||||
return targetSection.Get<T>();
|
||||
}
|
||||
|
||||
protected virtual T GetService<T>()
|
||||
{
|
||||
return ServiceProvider.GetService<T>();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user