public void Constructor_ValidPipingSoilLayer_ExpectedValues()
        {
            // Setup
            var soilLayer = new PipingSoilLayer(2.0);

            // Call
            var properties = new PipingSoilLayerProperties(soilLayer);

            // Assert
            Assert.IsInstanceOf <ObjectProperties <PipingSoilLayer> >(properties);
            Assert.AreSame(soilLayer, properties.Data);
        }
        public void GetProperties_WithDataEmptyName_ReturnExpectedValues()
        {
            // Setup
            var layer = new PipingSoilLayer(-2.91)
            {
                MaterialName = string.Empty
            };

            // Call
            var properties = new PipingSoilLayerProperties(layer);

            // Assert
            Assert.AreEqual("Onbekend", properties.Name);
        }
        public void ToString_EmptyName_ReturnsDefaultName()
        {
            // Setup
            var layer = new PipingSoilLayer(-2.9)
            {
                MaterialName = string.Empty
            };

            var properties = new PipingSoilLayerProperties(layer);

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

            // Assert
            Assert.AreEqual("Onbekend", name);
        }
        public void ToString_ValidName_ReturnsMaterialName()
        {
            // Setup
            var layer = new PipingSoilLayer(-2.9)
            {
                MaterialName = "Layer A"
            };

            var properties = new PipingSoilLayerProperties(layer);

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

            // Assert
            Assert.AreEqual(layer.MaterialName, name);
        }
        public void GetProperties_WithData_ReturnExpectedValues()
        {
            // Setup
            var    random   = new Random(21);
            double topLevel = random.NextDouble();

            var layer = new PipingSoilLayer(topLevel)
            {
                MaterialName = "Test Name",
                IsAquifer    = true
            };

            // Call
            var properties = new PipingSoilLayerProperties(layer);

            // Assert
            Assert.AreEqual(layer.MaterialName, properties.Name);
            Assert.AreEqual(layer.IsAquifer, properties.IsAquifer);
            Assert.AreEqual(2, properties.TopLevel.NumberOfDecimalPlaces);
            Assert.AreEqual(topLevel, properties.TopLevel, properties.TopLevel.GetAccuracy());
        }
        public void Constructor_ValidData_PropertiesHaveExpectedAttributeValues()
        {
            // Setup
            var layer = new PipingSoilLayer(-2.9);

            // Call
            var properties = new PipingSoilLayerProperties(layer);

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

            Assert.AreEqual(3, dynamicProperties.Count);

            const string generalCategoryName = "Algemeen";

            PropertyDescriptor nameProperty = dynamicProperties[0];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty,
                                                                            generalCategoryName,
                                                                            "Naam",
                                                                            "De naam van de grondlaag.",
                                                                            true);
            PropertyDescriptor topLevelProperty = dynamicProperties[1];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(topLevelProperty,
                                                                            generalCategoryName,
                                                                            "Topniveau",
                                                                            "Het niveau van de bovenkant van deze grondlaag binnen de ondergrondschematisatie.",
                                                                            true);
            PropertyDescriptor isAquiferProperty = dynamicProperties[2];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(isAquiferProperty,
                                                                            generalCategoryName,
                                                                            "Is aquifer",
                                                                            "Geeft aan of deze grondlaag een watervoerende laag betreft.",
                                                                            true);
        }