using System.Threading; using Deltares.Geotechnics.ConePenetrationTest; using Deltares.Geotechnics.Xsd; using Deltares.Standard.Forms; using NUnit.Framework; using NUnit.Framework.Legacy; namespace Deltares.DSoilModel.Forms.Tests { [TestFixture, Apartment(ApartmentState.STA)] class CptControlTests : ControlTester { protected override IPropertyControl CreatePropertyControl() { return new CPTControl(); } [Test] public void ControlBindingsTest() { var cpt = new ConePenetrationTestData { X = 11.1, Y = 22.2, Name = "Name1", Description = "Descr1", GroundLevel = 33.3, PreExcavation = 44.4, CPTDatarows = { new CPTDatarow(), new CPTDatarow(), new CPTDatarow(), new CPTDatarow() } }; PropertyControl.SelectedObject = cpt; TestLabelControlVisibleValue(PropertyControl, "XLabel", true, "X (RD) [m]"); TestSpinEditVisibleEnabledValue(PropertyControl, "XEdit", true, true, cpt, c => c.X, 66.6); TestLabelControlVisibleValue(PropertyControl, "ZLabel", true, "Y (RD) [m]"); TestSpinEditVisibleEnabledValue(PropertyControl, "ZEdit", true, true, cpt, c => c.Y, 77.7); TestLabelControlVisibleValue(PropertyControl, "NameLabel", true, "Naam"); TestTextEditVisibleEnabledValue(PropertyControl, "NameEdit", true, false, cpt, c => c.Name, "NameTest"); TestLabelControlVisibleValue(PropertyControl, "DescriptionLabel", true, "Beschrijving"); TestTextEditVisibleEnabledValue(PropertyControl, "DescriptionEdit", true, true, cpt, c => c.Description, "DescrTest"); TestLabelControlVisibleValue(PropertyControl, "GroundLevelLabel", true, "Z [m NAP]"); TestSpinEditVisibleEnabledValue(PropertyControl, "GroundLevelEdit", true, false, cpt, c => c.GroundLevel, 88.8); TestLabelControlVisibleValue(PropertyControl, "PreExcavationLabel", true, "Voorontgraving [m]"); TestSpinEditVisibleEnabledValue(PropertyControl, "PreExcavationEdit", true, false, cpt, c => c.PreExcavation, 99.9); TestGridVisibleEnabledSize(PropertyControl, "CptValuesGridControl", true, true, 4, 5); } [Test] public void TestSelectedObject() { var cpt = new ConePenetrationTestData(); ClassicAssert.AreNotSame(cpt, PropertyControl.SelectedObject); PropertyControl.SelectedObject = cpt; ClassicAssert.AreSame(cpt, PropertyControl.SelectedObject); } [Test] public void TestIsVisible() { ClassicAssert.IsTrue(PropertyControl.IsVisible); } } }