Exemplo n.º 1
0
 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"]);
 }
Exemplo n.º 2
0
 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]);
 }
Exemplo n.º 4
0
 public void LoadWithWrongAssemblyOrType_ReturnsNull(string data)
 {
     ServerFactoryLoader loader = new ServerFactoryLoader(new ServerFactoryActivator(ServicesFactory.Create()));
     IServerFactoryAdapter serverFactory = loader.Load(data);
     Assert.Null(serverFactory);
 }