예제 #1
0
        public void LoadWithWrongAssemblyOrType_ReturnsNull(string data)
        {
            ServerFactoryLoader   loader        = new ServerFactoryLoader(new ServerFactoryActivator(ServicesFactory.Create()));
            IServerFactoryAdapter serverFactory = loader.Load(data);

            Assert.Null(serverFactory);
        }
예제 #2
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"]);
        }
예제 #3
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]);
        }