Reputation: 633
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 used this code to start a host in order to make tests but it throws not implemented exception.
Upvotes: 3
Views: 90
Reputation: 143284
Calling IAppHost.Start(baseUrl)
is only for Self-Hosting AppHost's which launch a server to listen for requests at the specified BaseUrl. BasicAppHost
is just an In Memory AppHost you can use for Unit tests so you only need to call Init()
as it doesn't launch anything.
If you're instead looking to create an Integration Test then you should inherit from AppSelfHostBase
instead.
Upvotes: 3