Index: src/Deltares.DSoilModel.Forms.Tests/ControlTester.cs =================================================================== diff -u -r327 -r329 --- src/Deltares.DSoilModel.Forms.Tests/ControlTester.cs (.../ControlTester.cs) (revision 327) +++ src/Deltares.DSoilModel.Forms.Tests/ControlTester.cs (.../ControlTester.cs) (revision 329) @@ -2,6 +2,7 @@ using System.Linq.Expressions; using System.Reflection; using System.Windows.Forms; +using Deltares.Standard.Forms; using Deltares.Standard.Forms.DExpress; using Deltares.Standard.Language; using Deltares.Standard.Units; @@ -15,7 +16,14 @@ private KnownUnits knownUnits; private bool oldBypass; private LanguageType oldLanguage; - + + public IPropertyControl PropertyControl { get; private set; } + + protected virtual IPropertyControl CreatePropertyControl() + { + throw new Exception("CreatePropertyControl() should return an instance. This instanse can be found in PropertyControl public property."); + } + [TestFixtureSetUp] public virtual void TestFixtureSetUp() { @@ -26,11 +34,15 @@ oldLanguage = LocalizationManager.CurrentLanguage; LocalizationManager.CurrentLanguage = LanguageType.Dutch; + + PropertyControl = CreatePropertyControl(); } [TestFixtureTearDown] public virtual void TestFixtureTearDown() { + PropertyControl.Dispose(); + PropertyControl = null; BindSupport.ClearCaches(); knownUnits = null; BindSupport.BypassTimerForUnitTest = oldBypass; @@ -49,7 +61,7 @@ return prop.GetValue(target, null); } - protected void TestControlVisibleEnabled(Control parentControl, string spinEditName, bool isVisibleExpected, + protected void TestControlVisibleEnabled(IPropertyControl parentControl, string spinEditName, bool isVisibleExpected, bool isEnabledExpected) { var edit = GetPrivateField(parentControl, spinEditName) as Control; @@ -58,7 +70,7 @@ Assert.AreEqual(isEnabledExpected, edit.Enabled); } - protected void TestSpinEditVisibleEnabledValue(Control parentControl, string spinEditName, bool isVisibleExpected, bool isEnabledExpected, T target, Expression> outExpr, double? valueToTestWith = null) + protected void TestSpinEditVisibleEnabledValue(IPropertyControl parentControl, string spinEditName, bool isVisibleExpected, bool isEnabledExpected, T target, Expression> outExpr, double? valueToTestWith = null) { TestControlVisibleEnabled(parentControl, spinEditName, isVisibleExpected, isEnabledExpected); if (isVisibleExpected) @@ -79,8 +91,8 @@ edit.EditValue = initialValue; // restoring initial value - it might be still useful } } - - protected void TestTextEditVisibleEnabledValue(Control parentControl, string textEditName, + + protected void TestTextEditVisibleEnabledValue(IPropertyControl parentControl, string textEditName, bool isVisibleExpected, bool isEnabledExpected, T target, Expression> outExpr, string newValue = null) { TestControlVisibleEnabled(parentControl, textEditName, isVisibleExpected, isEnabledExpected); @@ -100,15 +112,15 @@ edit.EditValue = initialValue; // restoring initial value - it might be still useful } - protected void TestLabelControlVisibleValue(Control parentControl, string labelControlName, bool isVisibleExpected, string labelTextExpected) + protected void TestLabelControlVisibleValue(IPropertyControl parentControl, string labelControlName, bool isVisibleExpected, string labelTextExpected) { TestControlVisibleEnabled(parentControl, labelControlName, isVisibleExpected, true); // labels are always enabled in DSL projects var labelControl = GetPrivateField(parentControl, labelControlName) as LabelControl; Assert.IsNotNull(labelControl); Assert.AreEqual(labelTextExpected, labelControl.Text); } - protected void TestGridVisibleEnabledSize(Control parentControl, string gridName, bool isVisibleExpected, bool isEnabledExpected, int rowCount, int colCount) + protected void TestGridVisibleEnabledSize(IPropertyControl parentControl, string gridName, bool isVisibleExpected, bool isEnabledExpected, int rowCount, int colCount) { TestControlVisibleEnabled(parentControl, gridName, isVisibleExpected, isEnabledExpected); var gridControl = GetPrivateField(parentControl, gridName) as GridViewControl;