public void Update_Legacy_CanParseInteractiveOption(string testCase) { ITemplateEngineHost host = TestHost.GetVirtualHost(additionalComponents: BuiltInTemplatePackagesProviderFactory.GetComponents(includeTestTemplates: false)); NewCommand myCommand = (NewCommand)NewCommandFactory.Create("new", _ => host, _ => new TelemetryLogger(null, false), new NewCommandCallbacks()); var parseResult = myCommand.Parse(testCase); UpdateCommandArgs args = new UpdateCommandArgs((BaseUpdateCommand)parseResult.CommandResult.Command, parseResult); Assert.True(args.Interactive); }
public void Update_CanParseAddSourceOption_MultipleEntries(string testCase) { ITemplateEngineHost host = TestHost.GetVirtualHost(additionalComponents: BuiltInTemplatePackagesProviderFactory.GetComponents(includeTestTemplates: false)); NewCommand myCommand = (NewCommand)NewCommandFactory.Create("new", _ => host, _ => new TelemetryLogger(null, false), new NewCommandCallbacks()); var parseResult = myCommand.Parse(testCase); UpdateCommandArgs args = new UpdateCommandArgs((UpdateCommand)parseResult.CommandResult.Command, parseResult); Assert.Equal(2, args.AdditionalSources?.Count); Assert.Contains("my-custom-source1", args.AdditionalSources); Assert.Contains("my-custom-source2", args.AdditionalSources); }
public void Update_Legacy_CanParseCheckOnlyOption() { ITemplateEngineHost host = TestHost.GetVirtualHost(additionalComponents: BuiltInTemplatePackagesProviderFactory.GetComponents(includeTestTemplates: false)); NewCommand myCommand = (NewCommand)NewCommandFactory.Create("new", _ => host, _ => new TelemetryLogger(null, false), new NewCommandCallbacks()); var parseResult = myCommand.Parse($"new --update-check"); UpdateCommandArgs args = new UpdateCommandArgs((LegacyUpdateCheckCommand)parseResult.CommandResult.Command, parseResult); Assert.True(args.CheckOnly); parseResult = myCommand.Parse($"new --update-apply"); args = new UpdateCommandArgs((LegacyUpdateApplyCommand)parseResult.CommandResult.Command, parseResult); Assert.False(args.CheckOnly); }