/*
* Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
* See https://github.com/openiddict/openiddict-core for more information concerning
* the license and the contributors participating to this project.
*/
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using Microsoft.Owin.Testing;
using OpenIddict.Server.FunctionalTests;
namespace OpenIddict.Server.Owin.FunctionalTests
{
///
/// Represents a test host used by the server integration tests.
///
public class OpenIddictServerOwinIntegrationTestServer : OpenIddictServerIntegrationTestServer
{
public OpenIddictServerOwinIntegrationTestServer(TestServer server)
=> Server = server;
///
/// Gets the ASP.NET Core test server used by this instance.
///
public TestServer Server { get; }
[SuppressMessage("Reliability", "CA2000:Dispose objects before losing scope",
Justification = "The caller is responsible of disposing the test client.")]
public override ValueTask CreateClientAsync()
=> new ValueTask(
new OpenIddictServerIntegrationTestClient(Server.HttpClient));
public override ValueTask DisposeAsync()
{
// Dispose of the underlying test server.
Server.Dispose();
return default;
}
}
}