예제 #1
0
        public void Constructor_ValidWaternetLine_ExpectedValues()
        {
            // Setup
            MacroStabilityInwardsWaternetLine waternetLine = MacroStabilityInwardsTestDataFactory.CreateMacroStabilityInwardsWaternetLine();

            // Call
            var properties = new MacroStabilityInwardsWaternetLineProperties(waternetLine);

            // Assert
            Assert.IsInstanceOf <ObjectProperties <MacroStabilityInwardsWaternetLine> >(properties);
            TestHelper.AssertTypeConverter <MacroStabilityInwardsWaternetLineProperties, ExpandableReadOnlyArrayConverter>(
                nameof(MacroStabilityInwardsWaternetLineProperties.Geometry));
            Assert.AreSame(waternetLine, properties.Data);
        }
예제 #2
0
        public void ToString_Always_ReturnsName()
        {
            // Setup
            const string expectedName = "PL2";
            var          waternetLine = new MacroStabilityInwardsWaternetLine(expectedName,
                                                                              Enumerable.Empty <Point2D>(),
                                                                              MacroStabilityInwardsTestDataFactory.CreateMacroStabilityInwardsPhreaticLine());
            var properties = new MacroStabilityInwardsWaternetLineProperties(waternetLine);

            // Call
            var name = properties.ToString();

            // Assert
            Assert.AreEqual(name, expectedName);
        }
예제 #3
0
        public void GetProperties_WithData_ReturnExpectedValues()
        {
            // Setup
            var random       = new Random(21);
            var waternetLine = new MacroStabilityInwardsWaternetLine("Zone A",
                                                                     new[]
            {
                new Point2D(random.NextDouble(), random.NextDouble()),
                new Point2D(random.NextDouble(), random.NextDouble())
            },
                                                                     new MacroStabilityInwardsPhreaticLine("PL1", Enumerable.Empty <Point2D>()));

            // Call
            var properties = new MacroStabilityInwardsWaternetLineProperties(waternetLine);

            // Assert
            Assert.AreEqual(waternetLine.Name, properties.Name);
            CollectionAssert.AreEqual(waternetLine.Geometry, properties.Geometry);
            Assert.AreEqual(waternetLine.PhreaticLine.Name, properties.PhreaticLineName);
        }
예제 #4
0
        public void Constructor_ValidData_PropertiesHaveExpectedAttributeValues()
        {
            // Setup
            MacroStabilityInwardsWaternetLine waternetLine = MacroStabilityInwardsTestDataFactory.CreateMacroStabilityInwardsWaternetLine();

            // Call
            var properties = new MacroStabilityInwardsWaternetLineProperties(waternetLine);

            // Assert
            PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);

            Assert.AreEqual(3, dynamicProperties.Count);

            const string waterStressesCategoryName = "Waterspanningen";

            PropertyDescriptor nameProperty = dynamicProperties[0];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty,
                                                                            waterStressesCategoryName,
                                                                            "Naam",
                                                                            "De naam van de zone.",
                                                                            true);

            PropertyDescriptor geometryProperty = dynamicProperties[1];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(geometryProperty,
                                                                            waterStressesCategoryName,
                                                                            "Geometrie",
                                                                            "De geometrie van de zone.",
                                                                            true);

            PropertyDescriptor phreaticLineNameProperty = dynamicProperties[2];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(phreaticLineNameProperty,
                                                                            waterStressesCategoryName,
                                                                            "Stijghoogtelijn",
                                                                            "De stijghoogtelijn behorend bij de zone.",
                                                                            true);
        }