Example #1
0
        private static TestBootstrapper CreateBootstrapper()
        {
            var bootstrapper = new TestBootstrapper();

            bootstrapper.Initialise();
            bootstrapper.GetEngine();
            return(bootstrapper);
        }
Example #2
0
        public void GetModule_WithNancyContextDependency_ReturnsModuleWithDependency()
        {
            var bootstrapper = new TestBootstrapper();

            var browser = new Browser(bootstrapper);

            browser.Get("/");
        }
Example #3
0
        public void GetEngine_RegistersRequestStartup()
        {
            var bootstrapper = new TestBootstrapper();

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

            engine.HandleRequest(new Request("Post", "Sample", "http"));
        }
Example #4
0
        public void GetEngine_ReturnsEngine()
        {
            var bootstrapper = new TestBootstrapper();

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

            Assert.IsNotNull(engine);
        }
Example #5
0
        public void GetAllModules_ReturnsModules()
        {
            var bootstrapper = new TestBootstrapper();

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

            Assert.IsTrue(modules.Any());
        }
Example #6
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));
        }
Example #7
0
        public void Ping_ShouldInvokeRequestStartup()
        {
            var bootstrapper = new TestBootstrapper();

            var browser = new Browser(bootstrapper);

            var response = browser.Get("/ping");

            Assert.True(response.StatusCode == HttpStatusCode.OK);
        }
Example #8
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));
        }
Example #9
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);
        }