Beispiel #1
0
        public void Constructor_Always_PropertiesHaveExpectedAttributesValues()
        {
            // Setup
            var pipingStochasticSoilProfile = new PipingStochasticSoilProfile(0.0, new PipingSoilProfile("", 0.0, new[]
            {
                new PipingSoilLayer(10.0)
            }, SoilProfileType.SoilProfile1D));

            // Call
            var properties = new PipingStochasticSoilProfileProperties(pipingStochasticSoilProfile);

            // Assert
            const string generalCategoryName = "Algemeen";
            PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);

            Assert.AreEqual(5, dynamicProperties.Count);

            PropertyDescriptor nameProperty = dynamicProperties[0];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty,
                                                                            generalCategoryName,
                                                                            "Naam",
                                                                            "De naam van de ondergrondschematisatie.",
                                                                            true);

            PropertyDescriptor contributionProperty = dynamicProperties[1];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(contributionProperty,
                                                                            generalCategoryName,
                                                                            "Aandeel [%]",
                                                                            "Het aandeel van de ondergrondschematisatie in het stochastische ondergrondmodel.",
                                                                            true);

            PropertyDescriptor layersProperty = dynamicProperties[2];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(layersProperty,
                                                                            generalCategoryName,
                                                                            "Grondlagen",
                                                                            "",
                                                                            true);

            PropertyDescriptor bottomProperty = dynamicProperties[3];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(bottomProperty,
                                                                            generalCategoryName,
                                                                            "Bodemniveau",
                                                                            "Het niveau van de onderkant van de ondergrondschematisatie.",
                                                                            true);

            PropertyDescriptor typeProperty = dynamicProperties[4];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(typeProperty,
                                                                            generalCategoryName,
                                                                            "Type",
                                                                            "Het type van de ondergrondschematisatie.",
                                                                            true);
        }
Beispiel #2
0
        public void Constructor_ValidStochasticSoilProfile_ExpectedValues()
        {
            // Setup
            var stochasticSoilProfile = new PipingStochasticSoilProfile(1, PipingSoilProfileTestFactory.CreatePipingSoilProfile());

            // Call
            var properties = new PipingStochasticSoilProfileProperties(stochasticSoilProfile);

            // Assert
            Assert.IsInstanceOf <ObjectProperties <PipingStochasticSoilProfile> >(properties);
            TestHelper.AssertTypeConverter <PipingStochasticSoilProfileProperties,
                                            ExpandableArrayConverter>(nameof(PipingStochasticSoilProfileProperties.Layers));
            TestHelper.AssertTypeConverter <PipingStochasticSoilProfileProperties,
                                            EnumTypeConverter>(nameof(PipingStochasticSoilProfileProperties.Type));
            Assert.AreSame(stochasticSoilProfile, properties.Data);
        }
Beispiel #3
0
        public void GetProperties_WithData_ReturnExpectedValues()
        {
            // Setup
            var layerOne = new PipingSoilLayer(4);
            var layerTwo = new PipingSoilLayer(2);

            IEnumerable <PipingSoilLayer> layers = new[]
            {
                layerOne,
                layerTwo
            };

            var    random                = new Random(21);
            double bottom                = random.NextDouble();
            double probability           = random.NextDouble();
            var    soilProfileType       = random.NextEnumValue <SoilProfileType>();
            var    soilProfile           = new PipingSoilProfile("<some name>", bottom, layers, soilProfileType);
            var    stochasticSoilProfile = new PipingStochasticSoilProfile(probability, soilProfile);

            // Call
            var properties = new PipingStochasticSoilProfileProperties(stochasticSoilProfile);

            // Assert
            Assert.AreEqual(soilProfile.Name, properties.Name);
            Assert.AreEqual(soilProfile.Name, properties.ToString());

            Assert.AreEqual(2, properties.Layers.Length);
            Assert.AreSame(layerOne, properties.Layers[0].Data);
            Assert.AreSame(layerTwo, properties.Layers[1].Data);

            Assert.AreEqual(2, properties.Bottom.NumberOfDecimalPlaces);
            Assert.AreEqual(bottom, properties.Bottom, properties.Bottom.GetAccuracy());
            Assert.AreEqual(2, properties.Probability.NumberOfDecimalPlaces);
            Assert.AreEqual(probability * 100, properties.Probability, properties.Probability.GetAccuracy());
            Assert.AreEqual(soilProfileType, properties.Type);
        }