public void CloseForData_NestedViewCorrespondingToRemovedFailureMechanismContext_ReturnsTrue() { // Setup var assessmentSection = mocks.Stub <IAssessmentSection>(); mocks.ReplayAll(); var calculation = new MacroStabilityInwardsCalculationScenario(); var calculationGroup = new CalculationGroup(); calculationGroup.Children.Add(calculation); var failureMechanism = new MacroStabilityInwardsFailureMechanism(); failureMechanism.CalculationsGroup.Children.Add(calculationGroup); var context = new MacroStabilityInwardsFailureMechanismContext(failureMechanism, assessmentSection); using (var view = new MacroStabilityInwardsInputView(calculation, new GeneralMacroStabilityInwardsInput(), assessmentSection, GetHydraulicBoundaryLocationCalculation)) { // Call bool closeForData = info.CloseForData(view, context); // Assert Assert.IsTrue(closeForData); mocks.VerifyAll(); } }
public void CloseForData_NestedViewNotCorrespondingToRemovedAssessmentSection_ReturnsFalse() { // Setup var calculation = new MacroStabilityInwardsCalculationScenario(); var calculationGroup = new CalculationGroup(); calculationGroup.Children.Add(calculation); var failureMechanism = new MacroStabilityInwardsFailureMechanism(); failureMechanism.CalculationsGroup.Children.Add(calculationGroup); var assessmentSection = mocks.Stub <IAssessmentSection>(); assessmentSection.Stub(section => section.FailureMechanismContribution).Return(null); assessmentSection.Stub(section => section.GetFailureMechanisms()).Return(new[] { failureMechanism }); mocks.ReplayAll(); using (var view = new MacroStabilityInwardsInputView(new MacroStabilityInwardsCalculationScenario(), new GeneralMacroStabilityInwardsInput(), assessmentSection, GetHydraulicBoundaryLocationCalculation)) { // Call bool closeForData = info.CloseForData(view, assessmentSection); // Assert Assert.IsFalse(closeForData); mocks.VerifyAll(); } }
public void CloseForData_NestedViewNotCorrespondingWithRemovedParentCalculationGroupContext_ReturnsFalse() { // Setup var assessmentSection = mocks.Stub <IAssessmentSection>(); mocks.ReplayAll(); var calculation = new MacroStabilityInwardsCalculationScenario(); var nestedGroup = new CalculationGroup(); nestedGroup.Children.Add(calculation); var calculationGroup = new CalculationGroup(); calculationGroup.Children.Add(nestedGroup); var calculationGroupContext = new MacroStabilityInwardsCalculationGroupContext(new CalculationGroup(), null, Enumerable.Empty <MacroStabilityInwardsSurfaceLine>(), Enumerable.Empty <MacroStabilityInwardsStochasticSoilModel>(), new MacroStabilityInwardsFailureMechanism(), assessmentSection); using (var view = new MacroStabilityInwardsInputView(calculation, new GeneralMacroStabilityInwardsInput(), assessmentSection, GetHydraulicBoundaryLocationCalculation)) { // Call bool closeForData = info.CloseForData(view, calculationGroupContext); // Assert Assert.IsFalse(closeForData); mocks.VerifyAll(); } }