Launch host for integration test from test base not implemented

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();
    }
}

      

I need to write integration tests and use this code to run the host to run the tests, but it doesn't throw an exception.

+3


source to share


1 answer


The call IAppHost.Start(baseUrl)

is only for the Self-Hosting AppHost, which starts the server to listen for requests in the specified BaseUrl. BasicAppHost

is just AppHost's built-in memory that you can use for unit tests, so you only need to call Init()

as it doesn't run anything.



If you are looking instead to create an integration test , then you should instead inherit from AppSelfHostBase

.

+3


source







All Articles