Ejemplo n.º 1
0
        public void CopyProperties_FromStructureNull_ThrowsArgumentNullException()
        {
            // Setup
            var structure = new HeightStructure(new HeightStructure.ConstructionProperties
            {
                Name     = "aName",
                Id       = "anId",
                Location = new Point2D(0, 0)
            });

            // Call
            TestDelegate call = () => structure.CopyProperties(null);

            // Assert
            string paramName = Assert.Throws <ArgumentNullException>(call).ParamName;

            Assert.AreEqual("fromStructure", paramName);
        }
Ejemplo n.º 2
0
        public void CopyProperties_FromStructure_UpdatesProperties()
        {
            // Setup
            var random    = new Random(123);
            var structure = new HeightStructure(new HeightStructure.ConstructionProperties
            {
                Name     = "aName",
                Id       = "anId",
                Location = new Point2D(0, 0)
            });

            var otherStructure = new HeightStructure(new HeightStructure.ConstructionProperties
            {
                Name     = "otherName",
                Id       = "otherId",
                Location = new Point2D(1, 1),
                StructureNormalOrientation  = random.NextRoundedDouble(),
                AllowedLevelIncreaseStorage =
                {
                    Mean              = random.NextRoundedDouble(),
                    StandardDeviation = random.NextRoundedDouble()
                },
                CriticalOvertoppingDischarge =
                {
                    Mean                   = random.NextRoundedDouble(),
                    CoefficientOfVariation = random.NextRoundedDouble()
                },
                FailureProbabilityStructureWithErosion = random.NextDouble(),
                FlowWidthAtBottomProtection            =
                {
                    Mean              = random.NextRoundedDouble(),
                    StandardDeviation = random.NextRoundedDouble()
                },
                LevelCrestStructure =
                {
                    Mean              = random.NextRoundedDouble(),
                    StandardDeviation = random.NextRoundedDouble()
                },
                StorageStructureArea =
                {
                    Mean                   = random.NextRoundedDouble(),
                    CoefficientOfVariation = random.NextRoundedDouble()
                },
                WidthFlowApertures =
                {
                    Mean              = random.NextRoundedDouble(),
                    StandardDeviation = random.NextRoundedDouble()
                }
            });

            // Call
            structure.CopyProperties(otherStructure);

            // Assert
            Assert.AreNotEqual(otherStructure.Id, structure.Id);
            Assert.AreEqual(otherStructure.Name, structure.Name);
            TestHelper.AssertAreEqualButNotSame(otherStructure.Location, structure.Location);
            Assert.AreEqual(otherStructure.StructureNormalOrientation, structure.StructureNormalOrientation);
            TestHelper.AssertAreEqualButNotSame(otherStructure.AllowedLevelIncreaseStorage, structure.AllowedLevelIncreaseStorage);
            TestHelper.AssertAreEqualButNotSame(otherStructure.CriticalOvertoppingDischarge, structure.CriticalOvertoppingDischarge);
            Assert.AreEqual(otherStructure.FailureProbabilityStructureWithErosion, structure.FailureProbabilityStructureWithErosion);
            TestHelper.AssertAreEqualButNotSame(otherStructure.FlowWidthAtBottomProtection, structure.FlowWidthAtBottomProtection);
            TestHelper.AssertAreEqualButNotSame(otherStructure.LevelCrestStructure, structure.LevelCrestStructure);
            TestHelper.AssertAreEqualButNotSame(otherStructure.StorageStructureArea, structure.StorageStructureArea);
            TestHelper.AssertAreEqualButNotSame(otherStructure.WidthFlowApertures, structure.WidthFlowApertures);
        }