public void Create_ForeshoreProfileAlreadyRegistered_ReturnRegisteredEntity()
        {
            // Setup
            var foreshoreProfile = new TestForeshoreProfile();
            var registry         = new PersistenceRegistry();

            ForeshoreProfileEntity entity1 = foreshoreProfile.Create(registry, 0);

            // Precondition:
            Assert.IsTrue(registry.Contains(foreshoreProfile));

            // Call
            ForeshoreProfileEntity entity2 = foreshoreProfile.Create(registry, 0);

            // Assert
            Assert.AreSame(entity1, entity2);
        }
        public void Create_WithoutCollector_ThrowsArgumentNullException()
        {
            // Setup
            var foreshoreProfile = new TestForeshoreProfile();

            // Call
            TestDelegate test = () => foreshoreProfile.Create(null, 0);

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

            Assert.AreEqual("registry", parameterName);
        }
        public void Create_WithBreakWater_ReturnsForeshoreProfileWithBreakWaterPropertiesSet()
        {
            // Setup
            double height = new Random(21).NextDouble();
            const BreakWaterType breakWaterType = BreakWaterType.Caisson;
            var foreshoreProfile = new TestForeshoreProfile(new BreakWater(breakWaterType, height));
            var registry         = new PersistenceRegistry();

            // Call
            ForeshoreProfileEntity entity = foreshoreProfile.Create(registry, 0);

            // Assert
            Assert.IsNotNull(entity);
            Assert.AreEqual((int)breakWaterType, entity.BreakWaterType);
            Assert.AreEqual(height, entity.BreakWaterHeight, foreshoreProfile.BreakWater.Height.GetAccuracy());
        }
        public void Create_WithGeometry_ReturnsForeshoreProfileWithGeometryStringSet()
        {
            // Setup
            int order          = new Random(21).Next();
            var geometryPoints = new[]
            {
                new Point2D(0, 0),
                new Point2D(0, 0)
            };
            var foreshoreProfile = new TestForeshoreProfile(geometryPoints);
            var registry         = new PersistenceRegistry();

            // Call
            ForeshoreProfileEntity entity = foreshoreProfile.Create(registry, order);

            // Assert
            Assert.IsNotNull(entity);
            string expectedXml = new Point2DCollectionXmlSerializer().ToXml(geometryPoints);

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