public void Constructor_DefaultPropertiesSet() { // Call var pipingProbabilityAssessmentInput = new PipingProbabilityAssessmentInput(); // Assert Assert.IsInstanceOf <ProbabilityAssessmentInput>(pipingProbabilityAssessmentInput); Assert.AreEqual(0.4, pipingProbabilityAssessmentInput.A); Assert.AreEqual(300, pipingProbabilityAssessmentInput.B); }
public void ReadProbabilityAssessmentInput_EntityNull_ThrowsArgumentNullException() { // Setup var input = new PipingProbabilityAssessmentInput(); // Call void Call() => ((PipingFailureMechanismMetaEntity)null).ReadProbabilityAssessmentInput(input); // Assert var exception = Assert.Throws <ArgumentNullException>(Call); Assert.AreEqual("entity", exception.ParamName); }
public void ReadProbabilityAssessmentInput_ValidParameters_SetPipingProbabilityAssessmentInputProperties() { // Setup var inputToUpdate = new PipingProbabilityAssessmentInput(); var entity = new PipingFailureMechanismMetaEntity { A = new Random(31).NextDouble() }; // Call entity.ReadProbabilityAssessmentInput(inputToUpdate); // Assert Assert.AreEqual(entity.A, inputToUpdate.A); }
/// <summary> /// Read the <see cref="PipingFailureMechanismMetaEntity"/> and use the information to update the /// <paramref name="probabilityAssessmentInput"/>. /// </summary> /// <param name="entity">The <see cref="PipingFailureMechanismMetaEntity"/> to use to update the /// <paramref name="probabilityAssessmentInput"/>.</param> /// <param name="probabilityAssessmentInput">The <see cref="PipingProbabilityAssessmentInput"/> to be /// updated.</param> /// <exception cref="ArgumentNullException">Thrown when any input parameter is <c>null</c>.</exception> internal static void ReadProbabilityAssessmentInput(this PipingFailureMechanismMetaEntity entity, PipingProbabilityAssessmentInput probabilityAssessmentInput) { if (entity == null) { throw new ArgumentNullException(nameof(entity)); } if (probabilityAssessmentInput == null) { throw new ArgumentNullException(nameof(probabilityAssessmentInput)); } probabilityAssessmentInput.A = entity.A; }
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 PipingFailureMechanism { InAssembly = random.NextBoolean() }; // Call var properties = new PipingFailureMechanismProperties(failureMechanism, assessmentSection); // Assert Assert.IsInstanceOf <PipingFailureMechanismPropertiesBase>(properties); Assert.AreEqual(failureMechanism.Name, properties.Name); Assert.AreEqual(failureMechanism.Code, properties.Code); Assert.AreEqual(failureMechanism.InAssembly, properties.InAssembly); PipingProbabilityAssessmentInput probabilityAssessmentInput = failureMechanism.PipingProbabilityAssessmentInput; Assert.AreEqual(probabilityAssessmentInput.A, properties.A); Assert.AreEqual(probabilityAssessmentInput.B, properties.B); Assert.AreEqual(2, properties.N.NumberOfDecimalPlaces); Assert.AreEqual(probabilityAssessmentInput.GetN(assessmentSection.ReferenceLine.Length), properties.N, properties.N.GetAccuracy()); Assert.AreEqual(2, properties.SectionLength.NumberOfDecimalPlaces); Assert.AreEqual(assessmentSection.ReferenceLine.Length, properties.SectionLength, properties.SectionLength.GetAccuracy()); Assert.AreEqual(failureMechanism.GeneralInput.ApplyLengthEffectInSection, properties.ApplyLengthEffectInSection); mocks.VerifyAll(); }