using Deltares.Geotechnics; using Deltares.Geotechnics.ConePenetrationTest; using Deltares.Standard.Forms; using NUnit.Framework; namespace Deltares.DSoilModel.Forms.Tests { [TestFixture, RequiresSTA] internal class CptLookup2DControlTests : ControlTester { protected override IPropertyControl CreatePropertyControl() { return new CPTLookup2DControl(); } [Test] public void ControlBindingsTest() { Assert.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"); Assert.NotNull(subcontrol); Assert.AreSame(lookup.ConePenetrationTestData, subcontrol.SelectedObject); } [Test] public void SelectedObjectTest() { var lookup = new ConePenetrationTestLookup2D { SoilProfile2D = new SoilProfile2D(), ConePenetrationTestData = new ConePenetrationTestData() }; PropertyControl.SelectedObject = lookup; Assert.AreSame(lookup, PropertyControl.SelectedObject); } [Test] public void IsVisibleTest() { Assert.IsTrue(PropertyControl.IsVisible); // always true } } }