public void Create_WithoutCollector_ThrowsArgumentNullException()
        {
            // Setup
            FailureMechanismSection failureMechanismSection = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();

            // Call
            TestDelegate test = () => failureMechanismSection.Create(null);

            // Assert
            string parameterName = Assert.Throws <ArgumentNullException>(test).ParamName;

            Assert.AreEqual("registry", parameterName);
        }
        public void Create_StringPropertiesDoNotShareReference()
        {
            // Setup
            const string testName       = "original name";
            var          geometryPoints = new[]
            {
                new Point2D(0, 0),
                new Point2D(0, 0)
            };
            var failureMechanismSection = new FailureMechanismSection(testName, geometryPoints);
            var registry = new PersistenceRegistry();

            // Call
            FailureMechanismSectionEntity entity = failureMechanismSection.Create(registry);

            // Assert
            Assert.AreNotSame(testName, entity.Name,
                              "To create stable binary representations/fingerprints, it's really important that strings are not shared.");
            Assert.AreEqual(testName, entity.Name);
        }
        public void Create_WithCollectorAndGeometry_ReturnsFailureMechanismSectionWithGeometryStringSet()
        {
            // Setup
            const string testName       = "testName";
            var          geometryPoints = new[]
            {
                new Point2D(0, 0),
                new Point2D(0, 0)
            };
            var failureMechanismSection = new FailureMechanismSection(testName, geometryPoints);
            var registry = new PersistenceRegistry();

            // Call
            FailureMechanismSectionEntity entity = failureMechanismSection.Create(registry);

            // Assert
            Assert.IsNotNull(entity);
            Assert.AreEqual(testName, entity.Name);
            string expectedXml = new Point2DCollectionXmlSerializer().ToXml(geometryPoints);

            Assert.AreEqual(expectedXml, entity.FailureMechanismSectionPointXml);
        }