Skip to content
This repository has been archived by the owner on Dec 19, 2018. It is now read-only.

Commit

Permalink
#329 Change IServerInformation to IFeatureCollection.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tratcher committed Aug 31, 2015
1 parent adae42b commit 25b5a42
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Microsoft.AspNet.Hosting.Server
{
public interface IServerFactory
{
IServerInformation Initialize(IConfiguration configuration);
IDisposable Start(IServerInformation serverInformation, Func<IFeatureCollection, Task> application);
IFeatureCollection Initialize(IConfiguration configuration);
IDisposable Start(IFeatureCollection serverFeatures, Func<IFeatureCollection, Task> application);
}
}

This file was deleted.

2 changes: 1 addition & 1 deletion src/Microsoft.AspNet.Hosting/Internal/HostingEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class HostingEngine : IHostingEngine
// Only one of these should be set
internal IServerFactory ServerFactory { get; set; }
internal string ServerFactoryLocation { get; set; }
private IServerInformation _serverInstance;
private IFeatureCollection _serverInstance;

public HostingEngine(
[NotNull] IServiceCollection appServices,
Expand Down
19 changes: 3 additions & 16 deletions src/Microsoft.AspNet.TestHost/TestServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class TestServer : IServerFactory, IDisposable
{
private const string DefaultEnvironmentName = "Development";
private const string ServerName = nameof(TestServer);
private static readonly ServerInformation ServerInfo = new ServerInformation();
private static readonly IFeatureCollection ServerInfo = new FeatureCollection();
private Func<IFeatureCollection, Task> _appDelegate;
private IDisposable _appInstance;
private bool _disposed = false;
Expand Down Expand Up @@ -107,18 +107,13 @@ public RequestBuilder CreateRequest(string path)
return new RequestBuilder(this, path);
}

public IServerInformation Initialize(IConfiguration configuration)
public IFeatureCollection Initialize(IConfiguration configuration)
{
return ServerInfo;
}

public IDisposable Start(IServerInformation serverInformation, Func<IFeatureCollection, Task> application)
public IDisposable Start(IFeatureCollection serverInformation, Func<IFeatureCollection, Task> application)
{
if (!(serverInformation.GetType() == typeof(ServerInformation)))
{
throw new ArgumentException(string.Format("The server must be {0}", ServerName), "serverInformation");
}

_appDelegate = application;

return this;
Expand All @@ -138,13 +133,5 @@ public void Dispose()
_disposed = true;
_appInstance.Dispose();
}

private class ServerInformation : IServerInformation
{
public string Name
{
get { return ServerName; }
}
}
}
}
4 changes: 2 additions & 2 deletions test/Microsoft.AspNet.Hosting.Tests/HostingEngineTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -368,12 +368,12 @@ private WebHostBuilder CreateBuilder(IConfiguration config = null)
config ?? new ConfigurationBuilder().Build());
}

public IServerInformation Initialize(IConfiguration configuration)
public IFeatureCollection Initialize(IConfiguration configuration)
{
return null;
}

public IDisposable Start(IServerInformation serverInformation, Func<IFeatureCollection, Task> application)
public IDisposable Start(IFeatureCollection serverFeatures, Func<IFeatureCollection, Task> application)
{
var startInstance = new StartInstance(application);
_startInstances.Add(startInstance);
Expand Down

0 comments on commit 25b5a42

Please sign in to comment.