public void MoveItemFromBottomToTop_ShouldWork([ValueSource(nameof(WorkingOptionSet))] ListOptions options, [Values(TestHelpers.CmdType.Click, TestHelpers.CmdType.Program)] TestHelpers.CmdType cmdType) { listElement = new ListElement(Property, options); WindowFixture.RootElement.AddAndRemove(listElement, () => { string itemBeingMoved = listElement.GetPropertyAt(Property.arraySize - 1).stringValue; for (int i = Property.arraySize - 1; i > 0; i--) { if (cmdType == TestHelpers.CmdType.Click) { listElement.Controls.Row[i].MoveUp.SendEvent(new ClickEvent { target = listElement.Controls.Row[i].MoveUp }); } else { listElement.MoveItemUp(i); } if (itemBeingMoved == listElement.GetPropertyAt(i - 1).stringValue) { continue; } Assert.Fail($"Move up from index {i} failed"); } }); }
public void ShouldAddObjectToList() { SerializedProperty property = TestHelpers.GetProperty(nameof(TestHelpers.TestComponent.myCustomList)); listElement = new ListElement(property); WindowFixture.RootElement.AddAndRemove(listElement, () => { int initialSize = property.arraySize; TestHelpers.TestObject test = ScriptableObject.CreateInstance <TestHelpers.TestObject>(); listElement.AddNewItemToList(test); Assert.AreSame(test, listElement.GetPropertyAt(initialSize).objectReferenceValue); }); }