コード例 #1
0
        public void Should_call_view_resolver_with_view_name_when_locating_view()
        {
            // Given
            const string viewName = "view.html";
            var resolver = A.Fake<IViewResolver>();
            var context = new DefaultRenderContext(resolver, null, null);

            // When
            context.LocateView(viewName, null);

            // Then
            A.CallTo(() => resolver.GetViewLocation(viewName, A<object>.Ignored, A<ViewLocationContext>.Ignored)).MustHaveHappened();
        }
コード例 #2
0
        public void Should_call_view_resolver_with_view_location_context_when_locating_view()
        {
            // Given
            var locationContext = new ViewLocationContext();
            var resolver = A.Fake<IViewResolver>();
            var context = new DefaultRenderContext(resolver, null, locationContext);

            // When
            context.LocateView(null, null);

            // Then)
            A.CallTo(() => resolver.GetViewLocation(A<string>.Ignored, A<object>.Ignored, locationContext)).MustHaveHappened();
        }
コード例 #3
0
        public void Should_call_view_resolver_with_model_when_locating_view()
        {
            // Given
            var model = new object();
            var resolver = A.Fake<IViewResolver>();
            var context = new DefaultRenderContext(resolver, null, null, this.GetContext());

            // When
            context.LocateView(null, model);

            // Then
            A.CallTo(() => resolver.GetViewLocation(A<string>.Ignored, model, A<ViewLocationContext>.Ignored)).MustHaveHappened();
        }
コード例 #4
0
        public void Should_return_result_from_view_resolver_when_locating_view()
        {
            // Given
            var viewResult = new ViewLocationResult(null, null, null, null);
            var resolver = A.Fake<IViewResolver>();
            A.CallTo(() => resolver.GetViewLocation(A<string>.Ignored, A<object>.Ignored, A<ViewLocationContext>.Ignored)).Returns(viewResult);
            var context = new DefaultRenderContext(resolver, null, null);

            // When
            var result = context.LocateView(null, null);

            // Then
            result.ShouldBeSameAs(viewResult);
        }