From 33c071bc9e31e211808a14c066217294c1008f30 Mon Sep 17 00:00:00 2001 From: Aparajit Pratap Date: Thu, 7 Dec 2023 14:04:14 -0500 Subject: [PATCH] cleanup --- src/Libraries/CoreNodeModels/Enum.cs | 49 --------------- .../DynamoCoreWpfTests/NodeExecutionUITest.cs | 62 +++++++++---------- 2 files changed, 31 insertions(+), 80 deletions(-) diff --git a/src/Libraries/CoreNodeModels/Enum.cs b/src/Libraries/CoreNodeModels/Enum.cs index e74df7a5fa4..a2c9860da3c 100644 --- a/src/Libraries/CoreNodeModels/Enum.cs +++ b/src/Libraries/CoreNodeModels/Enum.cs @@ -36,55 +36,6 @@ public override IEnumerable BuildOutputAst(List BuildOutputAst(List inputAstNodes) - { - AssociativeNode node; - if (SelectedIndex < 0 || SelectedIndex >= Items.Count) - { - node = AstFactory.BuildNullNode(); - return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), node) }; - } - else - { - // get the selected items name - var stringNode = AstFactory.BuildStringNode((string)Items[SelectedIndex].Name); - - // assign the selected name to an actual enumeration value - var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), stringNode); - - // return the enumeration value - return new List { assign }; - } - } - - protected override SelectionState PopulateItemsCore(string currentSelection) - { - Items.Clear(); - - var symbols = new[] { "one", "two", "three" }; - - - foreach (var symbol in symbols) - { - - Items.Add(new DynamoDropDownItem(symbol, symbol)); - } - - return SelectionState.Restore; - } - - } - public abstract class EnumBase : DSDropDownBase { protected EnumBase() : base(typeof(T).ToString()) { } diff --git a/test/DynamoCoreWpfTests/NodeExecutionUITest.cs b/test/DynamoCoreWpfTests/NodeExecutionUITest.cs index 935eccd7fda..a8660254a70 100644 --- a/test/DynamoCoreWpfTests/NodeExecutionUITest.cs +++ b/test/DynamoCoreWpfTests/NodeExecutionUITest.cs @@ -329,48 +329,48 @@ public void TestSelectionNodeUpdate2() } - // [Test] - // public void TestDropdownNodeUpdate() - // { - // var model = GetModel(); - // var tdd = new TestDropdown - // { - // SelectedIndex = 0 - // }; + [Test] + public void TestDropdownNodeUpdate() + { + var model = GetModel(); + var tdd = new TestDropdown + { + SelectedIndex = 0 + }; - // var command = new DynamoModel.CreateNodeCommand(tdd, 0, 0, true, false); - // model.ExecuteCommand(command); + var command = new DynamoModel.CreateNodeCommand(tdd, 0, 0, true, false); + model.ExecuteCommand(command); - // AssertPreviewValue(tdd.GUID.ToString(), "one"); + AssertPreviewValue(tdd.GUID.ToString(), "one"); - // tdd.SelectedIndex = 1; - // tdd.OnNodeModified(); + tdd.SelectedIndex = 1; + tdd.OnNodeModified(); - // AssertPreviewValue(tdd.GUID.ToString(), "two"); + AssertPreviewValue(tdd.GUID.ToString(), "two"); - // tdd.SelectedIndex = 2; - // tdd.OnNodeModified(); + tdd.SelectedIndex = 2; + tdd.OnNodeModified(); - // AssertPreviewValue(tdd.GUID.ToString(), "three"); + AssertPreviewValue(tdd.GUID.ToString(), "three"); - // } + } - // [Test, Category("Failure")] - // public void TestDropdownNodeUpdate1() - // { - // var model = GetModel(); - // var tdd = new TestDropdown(); + [Test] + public void TestDropdownNodeUpdate1() + { + var model = GetModel(); + var tdd = new TestDropdown(); - // var command = new DynamoModel.CreateNodeCommand(tdd, 0, 0, true, false); - // model.ExecuteCommand(command); + var command = new DynamoModel.CreateNodeCommand(tdd, 0, 0, true, false); + model.ExecuteCommand(command); - // AssertPreviewValue(tdd.GUID.ToString(), null); + AssertPreviewValue(tdd.GUID.ToString(), null); - // tdd.SelectedIndex = 1; - // tdd.OnNodeModified(); + tdd.SelectedIndex = 1; + tdd.OnNodeModified(); - // // fails here! - // AssertPreviewValue(tdd.GUID.ToString(), "two"); - // } + // fails here! + AssertPreviewValue(tdd.GUID.ToString(), "two"); + } } }