using System.Threading; using Deltares.Geotechnics.ConePenetrationTest; using Deltares.Geotechnics.Soils; using Deltares.Standard.Forms; using NUnit.Framework; using NUnit.Framework.Legacy; namespace Deltares.DSoilModel.Forms.Tests { [TestFixture, Apartment(ApartmentState.STA)] internal class CptLookup2DControlTests : ControlTester { protected override IPropertyControl CreatePropertyControl() { return new CPTLookup2DControl(); } [Test] public void ControlBindingsTest() { ClassicAssert.AreEqual("Sondering", PropertyControl.Name); var lookup = new ConePenetrationTestLookup2D { SoilProfile2D = new SoilProfile2D() {Name = "Profile A"}, ConePenetrationTestData = new ConePenetrationTestData() {Name = "Cpt 1"}, Xlocal = 1.0, Zlocal = 2.0 }; PropertyControl.SelectedObject = lookup; TestSpinEditVisibleEnabledValue(PropertyControl, "XEdit", true, true, lookup, x => x.Xlocal, 5.0); TestLabelControlVisibleValue(PropertyControl, "XLabel", true, "Lokale x [-]"); var subcontrol = GetPrivateField(PropertyControl, "CptControl"); ClassicAssert.NotNull(subcontrol); ClassicAssert.AreSame(lookup.ConePenetrationTestData, subcontrol.SelectedObject); } [Test] public void SelectedObjectTest() { var lookup = new ConePenetrationTestLookup2D { SoilProfile2D = new SoilProfile2D(), ConePenetrationTestData = new ConePenetrationTestData() }; PropertyControl.SelectedObject = lookup; ClassicAssert.AreSame(lookup, PropertyControl.SelectedObject); } [Test] public void IsVisibleTest() { ClassicAssert.IsTrue(PropertyControl.IsVisible); // always true } } }