コード例 #1
0
        private static TestBootstrapper CreateBootstrapper()
        {
            var bootstrapper = new TestBootstrapper();

            bootstrapper.Initialise();
            bootstrapper.GetEngine();
            return(bootstrapper);
        }
コード例 #2
0
        public void GetEngine_RegistersRequestStartup()
        {
            var bootstrapper = new TestBootstrapper();

            bootstrapper.Initialise();
            var engine = bootstrapper.GetEngine();

            engine.HandleRequest(new Request("Post", "Sample", "http"));
        }
コード例 #3
0
        public void GetEngine_ReturnsEngine()
        {
            var bootstrapper = new TestBootstrapper();

            bootstrapper.Initialise();
            var engine = bootstrapper.GetEngine();

            Assert.IsNotNull(engine);
        }
コード例 #4
0
        public void GetAllModules_ReturnsModules()
        {
            var bootstrapper = new TestBootstrapper();

            bootstrapper.Initialise();
            bootstrapper.GetEngine();
            var modules = bootstrapper.GetAllModules(new NancyContext());

            Assert.IsTrue(modules.Any());
        }
コード例 #5
0
        public void GetModule_ReturnsModule()
        {
            var bootstrapper = new TestBootstrapper();

            bootstrapper.Initialise();
            bootstrapper.GetEngine();
            INancyModule module = bootstrapper.GetModule(typeof(SampleModule), new NancyContext());

            Assert.IsInstanceOfType(module, typeof(SampleModule));
        }
コード例 #6
0
        public void GetModule_PerRequestDependency_ReturnsModule()
        {
            var bootstrapper = new TestBootstrapper();

            bootstrapper.Initialise();
            bootstrapper.GetEngine();
            var module = (SampleModuleWithPerRequestDependency)bootstrapper.GetModule(
                typeof(SampleModuleWithPerRequestDependency),
                new NancyContext());

            Assert.IsInstanceOfType(module.PerRequest, typeof(PerRequest));
        }
コード例 #7
0
        public void GetModule_DisposableTransientDependency_ReturnsModule()
        {
            var bootstrapper = new TestBootstrapper();

            bootstrapper.Initialise();
            bootstrapper.GetEngine();
            var module = (SampleModuleWithDisposableTransientDependency)bootstrapper.GetModule(
                typeof(SampleModuleWithDisposableTransientDependency),
                new NancyContext());

            Assert.IsType(typeof(DisposableTransient), module.Transient);
        }