public void Constructor_ExpectedValues() { // Call var properties = new WaveConditionsOutputProperties(); // Assert Assert.IsInstanceOf <ObjectProperties <WaveConditionsOutput> >(properties); Assert.IsNull(properties.Data); }
public void GetProperties_ValuesNaN_ReturnsExpectedValues() { // Setup var convergence = new Random().NextEnumValue <CalculationConvergence>(); // Call var properties = new WaveConditionsOutputProperties { Data = new WaveConditionsOutput(double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, convergence) }; // Assert Assert.IsNaN(properties.WaterLevel); TestHelper.AssertTypeConverter <WaveConditionsOutputProperties, NoValueRoundedDoubleConverter>( nameof(WaveConditionsOutputProperties.WaterLevel)); Assert.IsNaN(properties.WaveHeight); TestHelper.AssertTypeConverter <WaveConditionsOutputProperties, NoValueRoundedDoubleConverter>( nameof(WaveConditionsOutputProperties.WaveHeight)); Assert.IsNaN(properties.WavePeakPeriod); TestHelper.AssertTypeConverter <WaveConditionsOutputProperties, NoValueRoundedDoubleConverter>( nameof(WaveConditionsOutputProperties.WavePeakPeriod)); Assert.IsNaN(properties.WaveDirection); TestHelper.AssertTypeConverter <WaveConditionsOutputProperties, NoValueRoundedDoubleConverter>( nameof(WaveConditionsOutputProperties.WaveDirection)); Assert.IsNaN(properties.WaveAngle); TestHelper.AssertTypeConverter <WaveConditionsOutputProperties, NoValueRoundedDoubleConverter>( nameof(WaveConditionsOutputProperties.WaveAngle)); Assert.IsNaN(properties.TargetProbability); TestHelper.AssertTypeConverter <WaveConditionsOutputProperties, NoProbabilityValueDoubleConverter>( nameof(WaveConditionsOutputProperties.TargetProbability)); Assert.IsNaN(properties.TargetReliability); TestHelper.AssertTypeConverter <WaveConditionsOutputProperties, NoValueRoundedDoubleConverter> (nameof(WaveConditionsOutputProperties.TargetReliability)); Assert.IsNaN(properties.CalculatedProbability); TestHelper.AssertTypeConverter <WaveConditionsOutputProperties, NoProbabilityValueDoubleConverter>( nameof(WaveConditionsOutputProperties.CalculatedProbability)); Assert.IsNaN(properties.CalculatedReliability); TestHelper.AssertTypeConverter <WaveConditionsOutputProperties, NoValueRoundedDoubleConverter>( nameof(WaveConditionsOutputProperties.CalculatedReliability)); string convergenceValue = EnumDisplayNameHelper.GetDisplayName(convergence); Assert.AreEqual(convergenceValue, properties.Convergence); }
public void Data_WithCalculationOutput_ReturnsExpectedValues() { // Setup var waveRunUpOutput = new[] { new TestWaveConditionsOutput() }; var waveImpactOutput = new[] { new TestWaveConditionsOutput() }; var waveImpactWithWaveDirectionOutput = new[] { new TestWaveConditionsOutput() }; GrassCoverErosionOutwardsWaveConditionsOutput output = GrassCoverErosionOutwardsWaveConditionsOutputTestFactory.Create(waveRunUpOutput, waveImpactOutput, waveImpactWithWaveDirectionOutput); // Call var properties = new GrassCoverErosionOutwardsWaveConditionsOutputProperties(output, new GrassCoverErosionOutwardsWaveConditionsInput()); // Assert CollectionAssert.AllItemsAreInstancesOfType(properties.WaveRunUpOutput, typeof(WaveConditionsOutputProperties)); Assert.AreEqual(waveRunUpOutput.Length, properties.WaveRunUpOutput.Length); WaveConditionsOutputProperties waveRunUpProperty = properties.WaveRunUpOutput[0]; Assert.AreSame(waveRunUpOutput[0], waveRunUpProperty.Data); CollectionAssert.AllItemsAreInstancesOfType(properties.WaveImpactOutput, typeof(WaveConditionsOutputProperties)); Assert.AreEqual(waveImpactOutput.Length, properties.WaveImpactOutput.Length); WaveConditionsOutputProperties waveImpactProperties = properties.WaveImpactOutput[0]; Assert.AreSame(waveImpactOutput[0], waveImpactProperties.Data); CollectionAssert.AllItemsAreInstancesOfType(properties.WaveImpactWithWaveDirectionOutput, typeof(WaveConditionsOutputProperties)); Assert.AreEqual(waveImpactWithWaveDirectionOutput.Length, properties.WaveImpactWithWaveDirectionOutput.Length); WaveConditionsOutputProperties waveImpactWithWaveDirectionOutputProperties = properties.WaveImpactWithWaveDirectionOutput[0]; Assert.AreSame(waveImpactWithWaveDirectionOutput[0], waveImpactWithWaveDirectionOutputProperties.Data); }
public void Data_WithCalculationOutput_ReturnsExpectedValues() { // Setup var items = new[] { new TestWaveConditionsOutput() }; var waveImpactAsphaltCoverWaveConditionsOutput = new WaveImpactAsphaltCoverWaveConditionsOutput(items); // Call var properties = new WaveImpactAsphaltCoverWaveConditionsOutputProperties { Data = waveImpactAsphaltCoverWaveConditionsOutput }; // Assert CollectionAssert.AllItemsAreInstancesOfType(properties.Items, typeof(WaveConditionsOutputProperties)); Assert.AreEqual(items.Length, properties.Items.Length); WaveConditionsOutput expectedOutputProperty = items[0]; WaveConditionsOutputProperties firstOutputProperties = properties.Items[0]; Assert.AreEqual(expectedOutputProperty.WaterLevel, firstOutputProperties.WaterLevel); Assert.AreEqual(expectedOutputProperty.WaveHeight, firstOutputProperties.WaveHeight); Assert.AreEqual(expectedOutputProperty.WavePeakPeriod, firstOutputProperties.WavePeakPeriod); Assert.AreEqual(expectedOutputProperty.WaveAngle, firstOutputProperties.WaveAngle); Assert.AreEqual(expectedOutputProperty.WaveDirection, firstOutputProperties.WaveDirection); Assert.AreEqual(expectedOutputProperty.TargetProbability, firstOutputProperties.TargetProbability); Assert.AreEqual(expectedOutputProperty.TargetReliability, firstOutputProperties.TargetReliability, firstOutputProperties.TargetReliability.GetAccuracy()); Assert.AreEqual(expectedOutputProperty.TargetProbability, firstOutputProperties.TargetProbability); Assert.AreEqual(expectedOutputProperty.TargetReliability, firstOutputProperties.TargetReliability, firstOutputProperties.TargetReliability.GetAccuracy()); string convergenceValue = EnumDisplayNameHelper.GetDisplayName(expectedOutputProperty.CalculationConvergence); Assert.AreEqual(convergenceValue, firstOutputProperties.Convergence); }
public void Constructor_WithData_ReturnsExpectedValues() { // Setup var blocksOutput = new[] { new TestWaveConditionsOutput() }; var columnsOutput = new[] { new TestWaveConditionsOutput() }; StabilityStoneCoverWaveConditionsOutput stabilityStoneCoverWaveConditionsOutput = StabilityStoneCoverWaveConditionsOutputTestFactory.Create( columnsOutput, blocksOutput); // Call var properties = new StabilityStoneCoverWaveConditionsOutputProperties( stabilityStoneCoverWaveConditionsOutput, new StabilityStoneCoverWaveConditionsInput()); // Assert CollectionAssert.AllItemsAreInstancesOfType(properties.Blocks, typeof(WaveConditionsOutputProperties)); Assert.AreEqual(blocksOutput.Length, properties.Blocks.Length); TestWaveConditionsOutput firstBlocksOutput = blocksOutput[0]; WaveConditionsOutputProperties firstBlocksProperties = properties.Blocks[0]; Assert.AreSame(firstBlocksOutput, firstBlocksProperties.Data); CollectionAssert.AllItemsAreInstancesOfType(properties.Columns, typeof(WaveConditionsOutputProperties)); Assert.AreEqual(columnsOutput.Length, properties.Columns.Length); TestWaveConditionsOutput firstColumnsOutput = columnsOutput[0]; WaveConditionsOutputProperties firstColumnsProperties = properties.Columns[0]; Assert.AreSame(firstColumnsOutput, firstColumnsProperties.Data); }
public void GetProperties_ValidData_ReturnsExpectedValues() { // Setup const double waterLevel = 3.09378; const double waveHeight = 4.29884; const double wavePeakPeriod = 0.19435; const double waveAngle = 180.62353; const double waveDirection = 230.5326; const double targetProbability = 0.5; const double targetReliability = 3000; const double calculatedProbability = 0.4; const double calculatedReliability = 6000; var convergence = new Random().NextEnumValue <CalculationConvergence>(); // Call var properties = new WaveConditionsOutputProperties { Data = new WaveConditionsOutput(waterLevel, waveHeight, wavePeakPeriod, waveAngle, waveDirection, targetProbability, targetReliability, calculatedProbability, calculatedReliability, convergence) }; // Assert Assert.AreEqual(waterLevel, properties.WaterLevel, properties.WaterLevel.GetAccuracy()); Assert.AreEqual(waveHeight, properties.WaveHeight, properties.WaveHeight.GetAccuracy()); Assert.AreEqual(wavePeakPeriod, properties.WavePeakPeriod, properties.WavePeakPeriod.GetAccuracy()); Assert.AreEqual(waveDirection, properties.WaveDirection, properties.WaveDirection.GetAccuracy()); Assert.AreEqual(waveAngle, properties.WaveAngle, properties.WaveAngle.GetAccuracy()); Assert.AreEqual(targetProbability, properties.TargetProbability); Assert.AreEqual(targetReliability, properties.TargetReliability, properties.TargetReliability.GetAccuracy()); Assert.AreEqual(calculatedProbability, properties.CalculatedProbability); Assert.AreEqual(calculatedReliability, properties.CalculatedReliability, properties.CalculatedReliability.GetAccuracy()); string convergenceValue = EnumDisplayNameHelper.GetDisplayName(convergence); Assert.AreEqual(convergenceValue, properties.Convergence); }
public void Constructor_Always_PropertiesHaveExpectedAttributesValues() { // Setup const double waterLevel = 3.09378; const double waveHeight = 4.29884; const double wavePeakPeriod = 0.19435; const double waveAngle = 180.62353; const double waveDirection = 230.5326; const double targetProbability = 0.5; const double targetReliability = 3000; const double calculatedProbability = 0.4; const double calculatedReliability = 6000; // Call var properties = new WaveConditionsOutputProperties { Data = new WaveConditionsOutput(waterLevel, waveHeight, wavePeakPeriod, waveAngle, waveDirection, targetProbability, targetReliability, calculatedProbability, calculatedReliability, CalculationConvergence.NotCalculated) }; // Assert TypeConverter classTypeConverter = TypeDescriptor.GetConverter(properties, true); Assert.IsInstanceOf <ExpandableObjectConverter>(classTypeConverter); PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); Assert.AreEqual(10, dynamicProperties.Count); PropertyDescriptor waterLevelProperty = dynamicProperties[requiredWaterLevelPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(waterLevelProperty, "Algemeen", "Waterstand [m+NAP]", "De waterstand waarvoor de golfhoogte, -periode en -richting zijn berekend.", true); PropertyDescriptor waveHeightProperty = dynamicProperties[requiredWaveHeightPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(waveHeightProperty, "Algemeen", "Golfhoogte (Hs) [m]", "Berekende golfhoogte.", true); PropertyDescriptor wavePeakPeriodProperty = dynamicProperties[requiredWavePeakPeriodPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(wavePeakPeriodProperty, "Algemeen", "Golfperiode (Tp) [s]", "Berekende golfperiode.", true); PropertyDescriptor waveDirectionProperty = dynamicProperties[requiredWaveDirectionPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(waveDirectionProperty, "Algemeen", "Golfrichting t.o.v. Noord [°]", "Berekende maatgevende golfrichting ten opzichte van het noorden.", true); PropertyDescriptor waveAngleProperty = dynamicProperties[requiredWaveAnglePropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(waveAngleProperty, "Algemeen", "Golfrichting t.o.v. dijknormaal [°]", "Berekende maatgevende golfrichting ten opzichte van de dijknormaal.", true); PropertyDescriptor targetProbabilityProperty = dynamicProperties[requiredTargetProbabilityPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(targetProbabilityProperty, "Algemeen", "Doelkans [1/jaar]", "De opgegeven kans waarvoor het resultaat is berekend.", true); PropertyDescriptor targetReliabilityProperty = dynamicProperties[requiredTargetReliabilityPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(targetReliabilityProperty, "Algemeen", "Betrouwbaarheidsindex doelkans [-]", "Betrouwbaarheidsindex van de opgegeven kans waarvoor het resultaat is berekend.", true); PropertyDescriptor calculatedProbabilityProperty = dynamicProperties[requiredCalculatedProbabilityPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculatedProbabilityProperty, "Algemeen", "Berekende kans [1/jaar]", "De berekende kans van voorkomen van het resultaat.", true); PropertyDescriptor calculatedReliabilityProperty = dynamicProperties[requiredCalculatedReliabilityPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculatedReliabilityProperty, "Algemeen", "Betrouwbaarheidsindex berekende kans [-]", "Betrouwbaarheidsindex van de berekende kans van voorkomen van het resultaat.", true); PropertyDescriptor calculationConvergenceProperty = dynamicProperties[requiredConvergencePropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculationConvergenceProperty, "Algemeen", "Convergentie", "Is convergentie bereikt voor de berekening?", true); }