Exemplo n.º 1
0
        public void Constructor_DuneLocationCalculationWithoutOutput_ExpectedValues()
        {
            // Setup
            var duneLocationCalculation = new DuneLocationCalculation(new TestDuneLocation());

            // Call
            var row = new DuneLocationCalculationRow(duneLocationCalculation);

            // Assert
            Assert.IsNaN(row.WaterLevel);
            Assert.IsNaN(row.WaveHeight);
            Assert.IsNaN(row.WavePeriod);
        }
Exemplo n.º 2
0
        public void Constructor_DuneLocationCalculationWithOutput_ExpectedValues(double offSet)
        {
            // Setup
            var duneLocation = new DuneLocation(1, "test location", new Point2D(3.3, 4.4), new DuneLocation.ConstructionProperties
            {
                CoastalAreaId = 2,
                Offset        = offSet,
                D50           = 0.000183
            });
            var duneLocationCalculation = new DuneLocationCalculation(duneLocation)
            {
                Output = new DuneLocationCalculationOutput(CalculationConvergence.CalculatedConverged, new DuneLocationCalculationOutput.ConstructionProperties
                {
                    WaterLevel = 3.0,
                    WaveHeight = 4.0,
                    WavePeriod = 5.0
                })
            };

            // Call
            var row = new DuneLocationCalculationRow(duneLocationCalculation);

            // Assert
            Assert.IsInstanceOf <CalculatableRow <DuneLocationCalculation> >(row);
            Assert.AreSame(duneLocationCalculation, row.CalculatableObject);
            Assert.AreEqual(duneLocation.Id, row.Id);
            Assert.AreEqual(duneLocation.Name, row.Name);
            Assert.AreSame(duneLocation.Location, row.Location);
            Assert.AreEqual(duneLocation.CoastalAreaId, row.CoastalAreaId);
            Assert.AreEqual(duneLocation.Offset.ToString("0.#", CultureInfo.InvariantCulture), row.Offset);
            Assert.AreEqual(duneLocation.D50, row.D50);
            Assert.AreEqual(duneLocationCalculation.Output.WaterLevel, row.WaterLevel);
            Assert.AreEqual(duneLocationCalculation.Output.WaveHeight, row.WaveHeight);
            Assert.AreEqual(duneLocationCalculation.Output.WavePeriod, row.WavePeriod);

            TestHelper.AssertTypeConverter <DuneLocationCalculationRow, NoValueRoundedDoubleConverter>(
                nameof(DuneLocationCalculationRow.WaterLevel));
            TestHelper.AssertTypeConverter <DuneLocationCalculationRow, NoValueRoundedDoubleConverter>(
                nameof(DuneLocationCalculationRow.WaveHeight));
            TestHelper.AssertTypeConverter <DuneLocationCalculationRow, NoValueRoundedDoubleConverter>(
                nameof(DuneLocationCalculationRow.WavePeriod));
        }