public async Task PerformSearch_CaretPositionBeyondSearchTextLength_Throws() { var host = new Mocks.HostInteraction(TestDirectoryRoot, null); var testObj = new LocationSearchService(host); _ = await testObj.PerformSearch("test", 5); }
public async Task PerformSearch_NegativeCaretPosition_Throws() { var host = new Mocks.HostInteraction(TestDirectoryRoot, null); var testObj = new LocationSearchService(host); _ = await testObj.PerformSearch("", -2); }
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()); }
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/")); }
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/")); }
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/")); }