using Deltares.Geotechnics; using Deltares.Standard.Forms; using NUnit.Framework; namespace Deltares.DSoilModel.Forms.Tests { [TestFixture, RequiresSTA] 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.BoringLayers.Add(new BoringLayer(soilList, new BoringDatarow())); boring.BoringLayers.Add(new BoringLayer(soilList, new BoringDatarow())); PropertyControl.SelectedObject = boring; TestLabelControlVisibleValue(PropertyControl, "XLabel", true, "X [m]"); TestSpinEditVisibleEnabledValue(PropertyControl, "XEdit", true, true, boring, b => b.X, 9.1); TestLabelControlVisibleValue(PropertyControl, "ZLabel", true, "Y [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, 4, 3); } [Test] public void TestSelectedObject_SosSoilLayer1D() { var b = new Boring(); Assert.AreNotSame(b, PropertyControl.SelectedObject); PropertyControl.SelectedObject = b; Assert.AreSame(b, PropertyControl.SelectedObject); } [Test] public void TestIsVisible_AlwaysTrue() { Assert.IsTrue(PropertyControl.IsVisible); } } }