Example #1
0
        public void Should_execute_the_processor_associated_with_the_extension()
        {
            var application = A.Fake<INancyApplication>();
            var module = new FakeNancyModuleWithoutBasePath { Application = application };
            var action = new Action<Stream>((s) => { });
            var processor = new Func<string, object, Action<Stream>>((a, b) => action);

            A.CallTo(() => application.GetTemplateProcessor(".razor")).Returns(processor);

            module.SmartView("file2.razor").ShouldBeSameAs(action);
        }
Example #2
0
        public void Should_set_modules_property_when_instantiated()
        {
            //Given, When
            Func<dynamic, Response> action = x => null;
            var instance = new FakeNancyModuleWithoutBasePath();

            var route = new Route("/", null, instance, action);

            // Then
            route.Module.ShouldBeSameAs(instance);
        }
Example #3
0
        public void Should_execute_the_default_processor_unregistered_extension()
        {
            var application = A.Fake<ITemplateEngineSelector>();
            var module = new FakeNancyModuleWithoutBasePath {TemplateEngineSelector = application};
            var action = new Action<Stream>((s) => { });
            var processor = new Func<string, object, Action<Stream>>((a, b) => action);

            A.CallTo(() => application.GetTemplateProcessor(".txt")).Returns(null);
            A.CallTo(() => application.DefaultProcessor).Returns(processor);

            module.SmartView("file.txt").ShouldBeSameAs(action);
        }