public void LoadWithAssemblyName_DiscoverDefaultFactoryName() { ServerFactoryLoader loader = new ServerFactoryLoader(new ServerFactoryActivator(ServicesFactory.Create())); IServerFactoryAdapter serverFactory = loader.Load("Microsoft.Owin.Hosting.Tests"); Assert.NotNull(serverFactory); IAppBuilder builder = new AppBuilder(); serverFactory.Create(builder); Assert.Equal("Microsoft.Owin.Hosting.Tests.ServerFactory", builder.Properties["create.server"]); }
public void LoadWithAssemblyAndFullTypeName_Success(string data, string expected) { ServerFactoryLoader loader = new ServerFactoryLoader(new ServerFactoryActivator(ServicesFactory.Create())); IServerFactoryAdapter serverFactory = loader.Load(data); Assert.NotNull(serverFactory); IAppBuilder builder = new AppBuilder(); serverFactory.Create(builder); Assert.Equal(expected, builder.Properties["create.server"]); }
public void LoadWithDefaults_LoadAssemblyAndDiscoverFactory(string data) { var loader = new ServerFactoryLoader(new ServerFactoryActivator(ServicesFactory.Create())); IServerFactoryAdapter serverFactory = loader.Load(data); Assert.NotNull(serverFactory); IAppBuilder builder = new AppBuilder(); serverFactory.Initialize(builder); Assert.IsType<OwinHttpListener>(builder.Properties[typeof(OwinHttpListener).FullName]); }
public void LoadWithWrongAssemblyOrType_ReturnsNull(string data) { ServerFactoryLoader loader = new ServerFactoryLoader(new ServerFactoryActivator(ServicesFactory.Create())); IServerFactoryAdapter serverFactory = loader.Load(data); Assert.Null(serverFactory); }