/// <summary> /// Creates a new instance of <see cref="ExportableCombinedFailureMechanismSection"/>. /// </summary> /// <param name="geometry">The geometry of the failure mechanism section.</param> /// <param name="startDistance">The start distance of the failure mechanism section between the section /// and the start of the reference line in meters.</param> /// <param name="endDistance">The end distance of the failure mechanism section between the section /// and the start of the reference line in meters.</param> /// <param name="assemblyMethod">The assembly method which was used to get this section.</param> /// <exception cref="ArgumentNullException">Thrown when <paramref name="geometry"/> /// is <c>null</c>.</exception> public ExportableCombinedFailureMechanismSection(IEnumerable <Point2D> geometry, double startDistance, double endDistance, ExportableAssemblyMethod assemblyMethod) : base(geometry, startDistance, endDistance) { AssemblyMethod = assemblyMethod; }
/// <summary> /// Creates an instance of <see cref="ExportableAssessmentSectionAssemblyResult"/>. /// </summary> /// <param name="assemblyGroup">The group of this assembly result.</param> /// <param name="probability">The probability of this assembly result.</param> /// <param name="assemblyGroupAssemblyMethod">The method that was used to assemble the assembly group of this result.</param> /// <param name="probabilityAssemblyMethod">The method that was used to assemble the probability of this result.</param> public ExportableAssessmentSectionAssemblyResult(AssessmentSectionAssemblyGroup assemblyGroup, double probability, ExportableAssemblyMethod assemblyGroupAssemblyMethod, ExportableAssemblyMethod probabilityAssemblyMethod) { AssemblyGroup = assemblyGroup; Probability = probability; AssemblyGroupAssemblyMethod = assemblyGroupAssemblyMethod; ProbabilityAssemblyMethod = probabilityAssemblyMethod; }
public void Create_WithAssemblyMethod_ReturnsExpectedValues(AssemblyMethod assemblyMethod, ExportableAssemblyMethod expectedAssemblyMethod) { // Call ExportableAssemblyMethod exportableAssemblyMethod = ExportableAssemblyMethodFactory.Create(assemblyMethod); // Assert Assert.AreEqual(expectedAssemblyMethod, exportableAssemblyMethod); }
public void Create_WithAssemblyMethod_ReturnsExpectedValues(ExportableAssemblyMethod assemblyMethod, SerializableAssemblyMethod expectedAssemblyMethod) { // Call SerializableAssemblyMethod serializableAssemblyMethod = SerializableAssemblyMethodCreator.Create(assemblyMethod); // Assert Assert.AreEqual(expectedAssemblyMethod, serializableAssemblyMethod); }
/// <summary> /// Creates a new instance of <see cref="ExportableFailureMechanismSectionAssemblyResult"/>. /// </summary> /// <param name="failureMechanismSection">The failure mechanism section.</param> /// <param name="assemblyGroup">The assembly group of this section.</param> /// <param name="probability">The probability of this section.</param> /// <param name="assemblyGroupAssemblyMethod">The method used to assemble the assembly group for this section.</param> /// <param name="probabilityAssemblyMethod">The method used to assemble the probability for this section.</param> /// <exception cref="ArgumentNullException">Thrown when <paramref name="failureMechanismSection"/> is <c>null</c>.</exception> public ExportableFailureMechanismSectionAssemblyWithProbabilityResult(ExportableFailureMechanismSection failureMechanismSection, FailureMechanismSectionAssemblyGroup assemblyGroup, double probability, ExportableAssemblyMethod assemblyGroupAssemblyMethod, ExportableAssemblyMethod probabilityAssemblyMethod) : base(failureMechanismSection, assemblyGroup, assemblyGroupAssemblyMethod) { Probability = probability; ProbabilityAssemblyMethod = probabilityAssemblyMethod; }
/// <summary> /// Creates a <see cref="SerializableAssemblyMethod"/> based on /// <paramref name="assemblyMethod"/>. /// </summary> /// <param name="assemblyMethod">The <see cref="ExportableAssemblyMethod"/> /// to create a <see cref="SerializableAssemblyMethod"/> for.</param> /// <returns>A <see cref="SerializableAssemblyMethod"/>.</returns> /// <exception cref="InvalidEnumArgumentException">Thrown when <paramref name="assemblyMethod"/> /// is an invalid value.</exception> /// <exception cref="NotSupportedException">Thrown when <paramref name="assemblyMethod"/> /// is a valid value, but unsupported.</exception> public static SerializableAssemblyMethod Create(ExportableAssemblyMethod assemblyMethod) { if (!Enum.IsDefined(typeof(ExportableAssemblyMethod), assemblyMethod)) { throw new InvalidEnumArgumentException(nameof(assemblyMethod), (int)assemblyMethod, typeof(ExportableAssemblyMethod)); } switch (assemblyMethod) { case ExportableAssemblyMethod.BOI0A1: return(SerializableAssemblyMethod.BOI0A1); case ExportableAssemblyMethod.BOI0A2: return(SerializableAssemblyMethod.BOI0A2); case ExportableAssemblyMethod.BOI0B1: return(SerializableAssemblyMethod.BOI0B1); case ExportableAssemblyMethod.BOI0C1: return(SerializableAssemblyMethod.BOI0C1); case ExportableAssemblyMethod.BOI0C2: return(SerializableAssemblyMethod.BOI0C2); case ExportableAssemblyMethod.BOI1A1: return(SerializableAssemblyMethod.BOI1A1); case ExportableAssemblyMethod.BOI1A2: return(SerializableAssemblyMethod.BOI1A2); case ExportableAssemblyMethod.Manual: return(SerializableAssemblyMethod.Manual); case ExportableAssemblyMethod.BOI2A1: return(SerializableAssemblyMethod.BOI2A1); case ExportableAssemblyMethod.BOI2B1: return(SerializableAssemblyMethod.BOI2B1); case ExportableAssemblyMethod.BOI3A1: return(SerializableAssemblyMethod.BOI3A1); case ExportableAssemblyMethod.BOI3B1: return(SerializableAssemblyMethod.BOI3B1); case ExportableAssemblyMethod.BOI3C1: return(SerializableAssemblyMethod.BOI3C1); default: throw new NotSupportedException(); } }
public void Create_InvalidAssemblyMethod_ThrowInvalidEnumArgumentException() { // Setup const ExportableAssemblyMethod assemblyMethod = (ExportableAssemblyMethod)999; // Call void Call() => SerializableAssemblyMethodCreator.Create(assemblyMethod); // Assert var message = $"The value of argument 'assemblyMethod' ({assemblyMethod}) is invalid for Enum type '{nameof(ExportableAssemblyMethod)}'."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage <InvalidEnumArgumentException>(Call, message); }
/// <summary> /// Creates a new instance of <see cref="ExportableFailureMechanismSectionAssemblyResult"/>. /// </summary> /// <param name="failureMechanismSection">The failure mechanism section.</param> /// <param name="assemblyGroup">The assembly group of this section.</param> /// <param name="assemblyGroupAssemblyMethod">The method used to assemble the assembly group for this section.</param> /// <exception cref="ArgumentNullException">Thrown when <paramref name="failureMechanismSection"/> is <c>null</c>.</exception> public ExportableFailureMechanismSectionAssemblyResult(ExportableFailureMechanismSection failureMechanismSection, FailureMechanismSectionAssemblyGroup assemblyGroup, ExportableAssemblyMethod assemblyGroupAssemblyMethod) { if (failureMechanismSection == null) { throw new ArgumentNullException(nameof(failureMechanismSection)); } FailureMechanismSection = failureMechanismSection; AssemblyGroup = assemblyGroup; AssemblyGroupAssemblyMethod = assemblyGroupAssemblyMethod; }
/// <summary> /// Creates a new instance of <see cref="ExportableFailureMechanismSubSectionAssemblyResult"/>. /// </summary> /// <param name="assemblyMethod">The method that was used to assemble this result.</param> /// <param name="assemblyGroup">The assembly group of this section.</param> public ExportableFailureMechanismSubSectionAssemblyResult(FailureMechanismSectionAssemblyGroup assemblyGroup, ExportableAssemblyMethod assemblyMethod) { AssemblyMethod = assemblyMethod; AssemblyGroup = assemblyGroup; }
/// <summary> /// Creates a new instance of <see cref="ExportableFailureMechanismAssemblyResult"/>. /// </summary> /// <param name="probability">The probability of the assembly result.</param> /// <param name="assemblyMethod">The method that was used to assemble this result.</param> public ExportableFailureMechanismAssemblyResult(double probability, ExportableAssemblyMethod assemblyMethod) { Probability = probability; AssemblyMethod = assemblyMethod; }