public void SetProperties_IndividualProperties_UpdateDataAndNotifyObservers()
        {
            // Setup
            var       mockRepository            = new MockRepository();
            var       observer                  = mockRepository.StrictMock <IObserver>();
            const int numberOfChangedProperties = 1;

            observer.Expect(o => o.UpdateObserver()).Repeat.Times(numberOfChangedProperties);
            mockRepository.ReplayAll();

            var input      = new WaveConditionsInput();
            var properties = new WaveConditionsInputForeshoreProfileProperties
            {
                Data = input
            };

            input.Attach(observer);

            // Call
            properties.UseForeshore = false;

            // Assert
            Assert.IsFalse(input.UseForeshore);
            mockRepository.VerifyAll();
        }
        public void Data_SetInputContextInstanceWithData_ReturnCorrectPropertyValues()
        {
            // Setup
            var input = new WaveConditionsInput
            {
                ForeshoreProfile = new TestForeshoreProfile(new[]
                {
                    new Point2D(1.1, 2.2),
                    new Point2D(3.3, 4.4)
                })
            };
            var properties = new WaveConditionsInputForeshoreProfileProperties();

            // Call
            properties.Data = input;

            // Assert
            var expectedCoordinates = new[]
            {
                new Point2D(1.1, 2.2),
                new Point2D(3.3, 4.4)
            };

            Assert.IsTrue(properties.UseForeshore);
            CollectionAssert.AreEqual(expectedCoordinates, properties.Coordinates);
        }
        public void Constructor_ExpectedValues()
        {
            // Setup & Call
            var properties = new WaveConditionsInputForeshoreProfileProperties();

            // Assert
            Assert.IsInstanceOf <ObjectProperties <WaveConditionsInput> >(properties);
            Assert.IsNull(properties.Data);
            Assert.IsEmpty(properties.ToString());
        }
        public void Data_SetNewInputContextInstance_ReturnCorrectPropertyValues()
        {
            // Setup
            var input      = new WaveConditionsInput();
            var properties = new WaveConditionsInputForeshoreProfileProperties();

            // Call
            properties.Data = input;

            // Assert
            Assert.IsFalse(properties.UseForeshore);
            CollectionAssert.IsEmpty(properties.Coordinates);
        }
        public void PropertyAttributes_WithOrWithoutForeshoreProfileAndPoints_ReturnExpectedValues(bool withForeshoreProfile, int numberOfProfilePoints, bool expectedCoordinatesPropertyReadOnly)
        {
            // Setup
            var input = new WaveConditionsInput();

            if (withForeshoreProfile)
            {
                var point2Ds = new List <Point2D>();
                for (var i = 0; i < numberOfProfilePoints; i++)
                {
                    point2Ds.Add(new Point2D(i, i));
                }

                input.ForeshoreProfile = new TestForeshoreProfile(point2Ds);
            }

            // Call
            var properties = new WaveConditionsInputForeshoreProfileProperties
            {
                Data = input
            };

            // Assert
            PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);

            Assert.AreEqual(2, dynamicProperties.Count);

            PropertyDescriptor useForeshoreProperty = dynamicProperties[useForeshorePropertyIndex];

            Assert.IsNotNull(useForeshoreProperty);
            Assert.AreEqual(expectedCoordinatesPropertyReadOnly, useForeshoreProperty.IsReadOnly);
            Assert.AreEqual("Gebruik", useForeshoreProperty.DisplayName);
            Assert.AreEqual("Moet de voorlandgeometrie worden gebruikt tijdens de berekening?", useForeshoreProperty.Description);

            PropertyDescriptor coordinatesProperty = dynamicProperties[coordinatesPropertyIndex];

            Assert.IsNotNull(coordinatesProperty);
            Assert.IsTrue(coordinatesProperty.IsReadOnly);
            Assert.AreEqual("Coördinaten [m]", coordinatesProperty.DisplayName);
            Assert.AreEqual("Lijst met punten in lokale coördinaten.", coordinatesProperty.Description);
        }