public void Create_WithSimpleProperties_ReturnsForeshoreProfileWithSimplePropertiesSet()
        {
            // Setup
            const string name        = "testName";
            const string id          = "fpid";
            var          random      = new Random(21);
            int          order       = random.Next();
            double       orientation = random.NextDouble();
            double       x0          = random.NextDouble();

            var foreshoreProfile = new ForeshoreProfile(new Point2D(0, 0), Enumerable.Empty <Point2D>(), null, new ForeshoreProfile.ConstructionProperties
            {
                Id          = id,
                Name        = name,
                Orientation = orientation,
                X0          = x0
            });
            var registry = new PersistenceRegistry();

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

            // Assert
            Assert.IsNotNull(entity);
            Assert.AreEqual(order, entity.Order);
            Assert.AreEqual(id, entity.Id);
            Assert.AreEqual(name, entity.Name);
            Assert.AreEqual(orientation, entity.Orientation, foreshoreProfile.Orientation.GetAccuracy());
            Assert.AreEqual(x0, entity.X0);
            Assert.IsNull(entity.BreakWaterType);
            Assert.IsNull(entity.BreakWaterHeight);
        }
        public void Create_StringPropertiesDoNotShareReference()
        {
            // Setup
            const string testName         = "original name";
            const string testId           = "test id";
            var          foreshoreProfile = new ForeshoreProfile(new Point2D(0, 0),
                                                                 Enumerable.Empty <Point2D>(),
                                                                 null,
                                                                 new ForeshoreProfile.ConstructionProperties
            {
                Id   = testId,
                Name = testName
            });
            var registry = new PersistenceRegistry();

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

            // 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);
            Assert.AreNotSame(testId, entity.Id,
                              "To create stable binary representations/fingerprints, it's really important that strings are not shared.");
            Assert.AreEqual(testId, entity.Id);
        }
        public void Create_WithNaNProperties_ReturnsForeshoreProfileWithPropertiesSetToNaN()
        {
            // Setup
            var foreshoreProfile = new ForeshoreProfile(
                new Point2D(0, 0),
                Enumerable.Empty <Point2D>(),
                new BreakWater(BreakWaterType.Caisson, double.NaN),
                new ForeshoreProfile.ConstructionProperties
            {
                Id          = "id",
                Orientation = double.NaN,
                X0          = double.NaN
            });
            var registry = new PersistenceRegistry();

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

            // Assert
            Assert.IsNotNull(entity);
            Assert.IsNaN(entity.Orientation);
            Assert.IsNaN(entity.X0);
            Assert.IsNaN(entity.BreakWaterHeight);
        }