Example #1
0
        public void Read_HydraulicBoundaryDatabaseNull_ThrowsArgumentNullException()
        {
            // Setup
            var entity = new HydraulicBoundaryDatabaseEntity();

            // Call
            TestDelegate call = () => entity.Read(null);

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

            Assert.AreEqual("hydraulicBoundaryDatabase", exception.ParamName);
        }
Example #2
0
        public void Read_WithValidEntity_UpdatesHydraulicBoundaryDatabase()
        {
            // Setup
            var  random = new Random(21);
            bool usePreprocessorClosure = random.NextBoolean();
            var  entity = new HydraulicBoundaryDatabaseEntity
            {
                FilePath = "hydraulicBoundaryDatabaseFilePath",
                Version  = "hydraulicBoundaryDatabaseVersion",
                HydraulicLocationConfigurationSettingsFilePath = "hlcdFilePath",
                HydraulicLocationConfigurationSettingsUsePreprocessorClosure = Convert.ToByte(usePreprocessorClosure),
                HydraulicLocationConfigurationSettingsScenarioName           = "ScenarioName",
                HydraulicLocationConfigurationSettingsYear           = random.Next(),
                HydraulicLocationConfigurationSettingsScope          = "Scope",
                HydraulicLocationConfigurationSettingsSeaLevel       = "SeaLevel",
                HydraulicLocationConfigurationSettingsRiverDischarge = "RiverDischarge",
                HydraulicLocationConfigurationSettingsLakeLevel      = "LakeLevel",
                HydraulicLocationConfigurationSettingsWindDirection  = "WindDirection",
                HydraulicLocationConfigurationSettingsWindSpeed      = "WindSpeed",
                HydraulicLocationConfigurationSettingsComment        = "Comment"
            };

            var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase();

            // Call
            entity.Read(hydraulicBoundaryDatabase);

            // Assert
            Assert.AreEqual(entity.FilePath, hydraulicBoundaryDatabase.FilePath);
            Assert.AreEqual(entity.Version, hydraulicBoundaryDatabase.Version);

            HydraulicLocationConfigurationSettings settings = hydraulicBoundaryDatabase.HydraulicLocationConfigurationSettings;

            Assert.AreEqual(entity.HydraulicLocationConfigurationSettingsFilePath, settings.FilePath);
            Assert.AreEqual(entity.HydraulicLocationConfigurationSettingsScenarioName, settings.ScenarioName);
            Assert.AreEqual(entity.HydraulicLocationConfigurationSettingsYear, settings.Year);
            Assert.AreEqual(entity.HydraulicLocationConfigurationSettingsScope, settings.Scope);
            Assert.AreEqual(usePreprocessorClosure, settings.UsePreprocessorClosure);
            Assert.AreEqual(entity.HydraulicLocationConfigurationSettingsSeaLevel, settings.SeaLevel);
            Assert.AreEqual(entity.HydraulicLocationConfigurationSettingsRiverDischarge, settings.RiverDischarge);
            Assert.AreEqual(entity.HydraulicLocationConfigurationSettingsLakeLevel, settings.LakeLevel);
            Assert.AreEqual(entity.HydraulicLocationConfigurationSettingsWindDirection, settings.WindDirection);
            Assert.AreEqual(entity.HydraulicLocationConfigurationSettingsWindSpeed, settings.WindSpeed);
            Assert.AreEqual(entity.HydraulicLocationConfigurationSettingsComment, settings.Comment);
        }
Example #3
0
        private static void ReadHydraulicDatabase(this AssessmentSectionEntity entity, AssessmentSection assessmentSection, ReadConversionCollector collector)
        {
            HydraulicBoundaryDatabaseEntity hydraulicBoundaryDatabaseEntity = entity.HydraulicBoundaryDatabaseEntities.SingleOrDefault();

            if (hydraulicBoundaryDatabaseEntity != null)
            {
                HydraulicBoundaryDatabase hydraulicBoundaryDatabase = assessmentSection.HydraulicBoundaryDatabase;
                hydraulicBoundaryDatabaseEntity.Read(hydraulicBoundaryDatabase);

                HydraulicBoundaryLocation[] readHydraulicBoundaryLocations = entity.HydraulicLocationEntities
                                                                             .OrderBy(hl => hl.Order)
                                                                             .Select(hle => hle.Read(collector))
                                                                             .ToArray();
                hydraulicBoundaryDatabase.Locations.AddRange(readHydraulicBoundaryLocations);
                assessmentSection.SetHydraulicBoundaryLocationCalculations(readHydraulicBoundaryLocations);

                entity.ReadHydraulicBoundaryLocationCalculations(assessmentSection, collector);
            }
        }