예제 #1
0
        public void Constructor_ValidData_PropertiesHaveExpectedAttributeValues()
        {
            // Setup
            MacroStabilityInwardsPhreaticLine phreaticLine = MacroStabilityInwardsTestDataFactory.CreateMacroStabilityInwardsPhreaticLine();

            // Call
            var properties = new MacroStabilityInwardsPhreaticLineProperties(phreaticLine);

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

            Assert.AreEqual(2, dynamicProperties.Count);

            const string waterStressesCategoryName = "Waterspanningen";

            PropertyDescriptor nameProperty = dynamicProperties[0];

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

            PropertyDescriptor geometryProperty = dynamicProperties[1];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(geometryProperty,
                                                                            waterStressesCategoryName,
                                                                            "Geometrie",
                                                                            "De geometrie van de lijn.",
                                                                            true);
        }
        public void Constructor_GeometryNull_ThrowsArgumentNullException()
        {
            // Call
            void Call() => new MacroStabilityInwardsWaternetLine("name", null, MacroStabilityInwardsTestDataFactory.CreateMacroStabilityInwardsPhreaticLine());

            // Assert
            var exception = Assert.Throws <ArgumentNullException>(Call);

            Assert.AreEqual("geometry", exception.ParamName);
        }
 private static MacroStabilityInwardsWaternetLine CreateWaternetLine()
 {
     return(new MacroStabilityInwardsWaternetLine(
                "Test",
                new[]
     {
         new Point2D(0, 0),
         new Point2D(1, 1)
     },
                MacroStabilityInwardsTestDataFactory.CreateMacroStabilityInwardsPhreaticLine()));
 }
 private static MacroStabilityInwardsWaternet CreateWaternet()
 {
     return(new MacroStabilityInwardsWaternet(
                new[]
     {
         MacroStabilityInwardsTestDataFactory.CreateMacroStabilityInwardsPhreaticLine()
     },
                new[]
     {
         MacroStabilityInwardsTestDataFactory.CreateMacroStabilityInwardsWaternetLine()
     }));
 }
예제 #5
0
        public void Constructor_ValidPhreaticLine_ExpectedValues()
        {
            // Setup
            MacroStabilityInwardsPhreaticLine phreaticLine = MacroStabilityInwardsTestDataFactory.CreateMacroStabilityInwardsPhreaticLine();

            // Call
            var properties = new MacroStabilityInwardsPhreaticLineProperties(phreaticLine);

            // Assert
            Assert.IsInstanceOf <ObjectProperties <MacroStabilityInwardsPhreaticLine> >(properties);
            TestHelper.AssertTypeConverter <MacroStabilityInwardsPhreaticLineProperties, ExpandableReadOnlyArrayConverter>(
                nameof(MacroStabilityInwardsPhreaticLineProperties.Geometry));
            Assert.AreSame(phreaticLine, properties.Data);
        }
예제 #6
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);
        }
            private static IEnumerable <TestCaseData> GetUnequalTestCases()
            {
                yield return(new TestCaseData(new MacroStabilityInwardsWaternet(
                                                  new[]
                {
                    new MacroStabilityInwardsPhreaticLine("Test", new Point2D[0])
                },
                                                  new[]
                {
                    MacroStabilityInwardsTestDataFactory.CreateMacroStabilityInwardsWaternetLine()
                }))
                             .SetName("Other phreatic line"));

                yield return(new TestCaseData(new MacroStabilityInwardsWaternet(
                                                  new[]
                {
                    MacroStabilityInwardsTestDataFactory.CreateMacroStabilityInwardsPhreaticLine(),
                    MacroStabilityInwardsTestDataFactory.CreateMacroStabilityInwardsPhreaticLine()
                },
                                                  new[]
                {
                    MacroStabilityInwardsTestDataFactory.CreateMacroStabilityInwardsWaternetLine()
                }))
                             .SetName("Other phreatic line count"));

                yield return(new TestCaseData(new MacroStabilityInwardsWaternet(
                                                  new[]
                {
                    MacroStabilityInwardsTestDataFactory.CreateMacroStabilityInwardsPhreaticLine()
                },
                                                  new[]
                {
                    new MacroStabilityInwardsWaternetLine("Test", new Point2D[0], MacroStabilityInwardsTestDataFactory.CreateMacroStabilityInwardsPhreaticLine())
                }))
                             .SetName("Other Waternet line"));

                yield return(new TestCaseData(new MacroStabilityInwardsWaternet(
                                                  new[]
                {
                    MacroStabilityInwardsTestDataFactory.CreateMacroStabilityInwardsPhreaticLine()
                },
                                                  new[]
                {
                    MacroStabilityInwardsTestDataFactory.CreateMacroStabilityInwardsWaternetLine(),
                    MacroStabilityInwardsTestDataFactory.CreateMacroStabilityInwardsWaternetLine()
                }))
                             .SetName("Other Waternet line count"));
            }
        public void GetProperties_WithData_ReturnExpectedValues()
        {
            // Setup
            var waternet = new MacroStabilityInwardsWaternet(new[]
            {
                MacroStabilityInwardsTestDataFactory.CreateMacroStabilityInwardsPhreaticLine()
            }, new[]
            {
                MacroStabilityInwardsTestDataFactory.CreateMacroStabilityInwardsWaternetLine()
            });

            // Call
            var properties = new MacroStabilityInwardsWaternetProperties(waternet);

            // Assert
            Assert.AreSame(waternet.PhreaticLines.Single(), properties.PhreaticLines.Single().Data);
            Assert.AreSame(waternet.WaternetLines.Single(), properties.WaternetLines.Single().Data);
        }
        public void Constructor_ValidWaternet_ExpectedValues()
        {
            // Setup
            var waternet = new MacroStabilityInwardsWaternet(new[]
            {
                MacroStabilityInwardsTestDataFactory.CreateMacroStabilityInwardsPhreaticLine()
            }, new[]
            {
                MacroStabilityInwardsTestDataFactory.CreateMacroStabilityInwardsWaternetLine()
            });

            // Call
            var properties = new MacroStabilityInwardsWaternetProperties(waternet);

            // Assert
            Assert.IsInstanceOf <ObjectProperties <MacroStabilityInwardsWaternet> >(properties);
            TestHelper.AssertTypeConverter <MacroStabilityInwardsWaternetProperties, ExpandableReadOnlyArrayConverter>(
                nameof(MacroStabilityInwardsWaternetProperties.PhreaticLines));
            Assert.AreSame(waternet, properties.Data);
        }
            private static IEnumerable <TestCaseData> GetUnequalTestCases()
            {
                yield return(new TestCaseData(new MacroStabilityInwardsWaternetLine("Other name", new[]
                {
                    new Point2D(0, 0),
                    new Point2D(1, 1)
                }, MacroStabilityInwardsTestDataFactory.CreateMacroStabilityInwardsPhreaticLine()))
                             .SetName("Other name"));

                yield return(new TestCaseData(new MacroStabilityInwardsWaternetLine("Test", new[]
                {
                    new Point2D(0, 0),
                    new Point2D(1, 1),
                    new Point2D(1, 1)
                }, MacroStabilityInwardsTestDataFactory.CreateMacroStabilityInwardsPhreaticLine()))
                             .SetName("Geometry Count"));

                yield return(new TestCaseData(new MacroStabilityInwardsWaternetLine("Test", new[]
                {
                    new Point2D(0, 0),
                    new Point2D(2, 2)
                }, MacroStabilityInwardsTestDataFactory.CreateMacroStabilityInwardsPhreaticLine()))
                             .SetName("Geometry content"));

                yield return(new TestCaseData(new MacroStabilityInwardsWaternetLine("Test", new[]
                {
                    new Point2D(0, 0),
                    new Point2D(1, 1)
                }, new MacroStabilityInwardsPhreaticLine(
                                                                                        "Test",
                                                                                        new[]
                {
                    new Point2D(0, 0)
                })))
                             .SetName("Other phreatic line"));
            }