public void ExactTextMatch_ShouldReturnResultWithMostNumberOfMatchingNameElementsFirst()
        {
            var resources = new[]
            {
                CreateTranslatedResource("A.B", SearchText),
                CreateTranslatedResource("A.B.C", SearchText),
                CreateTranslatedResource("A.B.C.D", SearchText),
                CreateTranslatedResource("A.B.X.C", SearchText),
            };
            TranslatedResource searchResource = resources[1];
            var expectedResult = resources[0];

            var suggestions = AddResourcesAndGetSuggestions(resources, searchResource);

            suggestions.Should().HaveCount(4);
            suggestions.Last().Resource.Should().BeSameAs(expectedResult);
        }
        public void ExactTextMatchAndSameNumberOfMatchingNameElements_ShouldPrioritizeLeastNumberOfElements()
        {
            var resources = new[]
            {
                CreateTranslatedResource("A.B.C.D", SearchText),
                CreateTranslatedResource("A.B.C", SearchText),
                CreateTranslatedResource("A.B.X.C", SearchText),
            };
            TranslatedResource searchResource = resources[1];
            var expectedResult = new[]
            {
                resources[1],
                resources[0],
                resources[2],
            };

            var suggestions = AddResourcesAndGetSuggestions(resources, searchResource);

            suggestions.Select(o => o.Resource).Should().ContainInOrder(expectedResult);
        }
        private IList <ResourceSuggestion> AddResourcesAndGetSuggestions(IEnumerable <TranslatedResource> resources, TranslatedResource resource)
        {
            _suggester.AddResources(resources);

            var suggestions = _suggester.GetSuggestionsFor(resource);

            return(suggestions);
        }