コード例 #1
0
        public void ExecuteController_Removes_ParentActionViewContext_From_DataTokens_Before_Returning_When_ParentActionViewContext_Is_Null()
        {
            // Arrange
            Setup();
            var sut = new TestAreaControllerRunner(pageContextMock.Object, routeDataMock.Object, viewContextProviderMock.Object, areaData);

            // Act
            sut.TestExecuteController(triangulationController);

            // Assert
            Assert.IsFalse(routeData.DataTokens.ContainsKey(Constants.Mvc.ParentActionViewContext));
        }
        public void ExecuteController_Removes_ParentActionViewContext_From_DataTokens_Before_Returning_When_ParentActionViewContext_Is_Null()
        {
            // Arrange
            Setup();
            var sut = new TestAreaControllerRunner(pageContextMock.Object, routeDataMock.Object, viewContextProviderMock.Object, areaData);

            // Act
            sut.TestExecuteController(triangulationController);

            // Assert
            Assert.IsFalse(routeData.DataTokens.ContainsKey(Constants.Mvc.ParentActionViewContext));
        }
コード例 #3
0
        public void ExecuteController_Sets_ParentActionViewContext_When_UseChildActionBehavior_Is_True()
        {
            // Arrange
            Setup();
            var sut = new TestAreaControllerRunner(pageContextMock.Object, routeDataMock.Object, viewContextProviderMock.Object, areaData);

            // Act
            sut.TestExecuteController(triangulationController);

            // Assert
            Assert.IsTrue(triangulationController.IsChildAction);
        }
        public void ExecuteController_Sets_ParentActionViewContext_When_UseChildActionBehavior_Is_False()
        {
            // Arrange
            Setup();
            areaData.UseChildActionBehavior = false;
            var sut = new TestAreaControllerRunner(pageContextMock.Object, routeDataMock.Object, viewContextProviderMock.Object, areaData);

            // Act
            sut.TestExecuteController(triangulationController);

            // Assert
            Assert.IsFalse(triangulationController.IsChildAction);
        }
        public void ExecuteController_Reinstantes_ParentActionViewContext_In_DataTokens_Before_Returning_When_ParentActionViewContext_Is_Not_Null()
        {
            // Arrange
            Setup();
            var providedViewContext = new ViewContext();
            var parentViewContext = new ViewContext();
            routeData.DataTokens.Add(Constants.Mvc.ParentActionViewContext, parentViewContext);
            viewContextProviderMock
                .Setup(p => p.GetCurrentViewContext())
                .Returns(providedViewContext);
            var sut = new TestAreaControllerRunner(pageContextMock.Object, routeDataMock.Object, viewContextProviderMock.Object, areaData);

            // Act
            sut.TestExecuteController(triangulationController);

            // Assert
            Assert.AreSame(routeData.DataTokens[Constants.Mvc.ParentActionViewContext], parentViewContext);
        }
コード例 #6
0
        public void ExecuteController_Uses__ViewContext_From_Provider_When_Setting_Up_ParentActionViewContext()
        {
            // Arrange
            Setup();
            var providedViewContext = new ViewContext();
            var parentViewContext   = new ViewContext();

            routeData.DataTokens.Add(Constants.Mvc.ParentActionViewContext, parentViewContext);
            viewContextProviderMock
            .Setup(p => p.GetCurrentViewContext())
            .Returns(providedViewContext);
            var sut = new TestAreaControllerRunner(pageContextMock.Object, routeDataMock.Object, viewContextProviderMock.Object, areaData);

            // Act
            sut.TestExecuteController(triangulationController);

            // Assert
            Assert.AreSame(triangulationController.ParentActionViewContext, providedViewContext);
        }
コード例 #7
0
        public void ExecuteController_Reinstantes_ParentActionViewContext_In_DataTokens_Before_Returning_When_ParentActionViewContext_Is_Not_Null()
        {
            // Arrange
            Setup();
            var providedViewContext = new ViewContext();
            var parentViewContext   = new ViewContext();

            routeData.DataTokens.Add(Constants.Mvc.ParentActionViewContext, parentViewContext);
            viewContextProviderMock
            .Setup(p => p.GetCurrentViewContext())
            .Returns(providedViewContext);
            var sut = new TestAreaControllerRunner(pageContextMock.Object, routeDataMock.Object, viewContextProviderMock.Object, areaData);

            // Act
            sut.TestExecuteController(triangulationController);

            // Assert
            Assert.AreSame(routeData.DataTokens[Constants.Mvc.ParentActionViewContext], parentViewContext);
        }
        public void ExecuteController_Uses__ViewContext_From_Provider_When_Setting_Up_ParentActionViewContext()
        {
            // Arrange
            Setup();
            var providedViewContext = new ViewContext();
            var parentViewContext = new ViewContext();
            routeData.DataTokens.Add(Constants.Mvc.ParentActionViewContext, parentViewContext);
            viewContextProviderMock
                .Setup(p => p.GetCurrentViewContext())
                .Returns(providedViewContext);
            var sut = new TestAreaControllerRunner(pageContextMock.Object, routeDataMock.Object, viewContextProviderMock.Object, areaData);

            // Act
            sut.TestExecuteController(triangulationController);

            // Assert
            Assert.AreSame(triangulationController.ParentActionViewContext, providedViewContext);
        }