Exemplo n.º 1
0
        public void WhenConfirmed_ShouldClearTheList([ValueSource(nameof(WorkingOptionSet))]
                                                     ListOptions options, [Values(TestHelpers.CmdType.Click, TestHelpers.CmdType.Program)]
                                                     TestHelpers.CmdType cmdType)
        {
            listElement = new ListElement(Property, options);

            WindowFixture.RootElement.AddAndRemove(listElement, () =>
            {
                if (cmdType == TestHelpers.CmdType.Click)
                {
                    ClearButton.SendEvent(new ClickEvent {
                        target = ClearButton
                    });
                    Yes.SendEvent(new ClickEvent {
                        target = Yes
                    });
                }
                else
                {
                    listElement.ClearListItems();
                }

                listElement.SendEvent(new ListResetEvent {
                    target = listElement
                });
                Assert.AreEqual(0, listElement.Count);
                Assert.AreEqual(0, listElement.Controls.ItemsSection.childCount);
            });
        }
Exemplo n.º 2
0
        public void ShouldNotClearListWhenDisabled()
        {
            SerializedProperty property = Property;

            listElement = new ListElement(Property, new ListOptions {
                EnableDeletions = false
            });
            WindowFixture.RootElement.AddAndRemove(listElement, () =>
            {
                int initialSize = property.arraySize;
                listElement.ClearListItems();
                listElement.SendEvent(new ListResetEvent {
                    target = listElement
                });
                Assert.AreEqual(initialSize, property.arraySize);
            });
        }
Exemplo n.º 3
0
        public void WhenListEmpty_ShouldDisableButton([ValueSource(nameof(WorkingOptionSet))]
                                                      ListOptions options)
        {
            listElement = new ListElement(Property, options);
            WindowFixture.RootElement.AddAndRemove(listElement, () =>
            {
                if (!ClearButton.enabledSelf)
                {
                    Assert.Fail("ClearList button should initially be enabled with items on list");
                }

                listElement.ClearListItems();
                listElement.SendEvent(new ListResetEvent {
                    target = listElement
                });
                Assert.IsFalse(ClearButton.enabledSelf);
            });
        }