Exemplo n.º 1
0
        public void SetConfigurationForeshoreProfileDependentProperties_WithForeshoreProfileInvalidBreakwaterType_UpdatesConfiguration()
        {
            // Setup
            var random         = new Random(6543);
            var configuration  = new SimpleStructuresCalculationConfiguration();
            var structureInput = new SimpleStructuresInput
            {
                ForeshoreProfile = new TestForeshoreProfile(new BreakWater(
                                                                (BreakWaterType)999,
                                                                random.NextDouble())),
                UseBreakWater = random.NextBoolean(),
                UseForeshore  = random.NextBoolean()
            };

            // Call
            configuration.SetConfigurationForeshoreProfileDependentProperties(structureInput);

            // Assert
            Assert.AreEqual(structureInput.ForeshoreProfile.Id, configuration.ForeshoreProfileId);
            WaveReductionConfiguration waveReduction = configuration.WaveReduction;

            Assert.AreEqual(structureInput.UseBreakWater, waveReduction.UseBreakWater);
            Assert.AreEqual(structureInput.UseForeshore, waveReduction.UseForeshoreProfile);
            Assert.IsNull(waveReduction.BreakWaterType);
            Assert.AreEqual(structureInput.BreakWater.Height, waveReduction.BreakWaterHeight);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Validate the defined wave reduction parameters in combination with a given foreshore profile.
        /// </summary>
        /// <param name="waveReduction">Configuration possibly containing wave reduction parameters.</param>
        /// <param name="foreshoreProfile">The foreshore profile currently assigned to the calculation.</param>
        /// <param name="calculationName">The name of the calculation which is being validated.</param>
        /// <param name="log">Log used to write out errors.</param>
        /// <returns><c>false</c> when there is an invalid wave reduction parameter defined, <c>true</c> otherwise.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="calculationName"/> or <paramref name="log"/>
        /// is <c>null</c>.</exception>
        public static bool ValidateWaveReduction(this WaveReductionConfiguration waveReduction, ForeshoreProfile foreshoreProfile, string calculationName, ILog log)
        {
            if (calculationName == null)
            {
                throw new ArgumentNullException(nameof(calculationName));
            }

            if (log == null)
            {
                throw new ArgumentNullException(nameof(log));
            }

            if (foreshoreProfile == null)
            {
                if (HasParametersDefined(waveReduction))
                {
                    log.LogCalculationConversionError(Resources.CalculationConfigurationImporter_ValidateWaveReduction_No_foreshore_profile_provided,
                                                      calculationName);

                    return(false);
                }
            }
            else if (!foreshoreProfile.Geometry.Any() && waveReduction?.UseForeshoreProfile == true)
            {
                log.LogCalculationConversionError(string.Format(
                                                      Resources.ReadForeshoreProfile_ForeshoreProfile_0_has_no_geometry_and_cannot_be_used,
                                                      foreshoreProfile.Id),
                                                  calculationName);

                return(false);
            }

            return(true);
        }
Exemplo n.º 3
0
        public void SetConfigurationForeshoreProfileDependentProperties_WithForeshoreProfile_UpdatesConfiguration()
        {
            // Setup
            var random         = new Random(6543);
            var configuration  = new SimpleStructuresCalculationConfiguration();
            var structureInput = new SimpleStructuresInput
            {
                ForeshoreProfile = new ForeshoreProfile(new Point2D(0, 0),
                                                        Enumerable.Empty <Point2D>(),
                                                        new BreakWater(
                                                            BreakWaterType.Dam,
                                                            random.NextDouble()),
                                                        new ForeshoreProfile.ConstructionProperties
                {
                    Id   = "id",
                    Name = "profile"
                }),
                UseBreakWater = random.NextBoolean(),
                UseForeshore  = random.NextBoolean()
            };

            // Call
            configuration.SetConfigurationForeshoreProfileDependentProperties(structureInput);

            // Assert
            Assert.AreEqual("id", configuration.ForeshoreProfileId);
            WaveReductionConfiguration waveReduction = configuration.WaveReduction;

            Assert.AreEqual(structureInput.UseBreakWater, waveReduction.UseBreakWater);
            Assert.AreEqual(structureInput.UseForeshore, waveReduction.UseForeshoreProfile);
            Assert.AreEqual(ConfigurationBreakWaterType.Dam, waveReduction.BreakWaterType);
            Assert.AreEqual(structureInput.BreakWater.Height, waveReduction.BreakWaterHeight);
        }
Exemplo n.º 4
0
        public void WriteWaveReduction_InvalidBreakWaterType_ThrowsInvalidEnumArgumentException()
        {
            // Setup
            string filePath      = TestHelper.GetScratchPadPath(nameof(WriteWaveReduction_WithoutWaveReduction_ThrowsArgumentNullException));
            var    configuration = new WaveReductionConfiguration
            {
                BreakWaterType = (ConfigurationBreakWaterType?)9000
            };

            try
            {
                using (XmlWriter xmlWriter = CreateXmlWriter(filePath))
                {
                    // Call
                    TestDelegate testDelegate = () => xmlWriter.WriteWaveReduction(configuration);

                    // Assert
                    Assert.Throws <InvalidEnumArgumentException>(testDelegate);
                }
            }
            finally
            {
                File.Delete(filePath);
            }
        }
        public void ReadWaveReduction_DifferentScenarios_CorrectParametersSet(bool useForeshoreProfile, bool useBreakWater, double height, ConfigurationBreakWaterType type, BreakWaterType expectedType)
        {
            // Setup
            var testInput = new TestInputWithForeshoreProfileAndBreakWater(new BreakWater(BreakWaterType.Caisson, 0.0));

            string filePath = Path.Combine(readerPath, "validConfiguration.xml");

            var calculationGroup = new CalculationGroup();

            var importer = new CalculationConfigurationImporter(filePath, calculationGroup);

            var waveReductionConfiguration = new WaveReductionConfiguration
            {
                UseForeshoreProfile = useForeshoreProfile,
                UseBreakWater = useBreakWater,
                BreakWaterHeight = height,
                BreakWaterType = type
            };

            // Call
            importer.PublicReadWaveReductionParameters(waveReductionConfiguration, testInput);

            // Assert
            Assert.AreEqual(testInput.UseForeshore, useForeshoreProfile);
            Assert.AreEqual(testInput.UseBreakWater, useBreakWater);
            Assert.AreEqual(testInput.BreakWater.Height, height, testInput.BreakWater.Height.GetAccuracy());
            Assert.AreEqual(testInput.BreakWater.Type, expectedType);
        }
Exemplo n.º 6
0
        public void ValidateWaveReduction_ForeshoreProfileWithGeometryForeshoreProfileUsed_ReturnsTrue()
        {
            // Setup
            const string calculationName = "calculation";

            var mocks = new MockRepository();
            var log   = mocks.StrictMock <ILog>();

            mocks.ReplayAll();

            var waveReductionConfiguration = new WaveReductionConfiguration
            {
                UseForeshoreProfile = true
            };

            // Call
            bool valid = waveReductionConfiguration.ValidateWaveReduction(new TestForeshoreProfile("voorland", new[]
            {
                new Point2D(0, 2)
            }), calculationName, log);

            // Assert
            Assert.IsTrue(valid);
            mocks.VerifyAll();
        }
        /// <summary>
        /// Validation to check if the defined wave reduction parameters are valid.
        /// </summary>
        /// <param name="calculationConfiguration">The calculation read from the imported file.</param>
        /// <param name="calculation">The calculation to configure.</param>
        /// <returns><c>false</c> when there is an invalid wave reduction parameter defined, <c>true</c> otherwise.</returns>
        private bool ValidateWaveReduction(GrassCoverErosionInwardsCalculationConfiguration calculationConfiguration,
                                           GrassCoverErosionInwardsCalculation calculation)
        {
            WaveReductionConfiguration waveReductionConfiguration = calculationConfiguration.WaveReduction;

            if (calculation.InputParameters.DikeProfile == null)
            {
                if (waveReductionConfiguration != null &&
                    (waveReductionConfiguration.UseBreakWater.HasValue ||
                     waveReductionConfiguration.UseForeshoreProfile.HasValue ||
                     waveReductionConfiguration.BreakWaterHeight != null ||
                     waveReductionConfiguration.BreakWaterType != null))
                {
                    Log.LogCalculationConversionError(Resources.GrassCoverErosionInwardsCalculationConfigurationImporter_ValidateWaveReduction_No_DikeProfile_provided_for_BreakWater_parameters,
                                                      calculation.Name);

                    return(false);
                }
            }
            else if (!calculation.InputParameters.ForeshoreGeometry.Any() &&
                     waveReductionConfiguration?.UseForeshoreProfile != null &&
                     waveReductionConfiguration.UseForeshoreProfile.Value)
            {
                Log.LogCalculationConversionError(string.Format(
                                                      Resources.GrassCoverErosionInwardsCalculationConfigurationImporter_ValidateWaveReduction_DikeProfile_0_has_no_geometry_and_cannot_be_used,
                                                      calculationConfiguration.DikeProfileId),
                                                  calculation.Name);
                return(false);
            }

            return(true);
        }
Exemplo n.º 8
0
        public void ValidateWaveReduction_ForeshoreProfileWithoutGeometryForeshoreProfileUsed_LogsErrorReturnsFalse()
        {
            // Setup
            const string profileName     = "voorland";
            const string calculationName = "calculation";
            const string expectedMessage = "{0} Berekening '{1}' is overgeslagen.";

            string error = $"Het opgegeven voorlandprofiel '{profileName}' heeft geen voorlandgeometrie en kan daarom niet gebruikt worden.";

            var mocks = new MockRepository();
            var log   = mocks.StrictMock <ILog>();

            log.Expect(l => l.ErrorFormat(expectedMessage, error, calculationName));
            mocks.ReplayAll();

            var waveReductionConfiguration = new WaveReductionConfiguration
            {
                UseForeshoreProfile = true
            };

            // Call
            bool valid = waveReductionConfiguration.ValidateWaveReduction(new TestForeshoreProfile(profileName), calculationName, log);

            // Assert
            Assert.IsFalse(valid);
            mocks.VerifyAll();
        }
Exemplo n.º 9
0
        public void GetWaveReductionParameters_WithAllParameters_ReturnsConfiguration()
        {
            // Setup
            const double height = 2.1;
            const string type   = "havendam";
            const string useForeshoreProfile = "true";
            const string useBreakWater       = "true";

            var breakWaterHeightElement    = new XElement("damhoogte", height);
            var breakWaterTypeElement      = new XElement("damtype", type);
            var useForeshoreProfileElement = new XElement("voorlandgebruiken", useForeshoreProfile);
            var useBreakWaterElement       = new XElement("damgebruiken", useBreakWater);

            var waveReductionElement = new XElement("golfreductie",
                                                    breakWaterHeightElement,
                                                    breakWaterTypeElement,
                                                    useForeshoreProfileElement,
                                                    useBreakWaterElement);
            var xElement = new XElement("root", new XElement("root", waveReductionElement));

            // Call
            WaveReductionConfiguration waveReduction = xElement.GetWaveReductionParameters();

            // Assert
            Assert.AreEqual(height, waveReduction.BreakWaterHeight);
            Assert.AreEqual(ConfigurationBreakWaterType.Dam, waveReduction.BreakWaterType);
            Assert.IsTrue(waveReduction.UseForeshoreProfile);
            Assert.IsTrue(waveReduction.UseBreakWater);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Assigns the <paramref name="waveReduction"/> parameters to the <paramref name="input"/>.
        /// </summary>
        /// <typeparam name="T">Type of the input for which values are assigned from the configuration.</typeparam>
        /// <param name="waveReduction">The wave reduction configuration containing values for the parameters.</param>
        /// <param name="input">The input to assign the values to.</param>
        protected static void SetWaveReductionParameters <T>(WaveReductionConfiguration waveReduction, T input)
            where T : IUseBreakWater, IUseForeshore
        {
            if (waveReduction != null)
            {
                if (waveReduction.UseForeshoreProfile.HasValue)
                {
                    input.UseForeshore = waveReduction.UseForeshoreProfile.Value;
                }

                if (waveReduction.UseBreakWater.HasValue)
                {
                    input.UseBreakWater = waveReduction.UseBreakWater.Value;
                }

                if (waveReduction.BreakWaterType.HasValue)
                {
                    input.BreakWater.Type = (BreakWaterType) new ConfigurationBreakWaterTypeConverter().ConvertTo(waveReduction.BreakWaterType.Value, typeof(BreakWaterType));
                }

                if (waveReduction.BreakWaterHeight.HasValue)
                {
                    input.BreakWater.Height = (RoundedDouble)waveReduction.BreakWaterHeight.Value;
                }
            }
        }
Exemplo n.º 11
0
 private static bool HasParametersDefined(WaveReductionConfiguration waveReduction)
 {
     return(waveReduction != null &&
            (waveReduction.UseBreakWater.HasValue ||
             waveReduction.UseForeshoreProfile.HasValue ||
             waveReduction.BreakWaterHeight.HasValue ||
             waveReduction.BreakWaterType.HasValue));
 }
        public void ReadWaveReduction_WithConfigurationWithMissingParameter_MissingParameterUnchanged(
            [Values(0, 1, 2, 3)] int parameterNotSet)
        {
            // Setup
            const bool useForeshoreProfile = false;
            const bool useBreakWater = false;
            const double height = 2.55;
            const BreakWaterType breakWaterType = BreakWaterType.Dam;

            const bool newUseForeshoreProfile = true;
            const bool newUseBreakWater = true;
            const double newHeight = 11.1;
            const ConfigurationBreakWaterType newBreakWaterType = ConfigurationBreakWaterType.Wall;
            const BreakWaterType expectedNewBreakWaterType = BreakWaterType.Wall;

            var testInput = new TestInputWithForeshoreProfileAndBreakWater(new BreakWater(breakWaterType, height))
            {
                UseBreakWater = useBreakWater,
                UseForeshore = useForeshoreProfile
            };

            var waveReductionConfiguration = new WaveReductionConfiguration();
            if (parameterNotSet != 0)
            {
                waveReductionConfiguration.UseForeshoreProfile = newUseForeshoreProfile;
            }

            if (parameterNotSet != 1)
            {
                waveReductionConfiguration.UseBreakWater = newUseBreakWater;
            }

            if (parameterNotSet != 2)
            {
                waveReductionConfiguration.BreakWaterHeight = newHeight;
            }

            if (parameterNotSet != 3)
            {
                waveReductionConfiguration.BreakWaterType = newBreakWaterType;
            }

            string filePath = Path.Combine(readerPath, "validConfiguration.xml");

            var calculationGroup = new CalculationGroup();

            var importer = new CalculationConfigurationImporter(filePath, calculationGroup);

            // Call
            importer.PublicReadWaveReductionParameters(waveReductionConfiguration, testInput);

            // Assert
            Assert.AreEqual(testInput.UseForeshore, parameterNotSet == 0 ? useForeshoreProfile : newUseForeshoreProfile);
            Assert.AreEqual(testInput.UseBreakWater, parameterNotSet == 1 ? useBreakWater : newUseBreakWater);
            Assert.AreEqual(testInput.BreakWater.Height, parameterNotSet == 2 ? height : newHeight, testInput.BreakWater.Height.GetAccuracy());
            Assert.AreEqual(testInput.BreakWater.Type, parameterNotSet == 3 ? breakWaterType : expectedNewBreakWaterType);
        }
        public void Constructor_ExpectedValues()
        {
            // Call
            var configuration = new WaveReductionConfiguration();

            // Assert
            Assert.IsNull(configuration.UseBreakWater);
            Assert.IsNull(configuration.BreakWaterType);
            Assert.IsNull(configuration.BreakWaterHeight);
            Assert.IsNull(configuration.UseForeshoreProfile);
        }
Exemplo n.º 14
0
        public void GetWaveReductionParameters_OtherDescendantElement_ReturnsNull()
        {
            // Setup
            var xElement = new XElement("root", new XElement("root", new XElement("OtherDescendantElement")));

            // Call
            WaveReductionConfiguration waveReduction = xElement.GetWaveReductionParameters();

            // Assert
            Assert.IsNull(waveReduction);
        }
Exemplo n.º 15
0
        /// <summary>
        /// Writes a wave reduction configuration when it has a value.
        /// </summary>
        /// <param name="writer">The writer to use for writing.</param>
        /// <param name="configuration">The configuration for the wave reduction that can be <c>null</c>.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="writer"/> is <c>null</c>.</exception>
        /// <exception cref="InvalidOperationException">Thrown when the <paramref name="writer"/>
        /// is closed.</exception>
        protected static void WriteWaveReductionWhenAvailable(XmlWriter writer, WaveReductionConfiguration configuration)
        {
            if (writer == null)
            {
                throw new ArgumentNullException(nameof(writer));
            }

            if (configuration != null)
            {
                writer.WriteWaveReduction(configuration);
            }
        }
Exemplo n.º 16
0
        public void ValidateWaveReduction_NoForeshoreProfileWaveReductionWithoutParameters_ReturnsTrue()
        {
            // Setup
            const string calculationName = "calculation";

            var mocks = new MockRepository();
            var log   = mocks.StrictMock <ILog>();

            mocks.ReplayAll();

            // Call
            bool valid = new WaveReductionConfiguration().ValidateWaveReduction(null, calculationName, log);

            // Assert
            Assert.IsTrue(valid);
            mocks.VerifyAll();
        }
Exemplo n.º 17
0
        public void GetWaveReductionParameters_WithUseForeshoreProfile_ReturnsConfiguration()
        {
            // Setup
            const string useForeshoreProfile = "true";

            var useForeshoreProfileElement = new XElement("voorlandgebruiken", useForeshoreProfile);
            var waveReductionElement       = new XElement("golfreductie", useForeshoreProfileElement);
            var xElement = new XElement("root", new XElement("root", waveReductionElement));

            // Call
            WaveReductionConfiguration waveReduction = xElement.GetWaveReductionParameters();

            // Assert
            Assert.IsTrue(waveReduction.UseForeshoreProfile);
            Assert.IsNull(waveReduction.BreakWaterHeight);
            Assert.IsNull(waveReduction.BreakWaterType);
            Assert.IsNull(waveReduction.UseBreakWater);
        }
Exemplo n.º 18
0
        public void GetWaveReductionParameters_WithBreakWaterType_ReturnsConfiguration()
        {
            // Setup
            const string type = "havendam";

            var breakWaterTypeElement = new XElement("damtype", type);
            var waveReductionElement  = new XElement("golfreductie", breakWaterTypeElement);
            var xElement = new XElement("root", new XElement("root", waveReductionElement));

            // Call
            WaveReductionConfiguration waveReduction = xElement.GetWaveReductionParameters();

            // Assert
            Assert.AreEqual(ConfigurationBreakWaterType.Dam, waveReduction.BreakWaterType);
            Assert.IsNull(waveReduction.BreakWaterHeight);
            Assert.IsNull(waveReduction.UseForeshoreProfile);
            Assert.IsNull(waveReduction.UseBreakWater);
        }
Exemplo n.º 19
0
        public void GetWaveReductionParameters_WithBreakWaterHeight_ReturnsConfiguration()
        {
            // Setup
            const double height = 2.1;

            var breakWaterHeightElement = new XElement("damhoogte", height);
            var waveReductionElement    = new XElement("golfreductie", breakWaterHeightElement);
            var xElement = new XElement("root", new XElement("root", waveReductionElement));

            // Call
            WaveReductionConfiguration waveReduction = xElement.GetWaveReductionParameters();

            // Assert
            Assert.AreEqual(height, waveReduction.BreakWaterHeight);
            Assert.IsNull(waveReduction.BreakWaterType);
            Assert.IsNull(waveReduction.UseForeshoreProfile);
            Assert.IsNull(waveReduction.UseBreakWater);
        }
        public void WriteWaveReductionWhenAvailable_WaveReductionConfigurationSet_WriterCalledWithExpectedParameters()
        {
            // Setup
            var configuration = new WaveReductionConfiguration();

            var mocks     = new MockRepository();
            var xmlWriter = mocks.StrictMock <XmlWriter>();

            xmlWriter.Expect(w => w.WriteWaveReduction(configuration));
            mocks.ReplayAll();

            // Call
            ExposedCalculationConfigurationWriter.PublicWriteWaveReductionWhenAvailable(
                xmlWriter,
                configuration);

            // Assert
            mocks.VerifyAll();
        }
Exemplo n.º 21
0
        public void ValidateWaveReduction_NoForeshoreProfileWaveReductionWithParameter_LogsErrorReturnsFalse([Values(0, 1, 2, 3)] int propertyToSet)
        {
            // Setup
            const string calculationName = "calculation";
            const string error           = "Er is geen voorlandprofiel opgegeven om golfreductie parameters aan toe te voegen.";
            const string expectedMessage = "{0} Berekening '{1}' is overgeslagen.";

            var mocks = new MockRepository();
            var log   = mocks.StrictMock <ILog>();

            log.Expect(l => l.ErrorFormat(expectedMessage, error, calculationName));
            mocks.ReplayAll();

            var waveReductionConfiguration = new WaveReductionConfiguration();
            var random = new Random(21);

            switch (propertyToSet)
            {
            case 0:
                waveReductionConfiguration.BreakWaterType = random.NextEnumValue <ConfigurationBreakWaterType>();
                break;

            case 1:
                waveReductionConfiguration.BreakWaterHeight = random.NextDouble();
                break;

            case 2:
                waveReductionConfiguration.UseBreakWater = random.NextBoolean();
                break;

            case 3:
                waveReductionConfiguration.UseForeshoreProfile = random.NextBoolean();
                break;
            }

            // Call
            bool valid = waveReductionConfiguration.ValidateWaveReduction(null, calculationName, log);

            // Assert
            Assert.IsFalse(valid);
            mocks.VerifyAll();
        }
Exemplo n.º 22
0
        /// <summary>
        /// Writes a single <see cref="WaveReductionConfiguration"/> as a wave reduction element in file.
        /// </summary>
        /// <param name="writer">The writer to use to write the wave reduction.</param>
        /// <param name="waveReduction">The wave reduction to write.</param>
        /// <exception cref="ArgumentNullException">Thrown when any of the input parameters is <c>null</c>.</exception>
        /// <exception cref="InvalidOperationException">Thrown when the <paramref name="writer"/>
        /// is closed.</exception>
        /// <exception cref="InvalidEnumArgumentException">Thrown when the conversion of <paramref name="waveReduction"/>
        /// cannot be performed.</exception>
        /// <exception cref="NotSupportedException">Thrown when the conversion of <paramref name="waveReduction"/>
        /// cannot be performed.</exception>
        public static void WriteWaveReduction(this XmlWriter writer, WaveReductionConfiguration waveReduction)
        {
            if (writer == null)
            {
                throw new ArgumentNullException(nameof(writer));
            }

            if (waveReduction == null)
            {
                throw new ArgumentNullException(nameof(waveReduction));
            }

            writer.WriteStartElement(ConfigurationSchemaIdentifiers.WaveReduction);

            if (waveReduction.UseBreakWater.HasValue)
            {
                writer.WriteElementString(ConfigurationSchemaIdentifiers.UseBreakWater,
                                          XmlConvert.ToString(waveReduction.UseBreakWater.Value));
            }

            if (waveReduction.BreakWaterType.HasValue)
            {
                writer.WriteElementString(ConfigurationSchemaIdentifiers.BreakWaterType,
                                          new ConfigurationBreakWaterTypeConverter().ConvertToInvariantString(waveReduction.BreakWaterType.Value));
            }

            if (waveReduction.BreakWaterHeight.HasValue)
            {
                writer.WriteElementString(ConfigurationSchemaIdentifiers.BreakWaterHeight,
                                          XmlConvert.ToString(waveReduction.BreakWaterHeight.Value));
            }

            if (waveReduction.UseForeshoreProfile.HasValue)
            {
                writer.WriteElementString(ConfigurationSchemaIdentifiers.UseForeshore,
                                          XmlConvert.ToString(waveReduction.UseForeshoreProfile.Value));
            }

            writer.WriteEndElement();
        }
        public void SimpleProperties_SetNewValue_GetsNewlySetValue()
        {
            // Setup
            var configuration = new WaveReductionConfiguration();
            var random        = new Random(21);

            bool   useBreakWater    = random.NextBoolean();
            var    breakWaterType   = random.NextEnumValue <ConfigurationBreakWaterType>();
            double breakWaterHeight = random.NextDouble();
            bool   useForeshore     = random.NextBoolean();

            // Call
            configuration.UseBreakWater       = useBreakWater;
            configuration.BreakWaterType      = breakWaterType;
            configuration.BreakWaterHeight    = breakWaterHeight;
            configuration.UseForeshoreProfile = useForeshore;

            // Assert
            Assert.AreEqual(useBreakWater, configuration.UseBreakWater);
            Assert.AreEqual(breakWaterType, configuration.BreakWaterType);
            Assert.AreEqual(breakWaterHeight, configuration.BreakWaterHeight);
            Assert.AreEqual(useForeshore, configuration.UseForeshoreProfile);
        }
 public void PublicReadWaveReductionParameters<T>(WaveReductionConfiguration waveReduction, T input)
     where T : IUseBreakWater, IUseForeshore
 {
     SetWaveReductionParameters(waveReduction, input);
 }
Exemplo n.º 25
0
        public void WriteWaveReduction_WithoutDifferentSetParameters_WritesStochastWithSetParameters(WaveReductionConfiguration waveReduction, string fileName)
        {
            // Setup
            string filePath = TestHelper.GetScratchPadPath(
                $"{nameof(WriteWaveReduction_WithoutDifferentSetParameters_WritesStochastWithSetParameters)}.{fileName}");

            try
            {
                using (XmlWriter xmlWriter = CreateXmlWriter(filePath))
                {
                    // Call
                    xmlWriter.WriteWaveReduction(waveReduction);
                }

                // Assert
                string actualXml   = File.ReadAllText(filePath);
                string expectedXml = GetTestFileContent(fileName);
                Assert.AreEqual(expectedXml, actualXml);
            }
            finally
            {
                File.Delete(filePath);
            }
        }
 public static void PublicWriteWaveReductionWhenAvailable(XmlWriter writer, WaveReductionConfiguration configuration)
 {
     WriteWaveReductionWhenAvailable(writer, configuration);
 }