public void Create_SectionResultNull_ThrowsArgumentNullException()
        {
            // Call
            void Call() => SerializableCombinedFailureMechanismSectionAssemblyResultCreator.Create(null);

            // Assert
            var exception = Assert.Throws <ArgumentNullException>(Call);

            Assert.AreEqual("sectionResult", exception.ParamName);
        }
        public void Create_SectionResultWithInvalidAssemblyGroup_ThrowsAssemblyCreatorException(FailureMechanismSectionAssemblyGroup assemblyGroup)
        {
            // Setup
            var random        = new Random(21);
            var sectionResult = new ExportableFailureMechanismCombinedSectionAssemblyResult(
                new ExportableFailureMechanismSubSectionAssemblyResult(assemblyGroup, random.NextEnumValue <ExportableAssemblyMethod>()),
                random.NextEnumValue <ExportableFailureMechanismType>(),
                "code",
                "name");

            // Call
            void Call() => SerializableCombinedFailureMechanismSectionAssemblyResultCreator.Create(sectionResult);

            // Assert
            var exception = Assert.Throws <AssemblyCreatorException>(Call);

            Assert.AreEqual("The assembly result is invalid and cannot be created.", exception.Message);
        }
        public void Create_WithExportableFailureMechanismCombinedSectionAssemblyResult_ReturnsSerializableCombinedFailureMechanismSectionAssemblyResult()
        {
            // Setup
            var random        = new Random(21);
            var sectionResult = new ExportableFailureMechanismCombinedSectionAssemblyResult(
                CreateSectionAssemblyResult(), random.NextEnumValue <ExportableFailureMechanismType>(), "code", "name");

            // Call
            SerializableCombinedFailureMechanismSectionAssemblyResult serializableResult =
                SerializableCombinedFailureMechanismSectionAssemblyResultCreator.Create(sectionResult);

            // Assert
            Assert.AreEqual(SerializableFailureMechanismTypeCreator.Create(sectionResult.FailureMechanismType),
                            serializableResult.FailureMechanismType);
            Assert.AreEqual(sectionResult.Code, serializableResult.GenericFailureMechanismCode);
            ExportableFailureMechanismSubSectionAssemblyResult expectedSectionAssemblyResult = sectionResult.SectionAssemblyResult;

            Assert.AreEqual(SerializableFailureMechanismSectionAssemblyGroupCreator.Create(expectedSectionAssemblyResult.AssemblyGroup),
                            serializableResult.AssemblyGroup);
            Assert.AreEqual(SerializableAssemblyMethodCreator.Create(expectedSectionAssemblyResult.AssemblyMethod),
                            serializableResult.AssemblyMethod);
        }