Index: src/Deltares.DSoilModel.Forms.Tests/DSoilModelPluginTests.cs =================================================================== diff -u -r392 -r395 --- src/Deltares.DSoilModel.Forms.Tests/DSoilModelPluginTests.cs (.../DSoilModelPluginTests.cs) (revision 392) +++ src/Deltares.DSoilModel.Forms.Tests/DSoilModelPluginTests.cs (.../DSoilModelPluginTests.cs) (revision 395) @@ -1,19 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Windows.Forms; +using System.Linq; using Deltares.DSoilModel.Data; using Deltares.Geometry.Forms; using Deltares.Geotechnics.Forms; using Deltares.Standard; -using Deltares.Standard.EventPublisher; using Deltares.Standard.Forms; using Deltares.Standard.Forms.DExpress; -using Deltares.Standard.Language; -using Deltares.Standard.Units; using NUnit.Framework; namespace Deltares.DSoilModel.Forms.Tests @@ -48,6 +39,8 @@ // Don't call form.Close() because it will raise SaveAs dialog //System.Windows.Forms.Application.Exit(); plugin.Dispose(); + mainForm.DynamicPropertyControl.Dispose(); + mainForm.Dispose(); mainForm = null; plugin = null; @@ -68,7 +61,7 @@ } [Test] - public void DMacPluginTestExecuteValidate() + public void ValidateForEmptyProjectIsOk() { NewProject(plugin); var results = RealTimeBackgroundValidator.ValidationResults; @@ -77,7 +70,6 @@ Assert.AreEqual(0, results.ToList().Count); } - private DSoilModelProject NewProject(DSoilModelPlugin p) { p.Project = new DSoilModelProject(); Index: src/Deltares.DSoilModel.Forms.Tests/DSoilModelSegmentGeometryEditorTests.cs =================================================================== diff -u -r388 -r395 --- src/Deltares.DSoilModel.Forms.Tests/DSoilModelSegmentGeometryEditorTests.cs (.../DSoilModelSegmentGeometryEditorTests.cs) (revision 388) +++ src/Deltares.DSoilModel.Forms.Tests/DSoilModelSegmentGeometryEditorTests.cs (.../DSoilModelSegmentGeometryEditorTests.cs) (revision 395) @@ -1,54 +1,54 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Deltares.DSoilModel.Data; +using Deltares.DSoilModel.Data; using Deltares.Geometry; using Deltares.Geotechnics; using Deltares.Standard; using Deltares.Standard.EventPublisher; +using Deltares.Standard.EventPublisher.Enum; using Deltares.Standard.Forms; using Deltares.Standard.Forms.DExpress; using NUnit.Framework; namespace Deltares.DSoilModel.Forms.Tests { - [TestFixture] + [TestFixture, RequiresSTA] public class DSoilModelSegmentGeometryEditorTests { private DSoilModelSegmentGeometryEditor dsmGeometryEditor; private readonly GeometryEditor extraGeometryEditor = new GeometryEditor(); private MainForm mainForm; private SpatialEditor spatialEditor; - [SetUp] + [TestFixtureSetUp] public void SetUp() { + BindSupport.ClearCaches(); About.IgnoreAssemblyErrors = true; mainForm = new MainForm(); - var project = new DSoilModelProject(); - dsmGeometryEditor = new DSoilModelSegmentGeometryEditor(extraGeometryEditor) - { - Project = project - }; + + dsmGeometryEditor = new DSoilModelSegmentGeometryEditor(extraGeometryEditor); extraGeometryEditor.Title = "Extra Geometry"; extraGeometryEditor.SpatialEditor.ReadUserValues(); + // mainForm.UseProperties(false); mainForm.AddControl(extraGeometryEditor); spatialEditor = dsmGeometryEditor.SpatialEditor; + //mainForm.DynamicPropertyControl.ClearRegistrationsForType(typeof(SoilSegmentSplitLocation)); } - [TearDown] + [TestFixtureTearDown] public void TearDown() { dsmGeometryEditor.Dispose(); dsmGeometryEditor = null; + BindSupport.ClearCaches(); } private SoilProfile2D CreateSoilProfile2D() { - var profile = new SoilProfile2D(); + var profile = new SoilProfile2D + { + CenterCrestLocation = 0 + }; - profile.CenterCrestLocation = 0; profile.Geometry.Points.Add(new GeometryPoint(1, 1, 1)); profile.PreconsolidationStresses.Add(new PreConsolidationStress()); profile.Surfaces.Add(new SoilLayer2D()); @@ -62,9 +62,11 @@ var sp2 = CreateSoilProfile2D(); project.SoilProfiles2D.Add(sp2); var segment = new SoilSegment(); - var ssp = new StochasticSoilProfile(); - ssp.Probability = 1; - ssp.Profile = sp2; + var ssp = new StochasticSoilProfile + { + Probability = 1, + Profile = sp2 + }; segment.StochasticSoilModel.StochasticSoilProfiles.Add(ssp); project.SoilSegments.Add(segment); return project; @@ -75,6 +77,7 @@ [TestCase("Name")] public void IsVisibleTest_AlwaysTrue(string propertyName) { + dsmGeometryEditor.Project = new DSoilModelProject(); Assert.IsTrue(dsmGeometryEditor.IsVisible(propertyName)); // always true } @@ -83,8 +86,9 @@ [TestCase("Name", true)] [TestCase("SplitSegment", false)] [TestCase("SplitSegmentLocation", false)] - public void IsVisibleTest_NoData(string propertyName, bool expected) + public void IsEnabledTest_NoData(string propertyName, bool expected) { + dsmGeometryEditor.Project = new DSoilModelProject(); Assert.AreEqual(expected, dsmGeometryEditor.IsEnabled(propertyName)); // always true } @@ -93,7 +97,7 @@ [TestCase("Name", true)] [TestCase("SplitSegment", true)] [TestCase("SplitSegmentLocation", false)] - public void IsVisibleTest_WithRequiredData(string propertyName, bool expected) + public void IsEnabledTest_WithRequiredData(string propertyName, bool expected) { dsmGeometryEditor.Project = CreateProject(); var splitLocation = new SoilSegmentSplitLocation @@ -103,13 +107,13 @@ XCoordinate = 0.5 }; spatialEditor.EmptySelection = new EmptyShape(dsmGeometryEditor.Project.SoilProfiles2D[0]); - DataEventPublisher.SelectionChanged(splitLocation); + DataEventPublisher.SelectionChanged(splitLocation, PropertyEditorReactionType.Ignore); Assert.AreEqual(expected, dsmGeometryEditor.IsEnabled(propertyName)); } [TestCase("SplitSegment", false)] [TestCase("SplitSegmentLocation", true)] - public void IsVisibleTest_WithRequiredDataForSplitSegmentLocation(string propertyName, bool expected) + public void IsEnabledTest_WithRequiredDataForSplitSegmentLocation(string propertyName, bool expected) { dsmGeometryEditor.Project = CreateProject(); var splitLocation = new SoilSegmentSplitLocation