Example #1
0
        public void Constructor_WithWrappedObjectNull_ExpectedValues()
        {
            // Call
            var dataGridViewComboBoxItemWrapper = new DataGridViewComboBoxItemWrapper <TestClass>(null);

            // Assert
            Assert.AreEqual("<selecteer>", dataGridViewComboBoxItemWrapper.DisplayName);
            Assert.IsNull(dataGridViewComboBoxItemWrapper.WrappedObject);
            Assert.AreEqual(dataGridViewComboBoxItemWrapper, dataGridViewComboBoxItemWrapper.This);
        }
Example #2
0
        public void ForeshoreProfile_AlwaysOnChange_NotifyObserverAndCalculationPropertyChanged()
        {
            // Setup
            ForeshoreProfile newProfile = new TestForeshoreProfile(new Point2D(0.0, 0.0));
            var newValue = new DataGridViewComboBoxItemWrapper <ForeshoreProfile>(newProfile);

            var calculation = new StructuresCalculationScenario <HeightStructuresInput>();

            // Call & Assert
            SetPropertyAndVerifyNotificationsAndOutputForCalculation(row => row.ForeshoreProfile = newValue, calculation);
        }
Example #3
0
        public void StochasticSoilProfile_AlwaysOnChange_NotifyObserverAndCalculationPropertyChanged()
        {
            // Setup
            var newProfile = new PipingStochasticSoilProfile(0, PipingSoilProfileTestFactory.CreatePipingSoilProfile());
            var newValue   = new DataGridViewComboBoxItemWrapper <PipingStochasticSoilProfile>(newProfile);

            var calculation = new TestPipingCalculationScenario();

            // Call & Assert
            SetPropertyAndVerifyNotificationsAndOutputForCalculation(row => row.StochasticSoilProfile = newValue, calculation);
        }
Example #4
0
        public void ToString_WithWrappedObjectNull_ReturnsDisplayName()
        {
            // Setup
            var dataGridViewComboBoxItemWrapper = new DataGridViewComboBoxItemWrapper <TestClass>(null);

            // Call
            var text = dataGridViewComboBoxItemWrapper.ToString();

            // Assert
            Assert.AreEqual(dataGridViewComboBoxItemWrapper.DisplayName, text);
        }
Example #5
0
        public void StochasticSoilModel_AlwaysOnChange_NotifyObserverCalculationPropertyChangedOutputCleared()
        {
            // Setup
            MacroStabilityInwardsStochasticSoilModel newModel = MacroStabilityInwardsStochasticSoilModelTestFactory.CreateValidStochasticSoilModel();
            var newValue = new DataGridViewComboBoxItemWrapper <MacroStabilityInwardsStochasticSoilModel>(newModel);

            var calculation = new MacroStabilityInwardsCalculationScenario();

            // Call & Assert
            SetPropertyAndVerifyNotificationsAndOutputForCalculation(row => row.StochasticSoilModel = newValue, calculation);
        }
Example #6
0
        public void DikeProfile_AlwaysOnChange_NotifyObserverAndCalculationPropertyChanged()
        {
            // Setup
            DikeProfile newProfile = DikeProfileTestFactory.CreateDikeProfile(new Point2D(0.0, 0.0));
            var         newValue   = new DataGridViewComboBoxItemWrapper <DikeProfile>(newProfile);

            var calculation = new GrassCoverErosionInwardsCalculationScenario();

            // Call & Assert
            SetPropertyAndVerifyNotificationsAndOutputForCalculation(row => row.DikeProfile = newValue, calculation);
        }
Example #7
0
        public void SelectableHydraulicBoundaryLocation_AlwaysOnChange_NotifyObserverAndCalculationPropertyChanged()
        {
            // Setup
            var newLocation = new TestHydraulicBoundaryLocation();
            var selectableHydraulicBoundaryLocation = new SelectableHydraulicBoundaryLocation(newLocation, new Point2D(0, 0));
            var newValue = new DataGridViewComboBoxItemWrapper <SelectableHydraulicBoundaryLocation>(selectableHydraulicBoundaryLocation);

            var calculation = new StructuresCalculationScenario <HeightStructuresInput>();

            // Call & Assert
            SetPropertyAndVerifyNotificationsAndOutputForCalculation(row => row.SelectableHydraulicBoundaryLocation = newValue, calculation);
        }
Example #8
0
        public void StochasticSoilProfile_AlwaysOnChange_NotifyObserverAndCalculationPropertyChanged()
        {
            // Setup
            MacroStabilityInwardsSoilProfile1D soilProfile = MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D();
            var newProfile = new MacroStabilityInwardsStochasticSoilProfile(0, soilProfile);
            var newValue   = new DataGridViewComboBoxItemWrapper <MacroStabilityInwardsStochasticSoilProfile>(newProfile);

            var calculation = new MacroStabilityInwardsCalculationScenario();

            // Call & Assert
            SetPropertyAndVerifyNotificationsAndOutputForCalculation(row => row.StochasticSoilProfile = newValue, calculation);
        }
Example #9
0
        public void Constructor_WithWrappedObject_ExpectedValues()
        {
            // Setup
            var testClass = new TestClass();

            // Call
            var dataGridViewComboBoxItemWrapper = new DataGridViewComboBoxItemWrapper <TestClass>(testClass);

            // Assert
            Assert.AreEqual("Test class", dataGridViewComboBoxItemWrapper.DisplayName);
            Assert.AreEqual(testClass, dataGridViewComboBoxItemWrapper.WrappedObject);
            Assert.AreEqual(dataGridViewComboBoxItemWrapper, dataGridViewComboBoxItemWrapper.This);
        }
Example #10
0
        public void ForeshoreProfile_ChangeToEqualValue_NoNotificationsAndOutputNotCleared()
        {
            // Setup
            DataGridViewComboBoxItemWrapper <ForeshoreProfile> oldValue = null;

            // Call
            AssertPropertyNotChanged(
                row =>
            {
                oldValue             = row.ForeshoreProfile;
                row.ForeshoreProfile = row.ForeshoreProfile;
            },
                calculation =>
            {
                // Assert
                Assert.NotNull(oldValue);
                Assert.AreEqual(oldValue.WrappedObject, calculation.InputParameters.ForeshoreProfile);
            });
        }
Example #11
0
        public void StochasticSoilModel_ChangeToEqualValue_NoNotificationsAndOutputNotCleared()
        {
            // Setup
            DataGridViewComboBoxItemWrapper <PipingStochasticSoilModel> oldValue = null;

            // Call
            AssertPropertyNotChanged(
                row =>
            {
                oldValue = row.StochasticSoilModel;
                row.StochasticSoilModel = row.StochasticSoilModel;
            },
                calculation =>
            {
                // Assert
                Assert.NotNull(oldValue);
                Assert.AreEqual(oldValue.WrappedObject, calculation.InputParameters.StochasticSoilModel);
            });
        }
Example #12
0
        public void SelectableHydraulicBoundaryLocation_ChangeToEqualValue_NoNotificationsAndOutputNotCleared()
        {
            // Setup
            DataGridViewComboBoxItemWrapper <SelectableHydraulicBoundaryLocation> oldValue = null;

            // Call
            AssertPropertyNotChanged(
                row =>
            {
                oldValue = row.SelectableHydraulicBoundaryLocation;
                row.SelectableHydraulicBoundaryLocation = row.SelectableHydraulicBoundaryLocation;
            },
                calculation =>
            {
                // Assert
                Assert.NotNull(oldValue);
                Assert.AreEqual(oldValue.WrappedObject.HydraulicBoundaryLocation, calculation.InputParameters.HydraulicBoundaryLocation);
            });
        }
Example #13
0
        public void StochasticSoilProfile_ChangeToEqualValue_NoNotificationsAndOutputNotCleared()
        {
            // Setup
            DataGridViewComboBoxItemWrapper <MacroStabilityInwardsStochasticSoilProfile> oldValue = null;

            // Call
            AssertPropertyNotChanged(
                row =>
            {
                oldValue = row.StochasticSoilProfile;
                row.StochasticSoilProfile = row.StochasticSoilProfile;
            },
                calculation =>
            {
                // Assert
                Assert.NotNull(oldValue);
                Assert.AreEqual(oldValue.WrappedObject, calculation.InputParameters.StochasticSoilProfile);
            });
        }