FindPartialView() 공개 메소드

public FindPartialView ( System.Web.Mvc.ControllerContext controllerContext, string partialViewName, bool useCache ) : System.Web.Mvc.ViewEngineResult
controllerContext System.Web.Mvc.ControllerContext
partialViewName string
useCache bool
리턴 System.Web.Mvc.ViewEngineResult
        public void Should_Forward_FindPartialView_To_Current_ModuleApplication_ViewEngineCollection()
        {
            // Arrange
            var mockEngines = new Mock<ViewEngineCollection>();
            ViewEngineResult result = new ViewEngineResult(new[] {"foo", "bar", "baz"});
            ControllerContext context = Mockery.CreateMockControllerContext();
            string viewName = "Foo";
            mockEngines.Setup(e => e.FindPartialView(context, viewName))
                       .Returns(result);

            SetupMockModuleApplication(context, mockEngines.Object);

            ModuleDelegatingViewEngine viewEngine = new ModuleDelegatingViewEngine();

            // Act
            ViewEngineResult engineResult = viewEngine.FindPartialView(context, viewName, true);

            // Assert
            mockEngines.Verify(e => e.FindPartialView(context, viewName));
            Assert.AreEqual("foo", engineResult.SearchedLocations.ElementAt(0));
            Assert.AreEqual("bar", engineResult.SearchedLocations.ElementAt(1));
            Assert.AreEqual("baz", engineResult.SearchedLocations.ElementAt(2));
        }
        public void Should_Return_Failed_ViewEngineResult_For_FindPartialView_If_No_Current_Module_Application()
        {
            // Arrange
            ModuleDelegatingViewEngine viewEngine = new ModuleDelegatingViewEngine();

            // Act
            ViewEngineResult engineResult = viewEngine.FindPartialView(Mockery.CreateMockControllerContext(), "Foo", true);

            // Assert
            Assert.IsNotNull(engineResult, "Expected that the ViewEngineResult would not be null");
            Assert.IsNull(engineResult.View, "Expected that no view would be returned");
            Assert.AreEqual(0, engineResult.SearchedLocations.Count(), "Expected that no searched locations would be specified");
        }
        public void Should_Track_ViewEngine_View_Pairs_On_FindPartialView_And_Releases_View_Appropriately()
        {
            // Arrange
            var mockEngines = new Mock<ViewEngineCollection>();
            var mockEngine = new Mock<IViewEngine>();
            var mockView = new Mock<IView>();
            ViewEngineResult result = new ViewEngineResult(mockView.Object, mockEngine.Object);
            ControllerContext context = Mockery.CreateMockControllerContext();
            string viewName = "Foo";
            mockEngines.Setup(e => e.FindPartialView(context, viewName))
                       .Returns(result);

            SetupMockModuleApplication(context, mockEngines.Object);

            ModuleDelegatingViewEngine viewEngine = new ModuleDelegatingViewEngine();

            // Act
            ViewEngineResult engineResult = viewEngine.FindPartialView(context, viewName, true);
            viewEngine.ReleaseView(context, engineResult.View);

            // Assert
            mockEngine.Verify(e => e.ReleaseView(context, mockView.Object));
        }