using System.Threading; using Deltares.Geotechnics.IO; using Deltares.Geotechnics.Mechanisms; using Deltares.Geotechnics.Soils; using Deltares.Standard.Forms; using NUnit.Framework; using NUnit.Framework.Legacy; namespace Deltares.DSoilModel.Forms.Tests { [TestFixture, Apartment(ApartmentState.STA)] class SpecificMechanismPointLocationControlTests : ControlTester { protected override IPropertyControl CreatePropertyControl() { return new SpecificMechanismPointLocationControl(); } [Test] public void ControlBindingsTest() { MechanismSupport.Mechanisms = new[] {Mechanism.None, Mechanism.Piping, Mechanism.Stability, Mechanism.FlowSlide }; // expected and typical case var m = new SpecificMechanismPointLocation { XCoordinate = 1.1, SoilProfile2D = new SoilProfile2D { Name = "Profile2D_to_test" } }; PropertyControl.SelectedObject = m; TestLabelControlVisibleValue(PropertyControl, "XcoordinateLabel", true, "X-coördinaat [m]"); TestSpinEditVisibleEnabledValue(PropertyControl, "XcoordinateEdit", true, true, m, c => c.XCoordinate, 5.5); TestLabelControlVisibleValue(PropertyControl, "MechanismLabel", true, "Faalmechanisme"); TestComboBoxVisibleEnabledValue(PropertyControl, "MechanismEdit", true, true, m, c => c.Mechanism, Mechanism.Piping); TestLabelControlVisibleValue(PropertyControl, "SoilProfileLabel", true, "Ondergrondprofiel 2D"); TestTextEditVisibleEnabledValue(PropertyControl, "SoilProfileEdit", true, false, m, c => c.SoilProfile2D); } [Test] public void TestSelectedObject() { var smpl = new SpecificMechanismPointLocation(); ClassicAssert.AreNotSame(smpl, PropertyControl.SelectedObject); PropertyControl.SelectedObject = smpl; ClassicAssert.AreSame(smpl, PropertyControl.SelectedObject); } [Test] public void TestIsVisible() { ClassicAssert.IsTrue(PropertyControl.IsVisible); } } }