Exemplo n.º 1
0
        public void Create_SectionResultNull_ThrowsArgumentNullException()
        {
            // Call
            void Call() => SerializableFailureMechanismSectionAssemblyResultCreator.Create(null);

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

            Assert.AreEqual("sectionResult", exception.ParamName);
        }
Exemplo n.º 2
0
        public void Create_SectionResultHasInvalidAssemblyGroup_ThrowsAssemblyCreatorException(FailureMechanismSectionAssemblyGroup assemblyGroup)
        {
            // Setup
            var random        = new Random(21);
            var sectionResult = new ExportableFailureMechanismSectionAssemblyWithProbabilityResult(
                ExportableFailureMechanismSectionTestFactory.CreateExportableFailureMechanismSection(),
                assemblyGroup, random.NextDouble(), random.NextEnumValue <ExportableAssemblyMethod>(),
                random.NextEnumValue <ExportableAssemblyMethod>());

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

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

            Assert.AreEqual("The assembly result is invalid and cannot be created.", exception.Message);
        }
Exemplo n.º 3
0
        public void Create_ValidData_ReturnsSerializableFailureMechanismAssemblyResult()
        {
            // Setup
            ExportableFailureMechanismSectionAssemblyWithProbabilityResult sectionResult = ExportableFailureMechanismSectionAssemblyResultTestFactory.CreateWithProbability(
                ExportableFailureMechanismSectionTestFactory.CreateExportableFailureMechanismSection(), 21);

            // Call
            SerializableFailureMechanismSectionAssemblyResult serializableAssemblyResult = SerializableFailureMechanismSectionAssemblyResultCreator.Create(sectionResult);

            // Assert
            Assert.AreEqual(SerializableAssemblyMethodCreator.Create(sectionResult.ProbabilityAssemblyMethod),
                            serializableAssemblyResult.ProbabilityAssemblyMethod);
            Assert.AreEqual(SerializableAssemblyMethodCreator.Create(sectionResult.AssemblyGroupAssemblyMethod),
                            serializableAssemblyResult.AssemblyGroupAssemblyMethod);
            Assert.AreEqual(SerializableFailureMechanismSectionAssemblyGroupCreator.Create(
                                sectionResult.AssemblyGroup), serializableAssemblyResult.AssemblyGroup);
            Assert.AreEqual(sectionResult.Probability, serializableAssemblyResult.Probability);
        }