public void Should_invoke_intialize_on_engine_with_view_cache_set_on_context()
        {
            // Given
            var engines = new[] { A.Fake<IViewEngine>() };
            var startup = new ViewEngineApplicationStartup(engines, this.viewCache, this.viewLocator);

            // When
            startup.Initialize(null);

            // Then
            A.CallTo(() => engines[0].Initialize(A<ViewEngineStartupContext>.That.Matches(x => x.ViewCache.Equals(this.viewCache)))).MustHaveHappened();
        }
        public void Should_invoke_initialize_on_each_view_engine()
        {
            // Given
            var engines = new[] { A.Fake<IViewEngine>(), A.Fake<IViewEngine>() };
            var startup = new ViewEngineApplicationStartup(engines, this.viewCache, this.viewLocator);

            // When
            startup.Initialize(null);

            // Then
            A.CallTo(() => engines[0].Initialize(A<ViewEngineStartupContext>.Ignored)).MustHaveHappened();
            A.CallTo(() => engines[1].Initialize(A<ViewEngineStartupContext>.Ignored)).MustHaveHappened();
        }
Esempio n. 3
0
        public void Should_invoke_initialize_on_engine_with_matching_view_locations_set_on_context()
        {
            // Given
            var engines = new[] { A.Fake<IViewEngine>() };
            A.CallTo(() => engines[0].Extensions).Returns(new[] { "html", "spark" });

            this.views = new List<ViewLocationResult>
            {
                new ViewLocationResult("", "", "html", null),
                new ViewLocationResult("", "", "spark", null),
            };

            var startup = new ViewEngineApplicationStartup(engines, this.viewLocationCache, this.viewCache);

            // When
            startup.Initialize(null);

            // Then
            A.CallTo(() => engines[0].Initialize(A<ViewEngineStartupContext>.That.Matches(x => x.ViewLocationResults.Count().Equals(2)))).MustHaveHappened();
        }