Esempio n. 1
0
        private static IEnumerable <string> GetMissingAttributes(PolylineShapeFileReader polylineShapeFileReader)
        {
            if (!polylineShapeFileReader.HasAttribute(assessmentsectionIdAttributeKey))
            {
                yield return(assessmentsectionIdAttributeKey);
            }

            if (!polylineShapeFileReader.HasAttribute(signalFloodingProbabilityValueAttributeKey))
            {
                yield return(signalFloodingProbabilityValueAttributeKey);
            }

            if (!polylineShapeFileReader.HasAttribute(maximumAllowableFloodingProbabilityValueAttributeKey))
            {
                yield return(maximumAllowableFloodingProbabilityValueAttributeKey);
            }
        }
 /// <summary>
 /// Validates the existence of required attributes.
 /// </summary>
 /// <exception cref="CriticalFileReadException">Thrown when the shapefile does not have
 /// a required attribute defined.</exception>
 private void ValidateExistenceOfRequiredAttributes()
 {
     if (!polylineShapeFileReader.HasAttribute(sectionNameAttributeKey))
     {
         throw CreateCriticalFileReadException(
                   string.Format(RiskeerCommonIOResources.FailureMechanismSectionReader_File_lacks_required_Attribute_0_,
                                 sectionNameAttributeKey));
     }
 }
Esempio n. 3
0
        public void HasAttribute_VariousCases_ReturnTrueIfMatchesInProperCaseHasBeenFound(string attributeName, bool expectedResult)
        {
            // Setup
            string shapefileFilePath = TestHelper.GetTestDataPath(TestDataPath.Core.Components.Gis.IO,
                                                                  "Multiple_PolyLine_with_ID.shp");

            using (var reader = new PolylineShapeFileReader(shapefileFilePath))
            {
                // Call
                bool result = reader.HasAttribute(attributeName);

                // Assert
                Assert.AreEqual(expectedResult, result);
            }
        }
Esempio n. 4
0
        public void HasAttribute_AttributeInShapefile_ReturnTrue()
        {
            // Setup
            string shapefileFilePath = TestHelper.GetTestDataPath(TestDataPath.Core.Components.Gis.IO,
                                                                  "Multiple_PolyLine_with_ID.shp");

            using (var reader = new PolylineShapeFileReader(shapefileFilePath))
            {
                // Call
                bool result = reader.HasAttribute("id");

                // Assert
                Assert.IsTrue(result);
            }
        }