Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new instance of <see cref="SerializableCombinedFailureMechanismSectionAssembly"/>.
        /// </summary>
        /// <param name="id">The unique assembly ID.</param>
        /// <param name="totalAssemblyResult">The total assembly result this assembly belongs to.</param>
        /// <param name="section">The section this assembly belongs to.</param>
        /// <param name="failureMechanismResults">The collection of assembly results for this assembly per failure mechanism.</param>
        /// <param name="combinedSectionResult">The combined assembly result for this assembly.</param>
        /// <exception cref="ArgumentNullException">Thrown when any parameter except <paramref name="id"/> is <c>null</c>.</exception>
        /// <exception cref="ArgumentException">Thrown when <paramref name="id"/> is invalid.</exception>
        public SerializableCombinedFailureMechanismSectionAssembly(string id,
                                                                   SerializableTotalAssemblyResult totalAssemblyResult,
                                                                   SerializableFailureMechanismSection section,
                                                                   SerializableCombinedFailureMechanismSectionAssemblyResult[] failureMechanismResults,
                                                                   SerializableFailureMechanismSubSectionAssemblyResult combinedSectionResult)
            : this()
        {
            SerializableIdValidator.ThrowIfInvalid(id);

            if (totalAssemblyResult == null)
            {
                throw new ArgumentNullException(nameof(totalAssemblyResult));
            }

            if (section == null)
            {
                throw new ArgumentNullException(nameof(section));
            }

            if (failureMechanismResults == null)
            {
                throw new ArgumentNullException(nameof(failureMechanismResults));
            }

            if (combinedSectionResult == null)
            {
                throw new ArgumentNullException(nameof(combinedSectionResult));
            }

            Id = id;
            TotalAssemblyResultId     = totalAssemblyResult.Id;
            FailureMechanismSectionId = section.Id;
            FailureMechanismResults   = failureMechanismResults;
            CombinedSectionResult     = combinedSectionResult;
        }
Ejemplo n.º 2
0
        public void Constructor_ExpectedValues()
        {
            // Setup
            var random         = new Random(21);
            var assemblyMethod = random.NextEnumValue <SerializableAssemblyMethod>();
            var assemblyGroup  = random.NextEnumValue <SerializableFailureMechanismSectionAssemblyGroup>();

            // Call
            var assemblyResult = new SerializableFailureMechanismSubSectionAssemblyResult(assemblyMethod, assemblyGroup);

            // Assert
            Assert.AreEqual(assemblyGroup, assemblyResult.AssemblyGroup);
            Assert.AreEqual(assemblyMethod, assemblyResult.AssemblyMethod);
            Assert.AreEqual("VOLLDG", assemblyResult.Status);
        }
Ejemplo n.º 3
0
        public void DefaultConstructor_ReturnsDefaultValues()
        {
            // Call
            var assemblyResult = new SerializableFailureMechanismSubSectionAssemblyResult();

            // Assert
            Assert.AreEqual((SerializableAssemblyMethod)0, assemblyResult.AssemblyMethod);
            Assert.AreEqual((SerializableFailureMechanismSectionAssemblyGroup)0, assemblyResult.AssemblyGroup);
            Assert.AreEqual("VOLLDG", assemblyResult.Status);

            SerializableAttributeTestHelper.AssertXmlElementAttribute <SerializableFailureMechanismSubSectionAssemblyResult>(
                nameof(SerializableFailureMechanismSubSectionAssemblyResult.AssemblyMethod), "assemblagemethode");
            SerializableAttributeTestHelper.AssertXmlElementAttribute <SerializableFailureMechanismSubSectionAssemblyResult>(
                nameof(SerializableFailureMechanismSubSectionAssemblyResult.AssemblyGroup), "duidingsklasse");
            SerializableAttributeTestHelper.AssertXmlElementAttribute <SerializableFailureMechanismSubSectionAssemblyResult>(
                nameof(SerializableFailureMechanismSubSectionAssemblyResult.Status), "status");
        }
        public void Constructor_WithValidData_ReturnsExpectedValues()
        {
            // Setup
            const string id = "id";

            var random        = new Random(39);
            var totalAssembly = new SerializableTotalAssemblyResult("totalAssemblyID",
                                                                    new SerializableAssessmentProcess(),
                                                                    random.NextEnumValue <SerializableAssemblyMethod>(),
                                                                    random.NextEnumValue <SerializableAssemblyMethod>(),
                                                                    random.NextEnumValue <SerializableAssessmentSectionAssemblyGroup>(),
                                                                    random.NextDouble());
            var section = new SerializableFailureMechanismSection("sectionID",
                                                                  new SerializableFailureMechanismSectionCollection(),
                                                                  random.NextDouble(),
                                                                  random.NextDouble(),
                                                                  new[]
            {
                new Point2D(random.NextDouble(), random.NextDouble())
            },
                                                                  SerializableFailureMechanismSectionType.Combined);

            SerializableCombinedFailureMechanismSectionAssemblyResult[] sectionResults = Array.Empty <SerializableCombinedFailureMechanismSectionAssemblyResult>();
            var combinedSectionResult = new SerializableFailureMechanismSubSectionAssemblyResult();

            // Call
            var combinedSectionAssembly = new SerializableCombinedFailureMechanismSectionAssembly(id,
                                                                                                  totalAssembly,
                                                                                                  section,
                                                                                                  sectionResults,
                                                                                                  combinedSectionResult);

            // Assert
            Assert.AreEqual(id, combinedSectionAssembly.Id);
            Assert.AreEqual(totalAssembly.Id, combinedSectionAssembly.TotalAssemblyResultId);
            Assert.AreEqual(section.Id, combinedSectionAssembly.FailureMechanismSectionId);
            Assert.AreSame(sectionResults, combinedSectionAssembly.FailureMechanismResults);
            Assert.AreSame(combinedSectionResult, combinedSectionAssembly.CombinedSectionResult);
        }