예제 #1
0
        public void Constructor_ExpectedValues()
        {
            // Setup
            var random           = new Random(21);
            var failureMechanism = new ClosingStructuresFailureMechanism
            {
                InAssembly = random.NextBoolean()
            };

            // Call
            var properties = new ClosingStructuresFailureMechanismProperties(failureMechanism);

            // Assert
            Assert.IsInstanceOf <ClosingStructuresFailureMechanismPropertiesBase>(properties);
            Assert.AreSame(failureMechanism, properties.Data);
            Assert.AreEqual(failureMechanism.Name, properties.Name);
            Assert.AreEqual(failureMechanism.Code, properties.Code);
            Assert.AreEqual(failureMechanism.InAssembly, properties.InAssembly);

            GeneralClosingStructuresInput generalInput = failureMechanism.GeneralInput;

            Assert.AreEqual(generalInput.C, properties.C);
            Assert.AreEqual(generalInput.N2A, properties.N2A);
            Assert.AreEqual(2, properties.N.NumberOfDecimalPlaces);
            Assert.AreEqual(generalInput.N, properties.N, properties.N.GetAccuracy());
            Assert.AreEqual(generalInput.ApplyLengthEffectInSection, properties.ApplyLengthEffectInSection);
        }
        public void Constructor_ExpectedValues()
        {
            // Setup
            var failureMechanism = new ClosingStructuresFailureMechanism();

            // Call
            var properties = new ClosingStructuresFailureMechanismProperties(failureMechanism);

            // Assert
            Assert.IsInstanceOf <ClosingStructuresFailureMechanismPropertiesBase>(properties);
            Assert.AreSame(failureMechanism, properties.Data);
            Assert.AreEqual(failureMechanism.Name, properties.Name);
            Assert.AreEqual(failureMechanism.Code, properties.Code);

            GeneralClosingStructuresInput generalInput = failureMechanism.GeneralInput;

            Assert.AreEqual(generalInput.GravitationalAcceleration,
                            properties.GravitationalAcceleration);

            Assert.AreEqual(generalInput.ModelFactorOvertoppingFlow.Mean, properties.ModelFactorOvertoppingFlow.Mean);
            Assert.AreEqual(generalInput.ModelFactorOvertoppingFlow.StandardDeviation, properties.ModelFactorOvertoppingFlow.StandardDeviation);
            Assert.AreEqual(generalInput.ModelFactorStorageVolume.Mean, properties.ModelFactorStorageVolume.Mean);
            Assert.AreEqual(generalInput.ModelFactorStorageVolume.StandardDeviation, properties.ModelFactorStorageVolume.StandardDeviation);
            Assert.AreEqual(generalInput.ModelFactorLongThreshold.Mean, properties.ModelFactorLongThreshold.Mean);
            Assert.AreEqual(generalInput.ModelFactorLongThreshold.StandardDeviation, properties.ModelFactorLongThreshold.StandardDeviation);
            Assert.AreEqual(generalInput.ModelFactorInflowVolume, properties.ModelFactorInflowVolume);
        }
        public void N2A_ValuesOutOfRange_ThrowArgumentOutOfRangeException(int invalidValue)
        {
            // Setup
            var inputParameters = new GeneralClosingStructuresInput();

            // Call
            TestDelegate call = () => inputParameters.N2A = invalidValue;

            // Assert
            TestHelper.AssertThrowsArgumentExceptionAndTestMessage <ArgumentOutOfRangeException>(
                call, "De waarde voor 'N2A' moet in het bereik [0, 40] liggen.");
        }
예제 #4
0
        public void Read_Always_ReturnGeneralClosingStructuresInput()
        {
            // Setup
            var entity = new ClosingStructuresFailureMechanismMetaEntity
            {
                N2A = new Random(39).Next(1, 40)
            };

            // Call
            GeneralClosingStructuresInput generalInput = entity.Read();

            // Assert
            Assert.AreEqual(entity.N2A, generalInput.N2A);
        }
        public void N_VariousN2AValues_ReturnsExpectedValue(int n2A, double expected)
        {
            // Setup
            var inputParameters = new GeneralClosingStructuresInput
            {
                N2A = n2A
            };

            // Call
            double n = inputParameters.N;

            // Assert
            Assert.AreEqual(expected, n);
        }
        public void Constructor_ExpectedValues()
        {
            // Setup
            var modelFactorOvertoppingFlow = new LogNormalDistribution(3)
            {
                Mean = (RoundedDouble)0.09,
                StandardDeviation = (RoundedDouble)0.06
            };

            var modelFactorStorageVolume = new LogNormalDistribution(2)
            {
                Mean = (RoundedDouble)1.0,
                StandardDeviation = (RoundedDouble)0.2
            };

            var modelFactorLongThreshold = new NormalDistribution(2)
            {
                Mean = (RoundedDouble)0.9,
                StandardDeviation = (RoundedDouble)0.05
            };

            // Call
            var inputParameters = new GeneralClosingStructuresInput();

            // Assert
            Assert.AreEqual(2, inputParameters.C.NumberOfDecimalPlaces);
            AssertAreEqual(0.5, inputParameters.C);
            Assert.AreEqual(1, inputParameters.N2A);
            Assert.IsFalse(inputParameters.ApplyLengthEffectInSection);

            Assert.AreEqual(2, inputParameters.GravitationalAcceleration.NumberOfDecimalPlaces);
            AssertAreEqual(9.81, inputParameters.GravitationalAcceleration);

            DistributionAssert.AreEqual(modelFactorOvertoppingFlow, inputParameters.ModelFactorOvertoppingFlow);
            DistributionAssert.AreEqual(modelFactorStorageVolume, inputParameters.ModelFactorStorageVolume);
            DistributionAssert.AreEqual(modelFactorLongThreshold, inputParameters.ModelFactorLongThreshold);

            Assert.AreEqual(2, inputParameters.ModelFactorInflowVolume.NumberOfDecimalPlaces);
            AssertAreEqual(1.0, inputParameters.ModelFactorInflowVolume);
        }