33 lines
904 B
C#
33 lines
904 B
C#
// Copyright (c) .NET Foundation. All rights reserved.
|
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
|
|
using System;
|
|
using System.Net.Http;
|
|
using Microsoft.AspNet.Hosting;
|
|
using Microsoft.AspNet.TestHost;
|
|
|
|
namespace Microsoft.AspNet.Cors.Infrastructure
|
|
{
|
|
public class CorsTestFixture<TStartup> : IDisposable
|
|
where TStartup : class
|
|
{
|
|
private readonly TestServer _server;
|
|
|
|
public CorsTestFixture()
|
|
{
|
|
var builder = new WebHostBuilder().UseStartup<TStartup>();
|
|
_server = new TestServer(builder);
|
|
|
|
Client = _server.CreateClient();
|
|
Client.BaseAddress = new Uri("http://localhost");
|
|
}
|
|
|
|
public HttpClient Client { get; }
|
|
|
|
public void Dispose()
|
|
{
|
|
Client.Dispose();
|
|
_server.Dispose();
|
|
}
|
|
}
|
|
} |