Exemplo n.º 1
0
        public void Constructor_ExpectedValues()
        {
            // Setup
            var mocks             = new MockRepository();
            var assessmentSection = mocks.Stub <IAssessmentSection>();

            assessmentSection.Stub(a => a.ReferenceLine).Return(new ReferenceLine());
            mocks.ReplayAll();

            var random           = new Random(21);
            var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism
            {
                InAssembly = random.NextBoolean(),
                GeneralWaveImpactAsphaltCoverInput =
                {
                    ApplyLengthEffectInSection = random.NextBoolean()
                }
            };

            // Call
            var properties = new WaveImpactAsphaltCoverFailureMechanismProperties(failureMechanism, assessmentSection);

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

            Assert.AreEqual(2, properties.SectionLength.NumberOfDecimalPlaces);
            Assert.AreEqual(assessmentSection.ReferenceLine.Length,
                            properties.SectionLength,
                            properties.SectionLength.GetAccuracy());

            GeneralWaveImpactAsphaltCoverInput generalWaveImpactAsphaltCoverInput = failureMechanism.GeneralWaveImpactAsphaltCoverInput;

            Assert.AreEqual(2, properties.DeltaL.NumberOfDecimalPlaces);
            Assert.AreEqual(generalWaveImpactAsphaltCoverInput.DeltaL,
                            properties.DeltaL,
                            properties.DeltaL.GetAccuracy());

            Assert.AreEqual(2, properties.N.NumberOfDecimalPlaces);
            Assert.AreEqual(generalWaveImpactAsphaltCoverInput.GetN(assessmentSection.ReferenceLine.Length),
                            properties.N,
                            properties.N.GetAccuracy());
            Assert.AreEqual(generalWaveImpactAsphaltCoverInput.ApplyLengthEffectInSection, properties.ApplyLengthEffectInSection);

            mocks.VerifyAll();
        }
Exemplo n.º 2
0
        public void GetN_SectionLengthNaN_ReturnsNaN()
        {
            // Setup
            var random       = new Random(39);
            var generalInput = new GeneralWaveImpactAsphaltCoverInput
            {
                DeltaL = random.NextRoundedDouble()
            };

            // Call
            double n = generalInput.GetN(double.NaN);

            // Assert
            Assert.IsNaN(n);
        }
Exemplo n.º 3
0
        public void GetN_DeltaLBiggerThanSectionLength_ReturnsCorrectValue()
        {
            // Setup
            var random = new Random(39);

            var generalInput = new GeneralWaveImpactAsphaltCoverInput
            {
                DeltaL = random.NextRoundedDouble(1001, 99999)
            };

            // Call
            double n = generalInput.GetN(random.NextDouble(0, 1000));

            // Assert
            Assert.AreEqual(1, n);
        }
Exemplo n.º 4
0
        public void GetN_DeltaLSmallerThanSectionLength_ReturnsCorrectValue()
        {
            // Setup
            var           random        = new Random(39);
            double        sectionLength = random.NextDouble(1001, 99999);
            RoundedDouble deltaL        = random.NextRoundedDouble(0, 1000);

            var generalInput = new GeneralWaveImpactAsphaltCoverInput
            {
                DeltaL = deltaL
            };

            // Call
            double n = generalInput.GetN(sectionLength);

            // Assert
            Assert.AreEqual(sectionLength / deltaL, n, 1e-2);
        }