コード例 #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"]);
 }
コード例 #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"]);
 }
コード例 #3
0
 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]);
 }
コード例 #4
0
 public void LoadWithWrongAssemblyOrType_ReturnsNull(string data)
 {
     ServerFactoryLoader loader = new ServerFactoryLoader(new ServerFactoryActivator(ServicesFactory.Create()));
     IServerFactoryAdapter serverFactory = loader.Load(data);
     Assert.Null(serverFactory);
 }