private static ExportableAssessmentSection CreateAssessmentSection(string name, string id)
 {
     return(new ExportableAssessmentSection(
                name, id, CreateGeometry(), ExportableAssessmentSectionAssemblyResultTestFactory.CreateResult(),
                Enumerable.Empty <ExportableFailureMechanism>(),
                Enumerable.Empty <ExportableCombinedSectionAssembly>()));
 }
Exemplo n.º 2
0
        public void Constructor_CombinedSectionAssemblyResultsNull_ThrowsArgumentNullException()
        {
            // Call
            void Call() => new ExportableAssessmentSection(string.Empty, string.Empty, Enumerable.Empty <Point2D>(),
                                                           ExportableAssessmentSectionAssemblyResultTestFactory.CreateResult(),
                                                           Enumerable.Empty <ExportableFailureMechanism>(), null);

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

            Assert.AreEqual("combinedSectionAssemblyResults", exception.ParamName);
        }
        public void CreateSerializableAssembly_WithValidArguments_ReturnsSerializableAssembly()
        {
            // Setup
            const string assessmentSectionName = "assessmentSectionName";
            const string assessmentSectionId   = "assessmentSectionId";

            IEnumerable <Point2D> geometry = CreateGeometry();
            ExportableAssessmentSectionAssemblyResult assessmentSectionAssembly =
                ExportableAssessmentSectionAssemblyResultTestFactory.CreateResult();
            IEnumerable <ExportableFailureMechanism> failureMechanisms =
                new[]
            {
                CreateFailureMechanism(),
                CreateFailureMechanism(),
                CreateFailureMechanism(),
                CreateFailureMechanism()
            };

            var exportableAssessmentSection = new ExportableAssessmentSection(assessmentSectionName,
                                                                              assessmentSectionId,
                                                                              geometry,
                                                                              assessmentSectionAssembly,
                                                                              failureMechanisms,
                                                                              new[]
            {
                CreateCombinedSectionAssembly(CreateCombinedFailureMechanismSection()),
                CreateCombinedSectionAssembly(CreateCombinedFailureMechanismSection())
            });

            // Call
            SerializableAssembly serializableAssembly = SerializableAssemblyCreator.Create(exportableAssessmentSection);

            // Assert
            Assert.AreEqual("Assemblage.0", serializableAssembly.Id);
            AssertSerializableBoundary(exportableAssessmentSection.Geometry, serializableAssembly.Boundary);

            SerializableFeatureMember[] serializableAssemblyFeatureMembers = serializableAssembly.FeatureMembers;
            Assert.AreEqual(24, serializableAssemblyFeatureMembers.Length);

            var serializableAssessmentSection = (SerializableAssessmentSection)serializableAssemblyFeatureMembers[0];

            AssertSerializableAssessmentSection($"Wks.{assessmentSectionId}", assessmentSectionName, geometry, serializableAssessmentSection);
            var serializableAssessmentProcess = (SerializableAssessmentProcess)serializableAssemblyFeatureMembers[1];

            AssertSerializableAssessmentProcess("Bp.0", serializableAssessmentSection, serializableAssessmentProcess);
            var serializableTotalAssemblyResult = (SerializableTotalAssemblyResult)serializableAssemblyFeatureMembers[2];

            AssertSerializableTotalAssemblyResult("Vo.0",
                                                  assessmentSectionAssembly,
                                                  serializableAssessmentProcess,
                                                  serializableTotalAssemblyResult);

            AssertFailureMechanismConnections(3, 0, serializableTotalAssemblyResult, serializableAssemblyFeatureMembers);
            AssertFailureMechanismConnections(4, 1, serializableTotalAssemblyResult, serializableAssemblyFeatureMembers);
            AssertFailureMechanismConnections(5, 2, serializableTotalAssemblyResult, serializableAssemblyFeatureMembers);
            AssertFailureMechanismConnections(6, 3, serializableTotalAssemblyResult, serializableAssemblyFeatureMembers);

            var combinedFailureMechanismSectionCollection = (SerializableFailureMechanismSectionCollection)serializableAssemblyFeatureMembers[17];

            AssertSerializableFailureMechanismSectionCollection("Vi.4", combinedFailureMechanismSectionCollection);
            AssertCombinedFailureMechanismSectionAssemblyConnections(11, 4, 0, combinedFailureMechanismSectionCollection, serializableTotalAssemblyResult, serializableAssemblyFeatureMembers);
            AssertCombinedFailureMechanismSectionAssemblyConnections(12, 5, 1, combinedFailureMechanismSectionCollection, serializableTotalAssemblyResult, serializableAssemblyFeatureMembers);
        }
Exemplo n.º 4
0
        public void Constructor_WithValidArguments_ExpectedValues(string name, string id)
        {
            // Setup
            IEnumerable <Point2D> geometry = Enumerable.Empty <Point2D>();
            ExportableAssessmentSectionAssemblyResult       assessmentSectionAssembly      = ExportableAssessmentSectionAssemblyResultTestFactory.CreateResult();
            IEnumerable <ExportableFailureMechanism>        failureMechanisms              = Enumerable.Empty <ExportableFailureMechanism>();
            IEnumerable <ExportableCombinedSectionAssembly> combinedSectionAssemblyResults = Enumerable.Empty <ExportableCombinedSectionAssembly>();

            // Call
            var assessmentSection = new ExportableAssessmentSection(
                name, id, geometry, assessmentSectionAssembly, failureMechanisms, combinedSectionAssemblyResults);

            // Assert
            Assert.AreEqual(name, assessmentSection.Name);
            Assert.AreEqual(id, assessmentSection.Id);
            Assert.AreSame(geometry, assessmentSection.Geometry);
            Assert.AreSame(assessmentSectionAssembly, assessmentSection.AssessmentSectionAssembly);
            Assert.AreSame(failureMechanisms, assessmentSection.FailureMechanisms);
            Assert.AreSame(combinedSectionAssemblyResults, assessmentSection.CombinedSectionAssemblies);
        }