Exemple #1
0
        public async Task PerformSearch_CaretPositionBeyondSearchTextLength_Throws()
        {
            var host    = new Mocks.HostInteraction(TestDirectoryRoot, null);
            var testObj = new LocationSearchService(host);

            _ = await testObj.PerformSearch("test", 5);
        }
Exemple #2
0
        public async Task PerformSearch_NegativeCaretPosition_Throws()
        {
            var host    = new Mocks.HostInteraction(TestDirectoryRoot, null);
            var testObj = new LocationSearchService(host);

            _ = await testObj.PerformSearch("", -2);
        }
Exemple #3
0
        public async Task PerformSearch_NullSearchText_TreatAsEmpty()
        {
            var    host         = new Mocks.HostInteraction(TestDirectoryRoot, null);
            var    testObj      = new LocationSearchService(host);
            string searchString = null;

            CompletionSet result = await testObj.PerformSearch(searchString, 0);

            Assert.AreEqual(3, result.Completions.Count());
        }
Exemple #4
0
        public async Task PerformSearch_SearchTextContainsSeparator_ReturnSubdirectoriesOnly()
        {
            var    host         = new Mocks.HostInteraction(TestDirectoryRoot, null);
            var    testObj      = new LocationSearchService(host);
            string searchString = "RootFolder2/";

            CompletionSet result = await testObj.PerformSearch(searchString, searchString.Length);

            Assert.AreEqual(1, result.Completions.Count());
            Assert.IsTrue(result.Completions.Any(c => c.InsertionText == "RootFolder2/SubFolder/"));
        }
Exemple #5
0
        public async Task PerformSearch_SearchTextDoesNotContainSeparator_FilterSearchResults()
        {
            var    host         = new Mocks.HostInteraction(TestDirectoryRoot, null);
            var    testObj      = new LocationSearchService(host);
            string searchString = "Root";

            CompletionSet result = await testObj.PerformSearch(searchString, searchString.Length);

            Assert.AreEqual(2, result.Completions.Count());
            Assert.IsTrue(result.Completions.Any(c => c.InsertionText == "RootFolder1/"));
            Assert.IsTrue(result.Completions.Any(c => c.InsertionText == "RootFolder2/"));
        }
Exemple #6
0
        public async Task PerformSearch_EmptySearchText_ReturnsContentsOfWorkingDirectory()
        {
            var    host         = new Mocks.HostInteraction(TestDirectoryRoot, null);
            var    testObj      = new LocationSearchService(host);
            string searchString = "";

            CompletionSet result = await testObj.PerformSearch(searchString, searchString.Length);

            Assert.AreEqual(3, result.Completions.Count());
            Assert.IsTrue(result.Completions.Any(c => c.InsertionText == "RootFolder1/"));
            Assert.IsTrue(result.Completions.Any(c => c.InsertionText == "RootFolder2/"));
            Assert.IsTrue(result.Completions.Any(c => c.InsertionText == "DifferentlyNamedFolder/"));
        }