public void Constructor_Always_ExpectedColumnStates() { // Setup var mocks = new MockRepository(); var errorProvider = mocks.Stub <IFailureMechanismSectionResultRowErrorProvider>(); mocks.ReplayAll(); FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); var result = new NonAdoptableWithProfileProbabilityFailureMechanismSectionResult(section); Func <FailureMechanismSectionAssemblyResultWrapper> performAssemblyFunc = FailureMechanismSectionAssemblyResultWrapperTestFactory.Create; // Call var row = new NonAdoptableWithProfileProbabilityFailureMechanismSectionResultRow(result, errorProvider, performAssemblyFunc, ConstructionProperties); // Assert IDictionary <int, DataGridViewColumnStateDefinition> columnStateDefinitions = row.ColumnStateDefinitions; DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState( columnStateDefinitions[ConstructionProperties.ProfileProbabilityIndex], true, true); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState( columnStateDefinitions[ConstructionProperties.SectionProbabilityIndex], true, true); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState( columnStateDefinitions[ConstructionProperties.SectionNIndex], true, true); mocks.VerifyAll(); }
public void ForeshoreProfile_OnChangeToNull_CorrectColumnStates() { // Setup var calculation = new StructuresCalculationScenario <HeightStructuresInput> { InputParameters = { ForeshoreProfile = new TestForeshoreProfile() } }; // Call var row = new HeightStructuresCalculationRow(calculation, new ObservablePropertyChangeHandler(calculation, new HeightStructuresInput())) { ForeshoreProfile = new DataGridViewComboBoxItemWrapper <ForeshoreProfile>(null) }; // Assert IDictionary <int, DataGridViewColumnStateDefinition> columnStateDefinitions = row.ColumnStateDefinitions; DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[useBreakWaterColumnIndex], false); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[breakWaterTypeColumnIndex], false); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[breakWaterHeightColumnIndex], false); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[useForeshoreColumnIndex], false); }
public void Constructor_ForeshoreProfileWithGeometry_CorrectColumnStates(bool useBreakWater) { // Setup var calculation = new StructuresCalculationScenario <HeightStructuresInput> { InputParameters = { ForeshoreProfile = new TestForeshoreProfile(new[] { new Point2D(0.0, 0.0) }), UseBreakWater = useBreakWater } }; // Call var row = new HeightStructuresCalculationRow(calculation, new ObservablePropertyChangeHandler(calculation, new HeightStructuresInput())); // Assert IDictionary <int, DataGridViewColumnStateDefinition> columnStateDefinitions = row.ColumnStateDefinitions; DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[useBreakWaterColumnIndex], true); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[breakWaterTypeColumnIndex], useBreakWater); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[breakWaterHeightColumnIndex], useBreakWater); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[useForeshoreColumnIndex], true); }
public void Constructor_WithFurtherAnalysisType_ExpectedColumnStates(FailureMechanismSectionResultFurtherAnalysisType furtherAnalysisType, bool expectedDisabled) { // Setup var mocks = new MockRepository(); var errorProvider = mocks.Stub <IFailureMechanismSectionResultRowErrorProvider>(); errorProvider.Stub(ep => ep.GetManualProbabilityValidationError(double.NaN)) .IgnoreArguments() .Return(string.Empty); mocks.ReplayAll(); FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); var result = new NonAdoptableWithProfileProbabilityFailureMechanismSectionResult(section) { FurtherAnalysisType = furtherAnalysisType }; Func <FailureMechanismSectionAssemblyResultWrapper> performAssemblyFunc = FailureMechanismSectionAssemblyResultWrapperTestFactory.Create; // Call var row = new NonAdoptableWithProfileProbabilityFailureMechanismSectionResultRow(result, errorProvider, performAssemblyFunc, ConstructionProperties); // Assert IDictionary <int, DataGridViewColumnStateDefinition> columnStateDefinitions = row.ColumnStateDefinitions; DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState( columnStateDefinitions[ConstructionProperties.RefinedProfileProbabilityIndex], expectedDisabled); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState( columnStateDefinitions[ConstructionProperties.RefinedSectionProbabilityIndex], expectedDisabled); mocks.VerifyAll(); }
public void Constructor_Always_ExpectedColumnStates() { // Setup var mocks = new MockRepository(); var errorProvider = mocks.Stub <IFailureMechanismSectionResultRowErrorProvider>(); mocks.ReplayAll(); FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); var result = new NonAdoptableFailureMechanismSectionResult(section); using (new AssemblyToolCalculatorFactoryConfig()) { // Call var row = new NonAdoptableFailureMechanismSectionResultRow(result, errorProvider, new AssessmentSectionStub(), ConstructionProperties); // Assert IDictionary <int, DataGridViewColumnStateDefinition> columnStateDefinitions = row.ColumnStateDefinitions; DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState( columnStateDefinitions[ConstructionProperties.SectionProbabilityIndex], true, true); } mocks.VerifyAll(); }
public void Constructor_WithInitialFailureMechanismResultType_ExpectedColumnStates(NonAdoptableInitialFailureMechanismResultType initialFailureMechanismResultType, bool isEnabled, bool isReadOnly) { // Setup var mocks = new MockRepository(); var errorProvider = mocks.Stub <IFailureMechanismSectionResultRowErrorProvider>(); errorProvider.Stub(ep => ep.GetManualProbabilityValidationError(double.NaN)) .IgnoreArguments() .Return(string.Empty); mocks.ReplayAll(); FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); var result = new NonAdoptableFailureMechanismSectionResult(section) { InitialFailureMechanismResultType = initialFailureMechanismResultType }; using (new AssemblyToolCalculatorFactoryConfig()) { // Call var row = new NonAdoptableFailureMechanismSectionResultRow(result, errorProvider, new AssessmentSectionStub(), ConstructionProperties); // Assert IDictionary <int, DataGridViewColumnStateDefinition> columnStateDefinitions = row.ColumnStateDefinitions; DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState( columnStateDefinitions[ConstructionProperties.InitialFailureMechanismResultSectionProbabilityIndex], isEnabled, isReadOnly); } mocks.VerifyAll(); }
public void LoadSchematizationType_AlwaysOnChange_CorrectColumnStates(LoadSchematizationType loadSchematizationType) { // Setup var calculation = new StructuresCalculationScenario <StabilityPointStructuresInput> { InputParameters = { LoadSchematizationType = 0 } }; // Call var row = new StabilityPointStructuresCalculationRow(calculation, new ObservablePropertyChangeHandler(calculation, new StabilityPointStructuresInput())) { LoadSchematizationType = loadSchematizationType }; // Assert IDictionary <int, DataGridViewColumnStateDefinition> columnStateDefinitions = row.ColumnStateDefinitions; DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[constructiveStrengthLinearLoadModelColumnIndex], loadSchematizationType == LoadSchematizationType.Linear); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[stabilityLinearLoadModelColumnIndex], loadSchematizationType == LoadSchematizationType.Linear); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[constructiveStrengthQuadraticLoadModelColumnIndex], loadSchematizationType == LoadSchematizationType.Quadratic); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[stabilityQuadraticLoadModelColumnIndex], loadSchematizationType == LoadSchematizationType.Quadratic); }
public void DikeProfile_OnChangeToNull_CorrectColumnStates() { // Setup var calculationScenario = new GrassCoverErosionInwardsCalculationScenario { InputParameters = { DikeProfile = DikeProfileTestFactory.CreateDikeProfile() } }; // Call var row = new GrassCoverErosionInwardsCalculationRow(calculationScenario, new ObservablePropertyChangeHandler( calculationScenario, new GrassCoverErosionInwardsInput())) { DikeProfile = new DataGridViewComboBoxItemWrapper <DikeProfile>(null) }; // Assert IDictionary <int, DataGridViewColumnStateDefinition> columnStateDefinitions = row.ColumnStateDefinitions; DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[useBreakWaterColumnIndex], false); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[breakWaterTypeColumnIndex], false); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[breakWaterHeightColumnIndex], false); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[useForeshoreColumnIndex], false); }
public void Constructor_DikeProfileWithForeshoreGeometry_CorrectColumnStates(bool useBreakWater) { // Setup var calculationScenario = new GrassCoverErosionInwardsCalculationScenario { InputParameters = { DikeProfile = DikeProfileTestFactory.CreateDikeProfile(new[] { new Point2D(0.0, 0.0) }), UseBreakWater = useBreakWater } }; // Call var row = new GrassCoverErosionInwardsCalculationRow(calculationScenario, new ObservablePropertyChangeHandler( calculationScenario, new GrassCoverErosionInwardsInput())); // Assert IDictionary <int, DataGridViewColumnStateDefinition> columnStateDefinitions = row.ColumnStateDefinitions; DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[useBreakWaterColumnIndex], true); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[breakWaterTypeColumnIndex], useBreakWater); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[breakWaterHeightColumnIndex], useBreakWater); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[useForeshoreColumnIndex], true); }
public void Constructor_ForeshoreProfileNull_CorrectColumnStates() { // Setup var calculation = new StructuresCalculationScenario <HeightStructuresInput>(); // Call var row = new HeightStructuresCalculationRow(calculation, new ObservablePropertyChangeHandler(calculation, new HeightStructuresInput())); // Assert IDictionary <int, DataGridViewColumnStateDefinition> columnStateDefinitions = row.ColumnStateDefinitions; DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[useBreakWaterColumnIndex], false); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[breakWaterTypeColumnIndex], false); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[breakWaterHeightColumnIndex], false); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[useForeshoreColumnIndex], false); }
public void InflowModelType_AlwaysOnChange_CorrectColumnStates(ClosingStructureInflowModelType inflowModelType, bool isEnabled) { // Setup var calculation = new StructuresCalculationScenario <ClosingStructuresInput>(); // Call var row = new ClosingStructuresCalculationRow(calculation, new ObservablePropertyChangeHandler(calculation, new ClosingStructuresInput())) { InflowModelType = inflowModelType }; // Assert IDictionary <int, DataGridViewColumnStateDefinition> columnStateDefinitions = row.ColumnStateDefinitions; DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[meanInsideWaterLevelColumnIndex], isEnabled); }
public void ForeshoreProfile_OnChangeToProfileWithGeometry_CorrectColumnStates() { // Setup var calculation = new StructuresCalculationScenario <ClosingStructuresInput>(); // Call var row = new ClosingStructuresCalculationRow(calculation, new ObservablePropertyChangeHandler(calculation, new ClosingStructuresInput())) { ForeshoreProfile = new DataGridViewComboBoxItemWrapper <ForeshoreProfile>(new TestForeshoreProfile(new[] { new Point2D(0.0, 0.0) })) }; // Assert IDictionary <int, DataGridViewColumnStateDefinition> columnStateDefinitions = row.ColumnStateDefinitions; DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[useBreakWaterColumnIndex], true); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[breakWaterTypeColumnIndex], false); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[breakWaterHeightColumnIndex], false); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[useForeshoreColumnIndex], true); }
public void Constructor_WithIsRelevant_ExpectedColumnStates(bool isRelevant) { // Setup var mocks = new MockRepository(); var errorProvider = mocks.Stub <IFailureMechanismSectionResultRowWithCalculatedProbabilityErrorProvider>(); errorProvider.Stub(ep => ep.GetManualProbabilityValidationError(double.NaN)) .Return(string.Empty); mocks.ReplayAll(); FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); var result = new AdoptableFailureMechanismSectionResult(section) { IsRelevant = isRelevant, FurtherAnalysisType = FailureMechanismSectionResultFurtherAnalysisType.Executed, InitialFailureMechanismResultType = AdoptableInitialFailureMechanismResultType.Manual }; Func <FailureMechanismSectionAssemblyResultWrapper> performAssemblyFunc = FailureMechanismSectionAssemblyResultWrapperTestFactory.Create; // Call var row = new AdoptableFailureMechanismSectionResultRow(result, () => double.NaN, errorProvider, performAssemblyFunc, ConstructionProperties); // Assert IDictionary <int, DataGridViewColumnStateDefinition> columnStateDefinitions = row.ColumnStateDefinitions; DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState( columnStateDefinitions[ConstructionProperties.InitialFailureMechanismResultTypeIndex], isRelevant); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState( columnStateDefinitions[ConstructionProperties.InitialFailureMechanismResultSectionProbabilityIndex], isRelevant); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState( columnStateDefinitions[ConstructionProperties.FurtherAnalysisTypeIndex], isRelevant); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState( columnStateDefinitions[ConstructionProperties.RefinedSectionProbabilityIndex], isRelevant); mocks.VerifyAll(); }
public void UseBreakWater_AlwaysOnChange_CorrectColumnStates(bool useBreakWater) { // Setup var calculation = new StructuresCalculationScenario <HeightStructuresInput> { InputParameters = { ForeshoreProfile = new TestForeshoreProfile() } }; // Call var row = new HeightStructuresCalculationRow(calculation, new ObservablePropertyChangeHandler(calculation, new HeightStructuresInput())) { UseBreakWater = useBreakWater }; // Assert IDictionary <int, DataGridViewColumnStateDefinition> columnStateDefinitions = row.ColumnStateDefinitions; DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[breakWaterTypeColumnIndex], useBreakWater); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[breakWaterHeightColumnIndex], useBreakWater); }
public void UseBreakWater_AlwaysOnChange_CorrectColumnStates(bool useBreakWater) { // Setup var calculationScenario = new GrassCoverErosionInwardsCalculationScenario { InputParameters = { DikeProfile = DikeProfileTestFactory.CreateDikeProfile() } }; // Call var row = new GrassCoverErosionInwardsCalculationRow(calculationScenario, new ObservablePropertyChangeHandler( calculationScenario, new GrassCoverErosionInwardsInput())) { UseBreakWater = useBreakWater }; // Assert IDictionary <int, DataGridViewColumnStateDefinition> columnStateDefinitions = row.ColumnStateDefinitions; DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[breakWaterTypeColumnIndex], useBreakWater); DataGridViewControlColumnStateDefinitionTestHelper.AssertColumnState(columnStateDefinitions[breakWaterHeightColumnIndex], useBreakWater); }