mirror of
https://github.com/real-zony/ZonyLrcToolsX.git
synced 2025-09-07 06:06:53 +00:00
feat: Reinitialize the Repository.
重新初始化仓库。
This commit is contained in:
33
tests/ZonyLrcTools.Tests/TestBase.cs
Normal file
33
tests/ZonyLrcTools.Tests/TestBase.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using ZonyLrcTools.Cli.Commands;
|
||||
using ZonyLrcTools.Cli.Infrastructure.DependencyInject;
|
||||
using ZonyLrcTools.Cli.Infrastructure.Extensions;
|
||||
|
||||
namespace ZonyLrcTools.Tests
|
||||
{
|
||||
public class TestBase
|
||||
{
|
||||
protected IServiceProvider ServiceProvider { get; private set; }
|
||||
protected IServiceCollection ServiceCollection { get; private set; }
|
||||
|
||||
public TestBase()
|
||||
{
|
||||
ServiceCollection = BuildService();
|
||||
BuildServiceProvider();
|
||||
}
|
||||
|
||||
protected virtual IServiceCollection BuildService()
|
||||
{
|
||||
var service = new ServiceCollection();
|
||||
|
||||
service.BeginAutoDependencyInject<ToolCommand>();
|
||||
service.ConfigureToolService();
|
||||
service.ConfigureConfiguration();
|
||||
|
||||
return service;
|
||||
}
|
||||
|
||||
protected virtual void BuildServiceProvider() => ServiceProvider = ServiceCollection.BuildServiceProvider();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user