private IFindResult Setup(string searchText, string replaceText, string resultText)
                {
                    var findResult = Substitute.For <IFindResult>();

                    findResult.Text.Returns(resultText);

                    var window = FindReplaceWindowBase.ShowWindow <FindReplaceWindowStub>();

                    window.searchText = searchText;
                    window.result     = new [] { findResult };

                    _root = window.rootVisualElement;

                    var searchInput = _root.GetElement <TextField>("p-window__input-find-text");

                    searchInput.value = searchText;

                    var replaceInput = _root.GetElement <TextField>("p-window__input-replace-text");

                    replaceInput.value = replaceText;

                    _root.ClickButton("p-window__search");
                    _root.ClickButton("m-search-result__replace");

                    return(findResult);
                }
                public void It_should_not_display_a_message_nothing_was_found_by_default()
                {
                    FindReplaceWindowBase.CloseWindow();

                    var root = FindReplaceWindowBase
                               .ShowWindow <FindReplaceWindowStub>()
                               .rootVisualElement;
                    var result = root.GetElement <TextElement>("p-window__no-result");

                    Assert.IsTrue(result.ClassListContains("hide"));
                }
                public void It_should_clear_not_found_message_when_searching_again()
                {
                    Setup("", new IFindResult[0]);
                    FindReplaceWindowBase.CloseWindow();

                    var findResult = Substitute.For <IFindResult>();

                    findResult.Text.Returns("Lorem Ipsum");
                    var root = Setup("Lorem", new [] { findResult });

                    var result = root.GetElement <TextElement>("p-window__no-result");

                    Assert.IsTrue(result.ClassListContains("hide"));
                }
            private VisualElement Setup(string searchText, IFindResult[] result, bool matchCase = true)
            {
                FindReplaceWindowBase.CloseWindow();

                var window = FindReplaceWindowBase.ShowWindow <FindReplaceWindowStub>();

                window.searchText = searchText;
                window.result     = result;

                var root = window.rootVisualElement;

                var searchInput = root.GetElement <TextField>("p-window__input-find-text");

                searchInput.value = searchText;

                var elMatchCase = root.GetElement <Toggle>("p-window__match-case");

                elMatchCase.value = matchCase;

                root.ClickButton("p-window__search");

                return(root);
            }
 public void AfterEach()
 {
     FindReplaceWindowBase.CloseWindow();
 }