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_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); }
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); }