using System.Threading; using Deltares.Geotechnics; 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 BoringControlTests : ControlTester { protected override IPropertyControl CreatePropertyControl() { return new BoringControl(); } [Test] public void ControlBindingsTest() { var soilList = new SoilList(); soilList.Add(new Soil()); soilList.Add(new Soil()); var boring = new Boring { X = 1.1, Y = 1.2, Name = "MyName", Description = "MyDescription" }; boring.BoringDatarows.Add(new BoringDatarow()); boring.BoringDatarows.Add(new BoringDatarow()); PropertyControl.SelectedObject = boring; TestLabelControlVisibleValue(PropertyControl, "XLabel", true, "X (RD) [m]"); TestSpinEditVisibleEnabledValue(PropertyControl, "XEdit", true, true, boring, b => b.X, 9.1); TestLabelControlVisibleValue(PropertyControl, "ZLabel", true, "Y (RD) [m]"); TestSpinEditVisibleEnabledValue(PropertyControl, "ZEdit", true, true, boring, b => b.Y, 9.2); TestLabelControlVisibleValue(PropertyControl, "NameLabel", true, "Naam"); TestTextEditVisibleEnabledValue(PropertyControl, "NameEdit", true, true, boring, b => b.Name, "NewName"); TestLabelControlVisibleValue(PropertyControl, "DescriptionLabel", true, "Beschrijving"); TestTextEditVisibleEnabledValue(PropertyControl, "DescriptionEdit", true, true, boring, b => b.Description, "NewDescription"); TestGridVisibleEnabledSize(PropertyControl, "BoringValuesGridControl", true, true, 2, 16); } [Test] public void TestSelectedObject() { var b = new Boring(); ClassicAssert.AreNotSame(b, PropertyControl.SelectedObject); PropertyControl.SelectedObject = b; ClassicAssert.AreSame(b, PropertyControl.SelectedObject); } [Test] public void TestIsVisible_AlwaysTrue() { ClassicAssert.IsTrue(PropertyControl.IsVisible); } } }