从测试库启动集成测试主机抛出未实现的异常

Start host for integration test from test base throws not implemented exeption

public class IntegrationTestBase : IDisposable
{
    protected readonly ServiceStackHost appHost;

    public const string BaseUri = "http://localhost:5000/";

    public IntegrationTestBase()
    {
        Licensing.RegisterLicense(
            "license key");
        appHost = new BasicAppHost(typeof(AppHost).GetAssembly())
            {
                ConfigureContainer = container =>
                {
                    //Add your IoC dependencies here
                }
            }
            .Init()
            .Start(BaseUri);
    }

    public void Dispose()
    {
        appHost.Dispose();
    }
}

我需要编写集成测试并使用此代码启动主机以进行测试,但它抛出未实现的异常。

调用 IAppHost.Start(baseUrl) 仅适用于启动服务器以侦听指定 BaseUrl 请求的自托管 AppHost。 BasicAppHost 只是一个可用于单元测试的 In Memory AppHost,因此您只需调用 Init(),因为它不会启动任何东西。

如果您正在寻找 create an Integration Test,那么您应该继承 AppSelfHostBase