Ejemplo n.º 1
0
        public void Create_HasCalculationOutput_EntityHasPipingCalculationOutputEntity()
        {
            // Setup
            var registry = new PersistenceRegistry();

            var output = new ProbabilisticPipingOutput(PipingTestDataGenerator.GetRandomPartialProbabilisticFaultTreePipingOutput(),
                                                       PipingTestDataGenerator.GetRandomPartialProbabilisticFaultTreePipingOutput());

            var calculation = new ProbabilisticPipingCalculationScenario
            {
                Output = output
            };

            // Call
            ProbabilisticPipingCalculationEntity entity = calculation.Create(registry, 0);

            // Assert
            ProbabilisticPipingCalculationOutputEntity outputEntity = entity.ProbabilisticPipingCalculationOutputEntities.SingleOrDefault();

            Assert.IsNotNull(outputEntity);
            Assert.AreEqual(output.ProfileSpecificOutput.Reliability, outputEntity.ProfileSpecificReliability);
            Assert.AreEqual(output.SectionSpecificOutput.Reliability, outputEntity.SectionSpecificReliability);
            GeneralResultEntityTestHelper.AssertGeneralResultPropertyValues(((PartialProbabilisticFaultTreePipingOutput)output.ProfileSpecificOutput).GeneralResult,
                                                                            outputEntity.GeneralResultFaultTreeIllustrationPointEntity);
            GeneralResultEntityTestHelper.AssertGeneralResultPropertyValues(((PartialProbabilisticFaultTreePipingOutput)output.SectionSpecificOutput).GeneralResult,
                                                                            outputEntity.GeneralResultFaultTreeIllustrationPointEntity1);
        }
Ejemplo n.º 2
0
        public void Read_WithGeneralResultEntity_ReturnsDikeHeightOutputWithGeneralResult()
        {
            // Setup
            var random = new Random(22);

            var generalResultEntity = new GeneralResultFaultTreeIllustrationPointEntity
            {
                GoverningWindDirectionName  = "SSE",
                GoverningWindDirectionAngle = random.NextDouble()
            };

            var convergence = random.NextEnumValue <CalculationConvergence>();
            var entity      = new GrassCoverErosionInwardsDikeHeightOutputEntity
            {
                CalculationConvergence = Convert.ToByte(convergence),
                GeneralResultFaultTreeIllustrationPointEntity = generalResultEntity
            };

            // Call
            DikeHeightOutput output = entity.Read();

            // Assert
            GeneralResultEntityTestHelper.AssertGeneralResultPropertyValues(output.GeneralResult,
                                                                            generalResultEntity);
        }
        public void Read_ValidEntityWithGeneralResultEntity_ReturnsGrassCoverErosionInwardsOutputWithGeneralResult()
        {
            // Setup
            var generalResultEntity = new GeneralResultFaultTreeIllustrationPointEntity
            {
                GoverningWindDirectionAngle = 10,
                GoverningWindDirectionName  = "SSE"
            };
            var entity = new GrassCoverErosionInwardsOutputEntity
            {
                WaveHeight            = null,
                IsOvertoppingDominant = Convert.ToByte(true),
                Reliability           = null,
                GeneralResultFaultTreeIllustrationPointEntity = generalResultEntity
            };

            // Call
            GrassCoverErosionInwardsOutput output = entity.Read();

            // Assert
            OvertoppingOutput overtoppingOutput = output.OvertoppingOutput;

            GeneralResultEntityTestHelper.AssertGeneralResultPropertyValues(overtoppingOutput.GeneralResult,
                                                                            generalResultEntity);
        }
Ejemplo n.º 4
0
        public void CreateHydraulicLocationOutputEntity_WithGeneralResult_ReturnsHydraulicLocationEntityWithGeneralResult()
        {
            // Setup
            var random = new Random(21);
            var output = new HydraulicBoundaryLocationCalculationOutput(double.NaN, double.NaN, double.NaN,
                                                                        double.NaN, double.NaN, random.NextEnumValue <CalculationConvergence>(),
                                                                        GetGeneralResult());

            // Call
            HydraulicLocationOutputEntity entity = output.CreateHydraulicLocationOutputEntity();

            // Assert
            GeneralResultEntityTestHelper.AssertGeneralResultPropertyValues(output.GeneralResult, entity.GeneralResultSubMechanismIllustrationPointEntity);
        }
Ejemplo n.º 5
0
        public void Create_WithGeneralResult_ReturnsGrassCoverErosionInwardsDikeHeightOutputEntityWithGeneralResultEntity()
        {
            // Setup
            var random = new Random(21);
            var output = new OvertoppingRateOutput(double.NaN, double.NaN, double.NaN,
                                                   double.NaN, double.NaN, random.NextEnumValue <CalculationConvergence>(),
                                                   new TestGeneralResultFaultTreeIllustrationPoint());

            // Call
            GrassCoverErosionInwardsOvertoppingRateOutputEntity entity = output.Create();

            // Assert
            Assert.IsNotNull(entity);
            GeneralResultEntityTestHelper.AssertGeneralResultPropertyValues(output.GeneralResult, entity.GeneralResultFaultTreeIllustrationPointEntity);
        }
Ejemplo n.º 6
0
        public void Create_CalculationWithOutputAndGeneralResult_ReturnEntityWithOutputAndGeneralResult()
        {
            // Setup
            var random = new Random(567);
            var output = new StructuresOutput(random.NextDouble(),
                                              new TestGeneralResultFaultTreeIllustrationPoint());

            // Call
            var entity = output.Create <TestStructureOutputEntity>();

            // Assert
            Assert.IsNotNull(entity);
            Assert.AreEqual(output.Reliability, entity.Reliability);
            GeneralResultEntityTestHelper.AssertGeneralResultPropertyValues(output.GeneralResult, entity.GeneralResultFaultTreeIllustrationPointEntity);
        }
Ejemplo n.º 7
0
        public void Create_WithGeneralResult_ReturnsGrassCoverErosionInwardsOutputEntityWithGeneralResultEntity()
        {
            // Setup
            var overtoppingOutput = new OvertoppingOutput(double.NaN,
                                                          true,
                                                          double.NaN,
                                                          new TestGeneralResultFaultTreeIllustrationPoint());

            var output = new GrassCoverErosionInwardsOutput(overtoppingOutput, null, null);

            // Call
            GrassCoverErosionInwardsOutputEntity entity = output.Create();

            // Assert
            GeneralResultEntityTestHelper.AssertGeneralResultPropertyValues(output.OvertoppingOutput.GeneralResult, entity.GeneralResultFaultTreeIllustrationPointEntity);
        }
Ejemplo n.º 8
0
        public void Read_EntityWithSubMechanismIllustrationPoints_ReturnProbabilisticPipingOutput()
        {
            // Setup
            var random = new Random(21);
            var profileSpecificGeneralResultEntity = new GeneralResultSubMechanismIllustrationPointEntity
            {
                GoverningWindDirectionName  = "SSE",
                GoverningWindDirectionAngle = random.NextDouble()
            };
            var sectionSpecificGeneralResultEntity = new GeneralResultSubMechanismIllustrationPointEntity
            {
                GoverningWindDirectionName  = "SSW",
                GoverningWindDirectionAngle = random.NextDouble()
            };

            var entity = new ProbabilisticPipingCalculationOutputEntity
            {
                ProfileSpecificReliability = random.NextDouble(),
                SectionSpecificReliability = random.NextDouble(),
                GeneralResultFaultTreeIllustrationPointEntity     = null,
                GeneralResultFaultTreeIllustrationPointEntity1    = null,
                GeneralResultSubMechanismIllustrationPointEntity  = profileSpecificGeneralResultEntity,
                GeneralResultSubMechanismIllustrationPointEntity1 = sectionSpecificGeneralResultEntity
            };

            // Call
            ProbabilisticPipingOutput output = entity.Read();

            // Assert
            var profileSpecificOutput = (PartialProbabilisticSubMechanismPipingOutput)output.ProfileSpecificOutput;
            var sectionSpecificOutput = (PartialProbabilisticSubMechanismPipingOutput)output.SectionSpecificOutput;

            Assert.AreEqual(entity.ProfileSpecificReliability, output.ProfileSpecificOutput.Reliability);
            Assert.AreEqual(entity.SectionSpecificReliability, output.SectionSpecificOutput.Reliability);

            GeneralResultEntityTestHelper.AssertGeneralResultPropertyValues(
                profileSpecificOutput.GeneralResult, profileSpecificGeneralResultEntity);
            GeneralResultEntityTestHelper.AssertGeneralResultPropertyValues(
                sectionSpecificOutput.GeneralResult, sectionSpecificGeneralResultEntity);
        }
        public void Create_CalculationWithOutputWithFaultTreeIllustrationPoints_ReturnEntityWithOutputAndGeneralResult()
        {
            // Setup
            PartialProbabilisticFaultTreePipingOutput profileSpecificOutput = PipingTestDataGenerator.GetRandomPartialProbabilisticFaultTreePipingOutput();
            PartialProbabilisticFaultTreePipingOutput sectionSpecificOutput = PipingTestDataGenerator.GetRandomPartialProbabilisticFaultTreePipingOutput();
            var output = new ProbabilisticPipingOutput(profileSpecificOutput, sectionSpecificOutput);

            // Call
            ProbabilisticPipingCalculationOutputEntity entity = output.Create();

            // Assert
            Assert.AreEqual(output.ProfileSpecificOutput.Reliability, entity.ProfileSpecificReliability);
            Assert.AreEqual(output.SectionSpecificOutput.Reliability, entity.SectionSpecificReliability);
            GeneralResultEntityTestHelper.AssertGeneralResultPropertyValues(
                profileSpecificOutput.GeneralResult,
                entity.GeneralResultFaultTreeIllustrationPointEntity);
            GeneralResultEntityTestHelper.AssertGeneralResultPropertyValues(
                sectionSpecificOutput.GeneralResult,
                entity.GeneralResultFaultTreeIllustrationPointEntity1);
            Assert.IsNull(entity.GeneralResultSubMechanismIllustrationPointEntity);
            Assert.IsNull(entity.GeneralResultSubMechanismIllustrationPointEntity1);
        }