public async Task GetRecommendedSelectedCompletionAsync_SearchTextDoesContainAt_NonMatching_ReturnsFirstItem()
        {
            ILibraryCatalog testCatalog = CreateLibraryCatalogWithUnscopedLibrary();

            var testObj = new LibraryIdViewModel(GetTestSearchService(testCatalog), "test@3");

            CompletionItem[] completions = new[] {
                new CompletionItem {
                    DisplayText = "1.2"
                },
                new CompletionItem {
                    DisplayText = "2.1"
                },
            };

            CompletionItem result = await testObj.GetRecommendedSelectedCompletionAsync(completions, null);

            Assert.AreEqual("1.2", result.DisplayText);
        }
Exemple #2
0
        public async Task GetRecommendedSelectedCompletionAsync_DoesNotContainAt_ReturnsFirstItem()
        {
            var testObj       = new LibraryIdViewModel(GetTestSearchService(), "test");
            var completionSet = new CompletionSet
            {
                Start       = 0,
                Length      = 4,
                Completions = new[] {
                    new CompletionItem {
                        DisplayText = "[email protected]"
                    },
                    new CompletionItem {
                        DisplayText = "[email protected]"
                    },
                },
            };

            CompletionItem result = await testObj.GetRecommendedSelectedCompletionAsync(completionSet, null);

            Assert.AreEqual("[email protected]", result.DisplayText);
        }
Exemple #3
0
        public async Task GetRecommendedSelectedCompletionAsync_SearchTextDoesContainAt_ReturnsItemThatStartsWithPrefix()
        {
            ILibraryCatalog testCatalog = CreateLibraryCatalogWithUnscopedLibrary();

            var testObj       = new LibraryIdViewModel(GetTestSearchService(testCatalog), "test@2");
            var completionSet = new CompletionSet
            {
                Start       = 0,
                Length      = 4,
                Completions = new[] {
                    new CompletionItem {
                        DisplayText = "1.2"
                    },
                    new CompletionItem {
                        DisplayText = "2.1"
                    },
                },
            };

            CompletionItem result = await testObj.GetRecommendedSelectedCompletionAsync(completionSet, null);

            Assert.AreEqual("2.1", result.DisplayText);
        }