public void Constructor_WithParameters_ReturnsNewInstance() { // Setup var configuration = new ClosingStructuresCalculationConfiguration("name"); var calculation = new StructuresCalculation <ClosingStructuresInput>(); // Call var assigner = new ClosingStructuresCalculationStochastAssigner( configuration, calculation); // Assert Assert.IsInstanceOf <StructuresCalculationStochastAssigner < ClosingStructuresCalculationConfiguration, ClosingStructuresInput, ClosingStructure> >(assigner); }
public void Assign_WithoutStructureParametersDefinedForStructureDependentStochast_ReturnsFalse( Action <ClosingStructuresCalculationConfiguration> modify) { // Setup var configuration = new ClosingStructuresCalculationConfiguration("name"); modify(configuration); var calculation = new StructuresCalculation <ClosingStructuresInput>(); var assigner = new ClosingStructuresCalculationStochastAssigner( configuration, calculation); // Call bool valid = assigner.Assign(); // Assert Assert.IsFalse(valid); }
public void Assign_WithSpreadForModelFactorSuperCriticalFlow_LogsErrorReturnFalse(bool withStandardDeviation) { // Setup var configuration = new ClosingStructuresCalculationConfiguration("name") { StructureId = "some structure", ModelFactorSuperCriticalFlow = new StochastConfiguration { Mean = 8.1 } }; if (withStandardDeviation) { configuration.ModelFactorSuperCriticalFlow.StandardDeviation = 0.8; } else { configuration.ModelFactorSuperCriticalFlow.VariationCoefficient = 0.8; } var calculation = new StructuresCalculation <ClosingStructuresInput>(); var assigner = new ClosingStructuresCalculationStochastAssigner( configuration, calculation); var valid = true; // Call Action test = () => valid = assigner.Assign(); // Assert const string expectedMessage = "Er kan geen spreiding voor stochast 'modelfactoroverloopdebiet' opgegeven worden. Berekening 'name' is overgeslagen."; TestHelper.AssertLogMessageWithLevelIsGenerated(test, Tuple.Create(expectedMessage, LogLevelConstant.Error)); Assert.IsFalse(valid); }
public void Assign_WithAllStochastsSet_SetExpectedValuesOnInput() { // Setup var configuration = new ClosingStructuresCalculationConfiguration("name") { StructureId = "some structure", LevelCrestStructureNotClosing = new StochastConfiguration { Mean = 1.1, StandardDeviation = 1.5 }, AreaFlowApertures = new StochastConfiguration { Mean = 2.1, StandardDeviation = 2.5 }, InsideWaterLevel = new StochastConfiguration { Mean = 3.1, StandardDeviation = 3.5 }, ThresholdHeightOpenWeir = new StochastConfiguration { Mean = 4.1, StandardDeviation = 4.5 }, AllowedLevelIncreaseStorage = new StochastConfiguration { Mean = 5.1, StandardDeviation = 5.5 }, FlowWidthAtBottomProtection = new StochastConfiguration { Mean = 6.1, StandardDeviation = 6.5 }, WidthFlowApertures = new StochastConfiguration { Mean = 7.1, StandardDeviation = 7.5 }, DrainCoefficient = new StochastConfiguration { Mean = 8.1, StandardDeviation = 8.5 }, ModelFactorSuperCriticalFlow = new StochastConfiguration { Mean = 9.1 }, CriticalOvertoppingDischarge = new StochastConfiguration { Mean = 10.1, VariationCoefficient = 0.1 }, StorageStructureArea = new StochastConfiguration { Mean = 11.1, VariationCoefficient = 0.11 }, StormDuration = new StochastConfiguration { Mean = 12.1 } }; var calculation = new StructuresCalculation <ClosingStructuresInput>(); var assigner = new ClosingStructuresCalculationStochastAssigner( configuration, calculation); // Call bool valid = assigner.Assign(); // Assert Assert.IsTrue(valid); }