public async Task FilterCompletions_SearchTextDoesNotContainAtSign_ReturnAllMatchingCompletions() { var testObj = new LibraryIdViewModel(GetTestSearchService(), "test"); CompletionSet result = await testObj.GetCompletionSetAsync(caretIndex : 0); Assert.AreEqual(3, result.Completions.Count()); }
public async Task FilterCompletions_SearchTextEndsWithAfterAt_ReturnFilteredCompletions() { var testObj = new LibraryIdViewModel(GetTestSearchService(), "test@2"); CompletionSet result = await testObj.GetCompletionSetAsync(caretIndex : 0); // This will match both 1.2 and 2.0 Assert.AreEqual(2, result.Completions.Count()); }
public async Task FilterCompletions_SearchTextEndsWithAt_ReturnAllMatchingCompletions() { var testObj = new LibraryIdViewModel(GetTestSearchService(), "test@"); CompletionSet result = await testObj.GetCompletionSetAsync(caretIndex : 0); // the version segment is "", which matches all versions Assert.AreEqual(3, result.Completions.Count()); }
public async Task FilterCompletions_ScopedPackageWithoutTrailingAt_ReturnAllMatchingCompletions() { ILibraryCatalog testCatalog = new LibraryCatalog() .AddLibrary(new Library { Name = "test", Version = "1.0" }) .AddLibrary(new Library { Name = "@types/test", Version = "1.2" }); var testObj = new LibraryIdViewModel(GetTestSearchService(testCatalog), "@types/test"); CompletionSet result = await testObj.GetCompletionSetAsync(caretIndex : 11); Assert.AreEqual(1, result.Completions.Count()); }
public async Task FilterCompletions_SearchTextDoesNotContainAtSign_ReturnAllMatchingCompletions() { ILibraryCatalog testCatalog = new LibraryCatalog() .AddLibrary(new Library { Name = "test", Version = "1.0" }) .AddLibrary(new Library { Name = "@types/test", Version = "1.2" }); var testObj = new LibraryIdViewModel(GetTestSearchService(testCatalog), "test"); CompletionSet result = await testObj.GetCompletionSetAsync(caretIndex : 3); Assert.AreEqual(1, result.Completions.Count()); }
public async Task FilterCompletions_SearchTextEndsWithAt_ReturnAllMatchingCompletions() { ILibraryCatalog testCatalog = new LibraryCatalog() .AddLibrary(new Library { Name = "test", Version = "1.0" }) .AddLibrary(new Library { Name = "test", Version = "1.2" }) .AddLibrary(new Library { Name = "@types/test", Version = "1.2" }); var testObj = new LibraryIdViewModel(GetTestSearchService(testCatalog), "test@"); CompletionSet result = await testObj.GetCompletionSetAsync(caretIndex : 5); // the version segment is "", which matches all versions Assert.AreEqual(2, result.Completions.Count()); }
public async Task FilterCompletions_SearchTextEndsWithAfterAt_ReturnFilteredCompletions() { ILibraryCatalog testCatalog = new LibraryCatalog() .AddLibrary(new Library { Name = "test", Version = "1.0" }) .AddLibrary(new Library { Name = "test", Version = "1.2" }) .AddLibrary(new Library { Name = "test", Version = "2.0" }) .AddLibrary(new Library { Name = "@types/test", Version = "1.2" }); var testObj = new LibraryIdViewModel(GetTestSearchService(testCatalog), "test@2"); CompletionSet result = await testObj.GetCompletionSetAsync(caretIndex : 5); // This will match both 1.2 and 2.0 Assert.AreEqual(2, result.Completions.Count()); }