57 instantiations of TemplateSource
aspire (3)
Commands\NewCommand.cs (1)
610
return await CreateFromSourceAsync(new
TemplateSource
(templatePath ?? ".", templateRepository, templateRepositoryRef), configSource, parseResult, cancellationToken);
Templating\TemplateSourceConfiguration.cs (2)
101
return new(new
TemplateSource
(path, null, null), displayName);
115
return new(new
TemplateSource
(path, repository, reference), displayName);
Aspire.Cli.Tests (54)
Commands\NewCommandLocalTemplateTests.ConfiguredGitSourceObjects.cs (2)
41
Assert.Equal(new
TemplateSource
(expectedPath, "https://example.test/templates", expectedRef), source.Value.Template);
67
Assert.Equal(new
TemplateSource
("templates", repository, "release/17.0"), source.Value.Template);
Commands\NewCommandLocalTemplateTests.ConfiguredGitSources.cs (1)
184
Assert.Equal(new
TemplateSource
(".", repository, null), source.Value.Template);
Commands\NewCommandLocalTemplateTests.ConfiguredSources.cs (1)
192
Assert.Equal(new
TemplateSource
(".", "https://example.test/templates", null), source.Value.Template);
Commands\NewCommandLocalTemplateTests.cs (14)
1334
templateProvider.GetTemplatesAsync(new
TemplateSource
("template", null, null), new CancellationToken(canceled: true)));
1351
var templates = await provider.GetRequiredService<ITemplateProvider>().GetTemplatesAsync(new
TemplateSource
("template", null, null));
1450
var source = new
TemplateSource
("template", "-repository", pinnedCommit ? TestGitCommandRunner.DefaultCommitSha : "main");
1613
new
TemplateSource
("template", "https://example.test/templates.git", null), cancellation.Token));
1644
var first = Assert.Single(await templates.GetTemplatesAsync(new
TemplateSource
("template", "-repository", "main")));
1653
Assert.Single(await templates.GetTemplatesAsync(new
TemplateSource
("./template", "-repository", "v1")));
1787
new
("one", "repository-a", "main"),
1788
new
("two", "repository-a", "main"),
1789
new
("one", "repository-b", "main"),
1790
new
("one", "repository-a", "changed")
1797
Assert.Single(await templates.GetTemplatesAsync(new
TemplateSource
("./one", "repository-a", "same-commit-tag")));
1804
templates.GetTemplatesAsync(new
TemplateSource
("missing", "repository-a", "main")));
1835
var source = new
TemplateSource
("template", "repository", "main");
1875
var source = new
TemplateSource
("template", "repository", "missing");
Commands\NewCommandLocalTemplateTests.InitConfig.cs (3)
151
Assert.Equal(new
TemplateSource
(workspace.Path, null, null), sources.Single(source => source.Key == "Enterprise").Value.Template);
153
Assert.Equal(new
TemplateSource
(".", "https://git.example/shared", "shared-preview"),
162
Assert.Equal(new
TemplateSource
(workspace.Path, null, null),
Commands\NewCommandLocalTemplateTests.NuGetValues.cs (1)
430
var templates = await provider.GetRequiredService<ITemplateProvider>().GetTemplatesAsync(new
TemplateSource
("template", null, null));
Commands\NewCommandLocalTemplateTests.SourceManagement.cs (5)
360
Assert.Equal(new
TemplateSource
("templates/api", "https://example.test/repo", null), source.Value.Template);
396
Assert.Equal(new
TemplateSource
(".", "https://example.test/repo", null),
409
Assert.Equal(new
TemplateSource
("templates/api", "https://example.test/repo", null),
416
Assert.Equal(new
TemplateSource
(".", "https://example.test/repo", null),
495
Assert.Equal(new
TemplateSource
("templates/api", "https://example.test/repo", "release/17.0"), source.Value.Template);
Interaction\ConsoleInteractionServiceTests.cs (8)
125
("aspire[1p]", new
TemplateSource
(nonDefaultGitValues ? "templates/[team]" : ".",
127
("another", new
TemplateSource
("./", "ssh://git@example.test/another.git", "HEAD")),
128
("third", new
TemplateSource
(".\\", "https://example.test/third.git", null)),
129
("local", new
TemplateSource
("C:\\Templates\\Company [local]", null, null))
509
? new
TemplateSource
(".", "https://example.test/organization/[templates]/long-location", "release/[blue]")
510
: new
TemplateSource
("/work/[templates]/long-directory-location", null, null);
1601
[("first", new
TemplateSource
(".", "https://example.test/first.git", null))], executionContext);
1603
[("second", new
TemplateSource
(".", "https://example.test/second.git", null))], executionContext);
Templating\TemplateEngineFactoryGitCheckoutTests.cs (7)
29
new
TemplateSource
(".", repository.FullName, "main"), TestContext.Current.CancellationToken));
48
new
TemplateSource
(".", Path.GetRelativePath(workspace.WorkspaceRoot.FullName, repository.FullName), commit),
68
Assert.Single(await factory.GetTemplatesAsync(new
TemplateSource
(".", repository.FullName, commit), TestContext.Current.CancellationToken));
86
Assert.Single(await factory.GetTemplatesAsync(new
TemplateSource
(".", repository.FullName, "same"), TestContext.Current.CancellationToken));
88
Assert.Single(await factory.GetTemplatesAsync(new
TemplateSource
(".", repository.FullName, "refs/tags/same"), TestContext.Current.CancellationToken));
105
new
TemplateSource
(".", Path.Combine(workspace.Path, "repository-diagnostic-marker"), null), TestContext.Current.CancellationToken));
133
Assert.Single(await factory.GetTemplatesAsync(new
TemplateSource
(".", repository.FullName, commit), TestContext.Current.CancellationToken));
Templating\TemplateEngineFactoryGitTests.cs (9)
40
var source = new
TemplateSource
(".", "repository", CommitSha);
70
new
TemplateSource
(".", "-repository with spaces", commit), TestContext.Current.CancellationToken);
99
GetFactory(provider).GetTemplatesAsync(new
TemplateSource
(".", "repository", CommitSha), TestContext.Current.CancellationToken));
120
GetFactory(provider).GetTemplatesAsync(new
TemplateSource
(".", "repository", CommitSha), TestContext.Current.CancellationToken));
135
GetFactory(provider).GetTemplatesAsync(new
TemplateSource
(".", "repository", CommitSha), new CancellationToken(canceled: true)));
158
GetFactory(provider).GetTemplatesAsync(new
TemplateSource
(".", "repository", resolving ? null : CommitSha), cancellation.Token));
184
GetFactory(provider).GetTemplatesAsync(new
TemplateSource
(".", "repository", CommitSha), TestContext.Current.CancellationToken));
213
GetFactory(provider).GetTemplatesAsync(new
TemplateSource
(".", "repository", null), TestContext.Current.CancellationToken));
242
var templates = await GetFactory(provider).GetTemplatesAsync(new
TemplateSource
(".", "repository", null), TestContext.Current.CancellationToken);
Templating\TemplateSourceConfigurationTests.cs (3)
97
Assert.Equal(new
TemplateSource
(directory, null, null), source.Template);
110
Assert.Equal(new
TemplateSource
(".", "https://example.test/repo", null), source.Template);
129
Assert.Equal(new
TemplateSource
(".", "https://example.test/repo", null), source.Template);
23 references to TemplateSource
aspire (13)
Commands\NewCommand.cs (1)
731
private async Task<CommandResult> CreateFromSourceAsync(
TemplateSource
source, ConfigSource? configSource, ParseResult parseResult, CancellationToken cancellationToken)
Templating\CliTemplateFactory.cs (1)
115
public Task<IEnumerable<ITemplate>> GetTemplatesAsync(
TemplateSource
? source, CancellationToken cancellationToken = default)
Templating\ConfiguredTemplateSourceService.cs (2)
81
var
source = configuredSource.Template
108
internal sealed record ConfiguredTemplate(string SourceName, ITemplate Template, string? SourceDisplayName,
TemplateSource
Source);
Templating\DotNetTemplateFactory.cs (1)
66
public async Task<IEnumerable<ITemplate>> GetTemplatesAsync(
TemplateSource
? source, CancellationToken cancellationToken = default)
Templating\ITemplateFactory.cs (1)
19
Task<IEnumerable<ITemplate>> GetTemplatesAsync(
TemplateSource
? source, CancellationToken cancellationToken = default);
Templating\ITemplateProvider.cs (1)
24
Task<IEnumerable<ITemplate>> GetTemplatesAsync(
TemplateSource
? source, CancellationToken cancellationToken = default);
Templating\TemplateEngineFactory.cs (2)
48
public async Task<IEnumerable<ITemplate>> GetTemplatesAsync(
TemplateSource
? source, CancellationToken cancellationToken = default)
144
var relativePath =
TemplateSource
.GetRepositoryRelativePath(templatePath, pathRoot);
Templating\TemplateProvider.cs (1)
28
public async Task<IEnumerable<ITemplate>> GetTemplatesAsync(
TemplateSource
? source, CancellationToken cancellationToken = default)
Templating\TemplateSourceConfiguration.cs (2)
157
TemplateSource
.GetRepositoryRelativePath(path, Path.GetFullPath("."));
231
internal sealed record ConfiguredTemplateSource(
TemplateSource
? Template, string? DisplayName);
Utils\ConsoleHelpers.cs (1)
47
public static void DisplayTemplateSources(this IInteractionService interactionService, IEnumerable<(string Name,
TemplateSource
Source)> sources, CliExecutionContext executionContext)
Aspire.Cli.Tests (10)
Commands\NewCommandChannelResolutionTests.cs (1)
770
public Task<IEnumerable<ITemplate>> GetTemplatesAsync(
TemplateSource
? source, CancellationToken cancellationToken = default) =>
Commands\NewCommandLocalTemplateTests.cs (5)
1450
var
source = new TemplateSource("template", "-repository", pinnedCommit ? TestGitCommandRunner.DefaultCommitSha : "main");
1785
TemplateSource
[] sources =
1792
foreach (
var
source in sources)
1835
var
source = new TemplateSource("template", "repository", "main");
1875
var
source = new TemplateSource("template", "repository", "missing");
Interaction\ConsoleInteractionServiceTests.cs (1)
508
var
source = gitSource
Templating\TemplateEngineFactoryGitTests.cs (1)
40
var
source = new TemplateSource(".", "repository", CommitSha);
Templating\TemplateSourceConfigurationTests.cs (2)
41
Assert.Equal(expected,
TemplateSource
.GetRepositoryRelativePath(path, root));
52
Assert.Throws<TemplateDiscoveryException>(() =>
TemplateSource
.GetRepositoryRelativePath(path, root));