internal void GetHighestPrecedenceInvokableTemplatesTest(MockNewCommandInput command, MockTemplateInfo[] templates, string defaultLanguage, string[] expectedTemplates)
        {
            TemplateResolutionResult matchedTemplates = TemplateResolver.GetTemplateResolutionResult(templates, new MockHostSpecificDataLoader(), command, defaultLanguage);

            TemplateGroup templateGroup      = matchedTemplates.UnambiguousTemplateGroup;
            bool          useDefaultLanguage = string.IsNullOrWhiteSpace(command.Language) && !string.IsNullOrWhiteSpace(defaultLanguage);
            IEnumerable <ITemplateMatchInfo> selectedTemplates = templateGroup.GetHighestPrecedenceInvokableTemplates(useDefaultLanguage);

            var identitiesToCheck = selectedTemplates.Select(t => t.Info.Identity);

            Assert.Equal(expectedTemplates.Length, selectedTemplates.Count());
            foreach (string exp in expectedTemplates)
            {
                Assert.Single(selectedTemplates.Where(t => t.Info.Identity == exp));
            }

            bool success = templateGroup.TryGetHighestPrecedenceInvokableTemplate(out ITemplateMatchInfo selectedTemplate, useDefaultLanguage);

            if (expectedTemplates.Length == 1)
            {
                Assert.Equal(expectedTemplates[0], selectedTemplate.Info.Identity);
                Assert.True(success);
            }
            else
            {
                Assert.Null(selectedTemplate);
                Assert.False(success);
            }
        }
Пример #2
0
        private void EnsureTemplateResolutionResult()
        {
            if (_resolutionResultInitialized)
            {
                return;
            }

            _templateResolutionResult = TemplateResolver.GetTemplateResolutionResult(_settingsLoader.UserTemplateCache.TemplateInfo, _hostDataLoader, _commandInput, _defaultLanguage);
            _singleMatchStatus        = Status.NotEvaluated;

            // If any template in the group has any ambiguous params, it's not invokable.
            // The check for HasAmbiguousParameterValueMatch is for an example like:
            // "dotnet new mvc -f netcore"
            //      - '-f netcore' is ambiguous in the 1.x version (2 begins-with matches)
            //      - '-f netcore' is not ambiguous in the 2.x version (1 begins-with match)
            if (!_templateResolutionResult.TryGetUnambiguousTemplateGroupToUse(out IReadOnlyList <ITemplateMatchInfo> unambiguousTemplateGroup) ||
                !_templateResolutionResult.TryGetSingularInvokableMatch(out _templateToInvoke, out _singleMatchStatus) ||
                unambiguousTemplateGroup.Any(x => x.HasParameterMismatch()) ||
                unambiguousTemplateGroup.Any(x => x.HasAmbiguousParameterValueMatch()))
            {
                _templateToInvoke = null;

                if (_singleMatchStatus == Status.AmbiguousChoice)
                {
                    _environment.Host.LogDiagnosticMessage(LocalizableStrings.Authoring_AmbiguousChoiceParameterValue, "Authoring");
                }
                else if (_singleMatchStatus == Status.AmbiguousPrecedence)
                {
                    _environment.Host.LogDiagnosticMessage(LocalizableStrings.Authoring_AmbiguousBestPrecedence, "Authoring");
                }
            }

            _resolutionResultInitialized = true;
        }
Пример #3
0
        public void MultipleTemplatesInGroupHavingSingularStartMatchesOnDifferentParams_HighPrecedenceIsChosen()
        {
            List <ITemplateInfo> templatesToSearch = new List <ITemplateInfo>();

            templatesToSearch.Add(new MockTemplateInfo("foo", name: "Foo template", identity: "foo.test_1", groupIdentity: "foo.test.template", precedence: 100)
                                  .WithTag("MyChoice", "value_1", "other_value")
                                  .WithTag("OtherChoice", "foo_"));
            templatesToSearch.Add(new MockTemplateInfo("foo", name: "Foo template", identity: "foo.test_2", groupIdentity: "foo.test.template", precedence: 200)
                                  .WithTag("MyChoice", "value_")
                                  .WithTag("OtherChoice", "foo_", "bar_1"));

            INewCommandInput userInputs = new MockNewCommandInput("foo").WithTemplateOption("MyChoice", "value_").WithTemplateOption("OtherChoice", "foo_");

            IHostSpecificDataLoader  hostSpecificDataLoader = new MockHostSpecificDataLoader();
            TemplateResolutionResult matchResult            = TemplateResolver.GetTemplateResolutionResult(templatesToSearch, hostSpecificDataLoader, userInputs, null);

            // make sure there's an unambiguous group, otherwise the singular match check is meaningless
            Assert.True(matchResult.TryGetUnambiguousTemplateGroupToUse(out IReadOnlyList <ITemplateMatchInfo> unambiguousGroup));
            Assert.Equal(2, unambiguousGroup.Count);
            Assert.Equal(2, matchResult.GetBestTemplateMatchList().Count);

            Assert.True(matchResult.TryGetSingularInvokableMatch(out ITemplateMatchInfo singularInvokableMatch, out Status resultStatus));
            Assert.Equal(Status.SingleMatch, resultStatus);
            Assert.Equal("foo.test_2", singularInvokableMatch.Info.Identity);
        }
Пример #4
0
        public void AllTemplatesInGroupUseAllShortNamesForResolution()
        {
            IReadOnlyList <string> shortNamesForGroup = new List <string>()
            {
                "aaa", "bbb", "ccc", "ddd", "eee", "fff"
            };
            string defaultLanguage = "C#";

            foreach (string testShortName in shortNamesForGroup)
            {
                INewCommandInput userInputs = new MockNewCommandInput(testShortName);

                TemplateResolutionResult matchResult = TemplateResolver.GetTemplateResolutionResult(MultiShortNameGroupTemplateInfo, new MockHostSpecificDataLoader(), userInputs, defaultLanguage);
                Assert.Equal(TemplateResolutionResult.UnambiguousTemplateGroupStatus.SingleMatch, matchResult.GroupResolutionStatus);
                Assert.Equal(3, matchResult.UnambiguousTemplateGroup.Templates.Count);
                Assert.True(matchResult.UnambiguousTemplateGroup.Templates.All(t => WellKnownSearchFilters.MatchesAllCriteria(t)));

                foreach (ITemplateMatchInfo templateMatchInfo in matchResult.UnambiguousTemplateGroup.Templates)
                {
                    Assert.Equal("MultiName.Test", templateMatchInfo.Info.GroupIdentity);
                    if (templateMatchInfo.Info.GetLanguage().Equals(defaultLanguage, StringComparison.OrdinalIgnoreCase))
                    {
                        //default language match is part of MatchDisposition collection
                        Assert.Equal(2, templateMatchInfo.MatchDisposition.Count);
                    }
                    else
                    {
                        Assert.Equal(1, templateMatchInfo.MatchDisposition.Count);
                    }
                    Assert.True(templateMatchInfo.MatchDisposition[0].Name == MatchInfo.BuiltIn.ShortName && templateMatchInfo.MatchDisposition[0].Kind == MatchKind.Exact);
                }
            }
        }
        [InlineData("eee", "Y", "Multiname.Test.Only.FSharp")]  // uses a short name from a different template in the group
        public void ChoiceValueDisambiguatesMatchesWithMultipleShortNames(string name, string fooChoice, string expectedIdentity)
        {
            INewCommandInput commandInput = new MockNewCommandInput(name).WithTemplateOption("foo", fooChoice);

            TemplateResolutionResult matchResult = TemplateResolver.GetTemplateResolutionResult(MultiShortNameGroupTemplateInfo, new MockHostSpecificDataLoader(), commandInput, "C#");

            Assert.Equal(TemplateResolutionResult.Status.SingleMatch, matchResult.ResolutionStatus);
            Assert.Equal(expectedIdentity, matchResult.TemplateToInvoke.Info.Identity);
        }
        [InlineData("eee", "OnlyF", "someValue", "Multiname.Test.Only.FSharp")] // uses a short name from a different template in the group
        public void ParameterExistenceDisambiguatesMatchesWithMultipleShortNames(string name, string paramName, string paramValue, string expectedIdentity)
        {
            INewCommandInput commandInput = new MockNewCommandInput(name).WithTemplateOption(paramName, paramValue);

            TemplateResolutionResult matchResult = TemplateResolver.GetTemplateResolutionResult(MultiShortNameGroupTemplateInfo, new MockHostSpecificDataLoader(), commandInput, "C#");

            Assert.True(matchResult.TryGetSingularInvokableMatch(out ITemplateMatchInfo invokableTemplate, out TemplateResolutionResult.Status resultStatus));
            Assert.Equal(TemplateResolutionResult.Status.SingleMatch, resultStatus);
            Assert.Equal(expectedIdentity, invokableTemplate.Info.Identity);
        }
        internal void GetAmbiguousSingleStartsWithParametersTest(MockNewCommandInput command, MockTemplateInfo[] templates, MockInvalidParameterInfo[] expectedInvalidParams)
        {
            TemplateResolutionResult matchedTemplates = TemplateResolver.GetTemplateResolutionResult(templates, new MockHostSpecificDataLoader(), command, null);

            TemplateGroup templateGroup = matchedTemplates.UnambiguousTemplateGroup;
            IEnumerable <InvalidParameterInfo> invalidParameters = templateGroup.GetAmbiguousSingleStartsWithParameters();

            Assert.Equal(expectedInvalidParams.Length, invalidParameters.Count());
            foreach (MockInvalidParameterInfo exp in expectedInvalidParams)
            {
                Assert.Single(invalidParameters.Where(param => param.ErrorKind == exp.Kind && param.InputFormat == exp.InputFormat && param.SpecifiedValue == exp.SpecifiedValue));
            }
        }
Пример #8
0
        private async Task <CreationResultStatus> EnterTemplateManipulationFlowAsync()
        {
            if (_commandInput.IsListFlagSpecified || _commandInput.IsHelpFlagSpecified)
            {
                TemplateListResolutionResult listingTemplateResolutionResult = TemplateResolver.GetTemplateResolutionResultForListOrHelp(_settingsLoader.UserTemplateCache.TemplateInfo, _hostDataLoader, _commandInput, _defaultLanguage);
                return(HelpForTemplateResolution.CoordinateHelpAndUsageDisplay(listingTemplateResolutionResult, EnvironmentSettings, _commandInput, _hostDataLoader, _telemetryLogger, _templateCreator, _defaultLanguage, showUsageHelp: _commandInput.IsHelpFlagSpecified));
            }

            TemplateResolutionResult templateResolutionResult = TemplateResolver.GetTemplateResolutionResult(_settingsLoader.UserTemplateCache.TemplateInfo, _hostDataLoader, _commandInput, _defaultLanguage);
            TemplateInvocationAndAcquisitionCoordinator invocationCoordinator = new TemplateInvocationAndAcquisitionCoordinator(_settingsLoader, _commandInput, _templateCreator, _hostDataLoader, _telemetryLogger, _defaultLanguage, CommandName, _inputGetter, _callbacks);

            return(await invocationCoordinator.CoordinateInvocationOrAcquisitionAsync());
        }
Пример #9
0
        internal void TemplateResolution_TemplateToInvoke_Test(MockNewCommandInput command, MockTemplateInfo[] templateSet, string defaultLanguage, int expectedStatus, string expectedIdentity)
        {
            TemplateResolutionResult matchResult = TemplateResolver.GetTemplateResolutionResult(templateSet, new MockHostSpecificDataLoader(), command, defaultLanguage);

            Assert.Equal(expectedStatus, (int)matchResult.ResolutionStatus);
            if (expectedStatus == (int)TemplateResolutionResult.Status.SingleMatch)
            {
                Assert.Equal(expectedIdentity, matchResult.TemplateToInvoke.Info.Identity);
            }
            else
            {
                Assert.Null(matchResult.TemplateToInvoke);
            }
        }
        public void TestPerformCoreTemplateQuery_ParameterValueDisambiguates()
        {
            List <ITemplateInfo> templatesToSearch = new List <ITemplateInfo>();

            templatesToSearch.Add(new MockTemplateInfo("foo", name: "Foo template old", identity: "foo.test.old", groupIdentity: "foo.test.template", precedence: 100).WithTag("framework", "netcoreapp1.0", "netcoreapp1.1"));
            templatesToSearch.Add(new MockTemplateInfo("foo", name: "Foo template new", identity: "foo.test.new", groupIdentity: "foo.test.template", precedence: 200).WithTag("framework", "netcoreapp2.0"));

            INewCommandInput userInputs = new MockNewCommandInput("foo").WithTemplateOption("framework", "netcoreapp1.0");

            TemplateResolutionResult matchResult = TemplateResolver.GetTemplateResolutionResult(templatesToSearch, new MockHostSpecificDataLoader(), userInputs, null);

            Assert.True(matchResult.TryGetUnambiguousTemplateGroupToUse(out IReadOnlyList <ITemplateMatchInfo> unambiguousGroup));
            Assert.Equal(1, unambiguousGroup.Count);
            Assert.Equal("foo.test.old", unambiguousGroup[0].Info.Identity);
        }
        public void ExplicitLanguageChoiceIsHonoredWithMultipleShortNames()
        {
            IReadOnlyList <string> shortNamesForGroup = new List <string>()
            {
                "aaa", "bbb", "ccc", "ddd", "eee", "fff"
            };

            foreach (string testShortName in shortNamesForGroup)
            {
                INewCommandInput userInputs = new MockNewCommandInput(testShortName, "F#");

                TemplateResolutionResult matchResult = TemplateResolver.GetTemplateResolutionResult(MultiShortNameGroupTemplateInfo, new MockHostSpecificDataLoader(), userInputs, "C#");
                Assert.Equal(TemplateResolutionResult.Status.SingleMatch, matchResult.ResolutionStatus);
                Assert.Equal("Multiname.Test.Only.FSharp", matchResult.TemplateToInvoke.Info.Identity);
            }
        }
        public void HighestPrecedenceWinsWithMultipleShortNames()
        {
            IReadOnlyList <string> shortNamesForGroup = new List <string>()
            {
                "aaa", "bbb", "ccc", "ddd", "eee", "fff"
            };

            foreach (string testShortName in shortNamesForGroup)
            {
                INewCommandInput userInputs = new MockNewCommandInput(testShortName);

                TemplateResolutionResult matchResult = TemplateResolver.GetTemplateResolutionResult(MultiShortNameGroupTemplateInfo, new MockHostSpecificDataLoader(), userInputs, "C#");
                Assert.True(matchResult.TryGetSingularInvokableMatch(out ITemplateMatchInfo invokableTemplate, out TemplateResolutionResult.Status resultStatus));
                Assert.Equal(TemplateResolutionResult.Status.SingleMatch, resultStatus);
                Assert.Equal("MultiName.Test.High.CSharp", invokableTemplate.Info.Identity);
            }
        }
        public void TestPerformCoreTemplateQuery_UniqueNameMatchesCorrectly()
        {
            List <ITemplateInfo> templatesToSearch = new List <ITemplateInfo>();

            templatesToSearch.Add(new MockTemplateInfo("Template1", name: "Long name of Template1", identity: "Template1"));
            templatesToSearch.Add(new MockTemplateInfo("Template2", name: "Long name of Template2", identity: "Template2"));

            INewCommandInput userInputs = new MockNewCommandInput("Template2");

            TemplateResolutionResult matchResult = TemplateResolver.GetTemplateResolutionResult(templatesToSearch, new MockHostSpecificDataLoader(), userInputs, null);

            Assert.Equal(1, matchResult.GetBestTemplateMatchList().Count);
            Assert.Equal("Template2", matchResult.GetBestTemplateMatchList()[0].Info.Identity);
            Assert.True(matchResult.TryGetUnambiguousTemplateGroupToUse(out IReadOnlyList <ITemplateMatchInfo> unambiguousGroup));
            Assert.Equal(1, unambiguousGroup.Count);
            Assert.Equal("Template2", unambiguousGroup[0].Info.Identity);
        }
        public void TestPerformCoreTemplateQuery_GroupIsFound()
        {
            List <ITemplateInfo> templatesToSearch = new List <ITemplateInfo>();

            templatesToSearch.Add(new MockTemplateInfo("foo", name: "Foo template old", identity: "foo.test.old", groupIdentity: "foo.test.template", precedence: 100));
            templatesToSearch.Add(new MockTemplateInfo("foo", name: "Foo template new", identity: "foo.test.new", groupIdentity: "foo.test.template", precedence: 200));
            templatesToSearch.Add(new MockTemplateInfo("bar", name: "Bar template", identity: "bar.test", groupIdentity: "bar.test.template", precedence: 100));

            INewCommandInput userInputs = new MockNewCommandInput("foo");

            TemplateResolutionResult matchResult = TemplateResolver.GetTemplateResolutionResult(templatesToSearch, new MockHostSpecificDataLoader(), userInputs, null);

            Assert.Equal(2, matchResult.GetBestTemplateMatchList().Count);
            Assert.True(matchResult.TryGetUnambiguousTemplateGroupToUse(out IReadOnlyList <ITemplateMatchInfo> unambiguousGroup));
            Assert.Equal(2, unambiguousGroup.Count);
            Assert.Contains(unambiguousGroup, x => string.Equals(x.Info.Identity, "foo.test.old"));
            Assert.Contains(unambiguousGroup, x => string.Equals(x.Info.Identity, "foo.test.new"));
        }
        public void TestPerformCoreTemplateQuery_InputLanguageIsPreferredOverDefault()
        {
            List <ITemplateInfo> templatesToSearch = new List <ITemplateInfo>();

            templatesToSearch.Add(new MockTemplateInfo("foo", name: "Description of foo Perl template", identity: "foo.test.Perl", groupIdentity: "foo.test.template")
                                  .WithTag("language", "Perl"));
            templatesToSearch.Add(new MockTemplateInfo("foo", name: "Description of foo LISP template", identity: "foo.test.Lisp", groupIdentity: "foo.test.template")
                                  .WithTag("language", "LISP"));

            INewCommandInput userInputs = new MockNewCommandInput("foo", "LISP");

            TemplateResolutionResult matchResult = TemplateResolver.GetTemplateResolutionResult(templatesToSearch, new MockHostSpecificDataLoader(), userInputs, "Perl");

            Assert.Equal(1, matchResult.GetBestTemplateMatchList().Count);
            Assert.True(matchResult.TryGetUnambiguousTemplateGroupToUse(out IReadOnlyList <ITemplateMatchInfo> unambiguousGroup));
            Assert.Equal(1, unambiguousGroup.Count);
            Assert.Equal("foo.test.Lisp", unambiguousGroup[0].Info.Identity);
        }
        public void TestPerformCoreTemplateQuery_UnknownParameterNameInvalidatesMatch()
        {
            List <ITemplateInfo> templatesToSearch = new List <ITemplateInfo>();

            templatesToSearch.Add(new MockTemplateInfo("foo", name: "Foo template", identity: "foo.test", groupIdentity: "foo.test.template", precedence: 100).WithParameters("bar"));

            INewCommandInput userInputs = new MockNewCommandInput("foo").WithTemplateOption("baz");

            IHostSpecificDataLoader hostSpecificDataLoader = new MockHostSpecificDataLoader();

            TemplateResolutionResult matchResult = TemplateResolver.GetTemplateResolutionResult(templatesToSearch, hostSpecificDataLoader, userInputs, null);

            Assert.True(matchResult.TryGetUnambiguousTemplateGroupToUse(out IReadOnlyList <ITemplateMatchInfo> unambiguousGroup));
            Assert.Equal(1, unambiguousGroup.Count);

            Assert.False(TemplateResolver.ValidateRemainingParameters(unambiguousGroup[0], out IReadOnlyList <string> invalidParams));
            Assert.Equal(1, invalidParams.Count);
            Assert.Equal("baz", invalidParams[0]);
        }
Пример #17
0
        internal void TemplateResolution_UnambiguousGroup_Test(MockNewCommandInput command, MockTemplateInfo[] templateSet, string defaultLanguage, int expectedStatus, string[] expectedIdentities)
        {
            var matchResult = TemplateResolver.GetTemplateResolutionResult(templateSet, new MockHostSpecificDataLoader(), command, defaultLanguage);

            Assert.Equal(expectedStatus, (int)matchResult.GroupResolutionStatus);

            if (expectedStatus == (int)TemplateResolutionResult.UnambiguousTemplateGroupStatus.SingleMatch)
            {
                var identities = matchResult.UnambiguousTemplateGroup.Templates.Select(t => t.Info.Identity);
                Assert.Equal(expectedIdentities.Length, identities.Count());
                foreach (string identity in expectedIdentities)
                {
                    Assert.Single(identities.Where(i => i == identity));
                }
            }
            else
            {
                Assert.Null(matchResult.UnambiguousTemplateGroup);
            }
        }
        public void TestPerformCoreTemplateQuery_InvalidChoiceValueInvalidatesMatch()
        {
            List <ITemplateInfo> templatesToSearch = new List <ITemplateInfo>();

            templatesToSearch.Add(new MockTemplateInfo("foo", name: "Foo template", identity: "foo.test.1x", groupIdentity: "foo.test.template", precedence: 100).WithTag("framework", "netcoreapp1.0", "netcoreapp1.1"));
            templatesToSearch.Add(new MockTemplateInfo("foo", name: "Foo template", identity: "foo.test.2x", groupIdentity: "foo.test.template", precedence: 200).WithTag("framework", "netcoreapp2.0"));

            INewCommandInput userInputs = new MockNewCommandInput("foo").WithTemplateOption("framework", "netcoreapp3.0");


            IHostSpecificDataLoader  hostSpecificDataLoader = new MockHostSpecificDataLoader();
            TemplateResolutionResult matchResult            = TemplateResolver.GetTemplateResolutionResult(templatesToSearch, hostSpecificDataLoader, userInputs, null);

            Assert.True(matchResult.TryGetUnambiguousTemplateGroupToUse(out IReadOnlyList <ITemplateMatchInfo> unambiguousGroup));
            Assert.Equal(2, unambiguousGroup.Count);
            Assert.Equal(2, matchResult.GetBestTemplateMatchList().Count);

            Assert.Contains(unambiguousGroup[0].MatchDisposition, x => x.Kind == MatchKind.InvalidParameterValue);
            Assert.Contains(unambiguousGroup[1].MatchDisposition, x => x.Kind == MatchKind.InvalidParameterValue);
        }
Пример #19
0
        private Task <CreationResultStatus> EnterTemplateManipulationFlowAsync()
        {
            if (_commandInput.IsListFlagSpecified || _commandInput.IsHelpFlagSpecified)
            {
                TemplateListResolutionResult listingTemplateResolutionResult = TemplateResolver.GetTemplateResolutionResultForListOrHelp(_settingsLoader.UserTemplateCache.TemplateInfo, _hostDataLoader, _commandInput, _defaultLanguage);
                return(Task.FromResult(HelpForTemplateResolution.CoordinateHelpAndUsageDisplay(listingTemplateResolutionResult, EnvironmentSettings, _commandInput, _hostDataLoader, _telemetryLogger, _templateCreator, _defaultLanguage, showUsageHelp: _commandInput.IsHelpFlagSpecified)));
            }

            TemplateResolutionResult templateResolutionResult = TemplateResolver.GetTemplateResolutionResult(_settingsLoader.UserTemplateCache.TemplateInfo, _hostDataLoader, _commandInput, _defaultLanguage);

            if (templateResolutionResult.ResolutionStatus == TemplateResolutionResult.Status.SingleMatch)
            {
                TemplateInvocationCoordinator invocationCoordinator = new TemplateInvocationCoordinator(_settingsLoader, _commandInput, _telemetryLogger, CommandName, _inputGetter, _callbacks);
                return(invocationCoordinator.CoordinateInvocationOrAcquisitionAsync(templateResolutionResult.TemplateToInvoke));
            }
            else
            {
                return(Task.FromResult(HelpForTemplateResolution.CoordinateAmbiguousTemplateResolutionDisplay(templateResolutionResult, EnvironmentSettings, _commandInput, _defaultLanguage, _settingsLoader.InstallUnitDescriptorCache.Descriptors.Values)));
            }
        }
Пример #20
0
        public void GivenOneInvokableTemplateWithNonDefaultLanguage_ItIsChosen()
        {
            List <ITemplateInfo> templatesToSearch = new List <ITemplateInfo>();

            templatesToSearch.Add(new MockTemplateInfo("foo", name: "Foo template", identity: "foo.test_1", groupIdentity: "foo.test.template", precedence: 100)
                                  .WithTag("language", "F#"));

            INewCommandInput userInputs = new MockNewCommandInput("foo");

            IHostSpecificDataLoader  hostSpecificDataLoader = new MockHostSpecificDataLoader();
            TemplateResolutionResult matchResult            = TemplateResolver.GetTemplateResolutionResult(templatesToSearch, hostSpecificDataLoader, userInputs, null);

            // make sure there's an unambiguous group, otherwise the singular match check is meaningless
            Assert.True(matchResult.TryGetUnambiguousTemplateGroupToUse(out IReadOnlyList <ITemplateMatchInfo> unambiguousGroup));
            Assert.Equal(1, unambiguousGroup.Count);
            Assert.Equal(1, matchResult.GetBestTemplateMatchList().Count);

            Assert.True(matchResult.TryGetSingularInvokableMatch(out ITemplateMatchInfo singularInvokableMatch, out Status resultStatus));
            Assert.Equal(Status.SingleMatch, resultStatus);
            Assert.Equal("foo.test_1", singularInvokableMatch.Info.Identity);
        }
        public void AllTemplatesInGroupUseAllShortNamesForResolution()
        {
            IReadOnlyList <string> shortNamesForGroup = new List <string>()
            {
                "aaa", "bbb", "ccc", "ddd", "eee", "fff"
            };

            foreach (string testShortName in shortNamesForGroup)
            {
                INewCommandInput userInputs = new MockNewCommandInput(testShortName);

                TemplateResolutionResult matchResult = TemplateResolver.GetTemplateResolutionResult(MultiShortNameGroupTemplateInfo, new MockHostSpecificDataLoader(), userInputs, "C#");
                matchResult.TryGetCoreMatchedTemplatesWithDisposition(x => x.IsMatch, out IReadOnlyList <ITemplateMatchInfo> matchedTemplateList);
                Assert.Equal(3, matchedTemplateList.Count);

                foreach (ITemplateMatchInfo templateMatchInfo in matchedTemplateList)
                {
                    Assert.Equal("MultiName.Test", templateMatchInfo.Info.GroupIdentity);
                    Assert.Equal(1, templateMatchInfo.MatchDisposition.Count);
                    Assert.True(templateMatchInfo.MatchDisposition[0].Location == MatchLocation.ShortName && templateMatchInfo.MatchDisposition[0].Kind == MatchKind.Exact);
                }
            }
        }