internal async Task GetCreationEffects_BasicTest_Folder() { using Bootstrapper bootstrapper = BootstrapperFactory.GetBootstrapper(); await bootstrapper.InstallTestTemplateAsync("TemplateWithSourceName").ConfigureAwait(false); string output = TestUtils.CreateTemporaryFolder(); var foundTemplates = await bootstrapper.GetTemplatesAsync( new[] { WellKnownSearchFilters.NameFilter("TestAssets.TemplateWithSourceName") }).ConfigureAwait(false); var result = await bootstrapper.GetCreationEffectsAsync(foundTemplates[0].Info, "test", output, new Dictionary <string, string>(), "").ConfigureAwait(false); Assert.Equal(2, result.CreationResult.PrimaryOutputs.Count); Assert.Equal(0, result.CreationResult.PostActions.Count); Assert.Equal(2, result.FileChanges.Count); var expectedFileChanges = new FileChange[] { new FileChange("bar.cs", "test.cs", ChangeKind.Create), new FileChange("bar/bar.cs", "test/test.cs", ChangeKind.Create), }; IFileChangeComparer comparer = new IFileChangeComparer(); Assert.Equal( expectedFileChanges.OrderBy(s => s, comparer), result.FileChanges.OrderBy(s => s, comparer), comparer); }
internal async Task GetCreationEffects_BasicTest_Package() { using Bootstrapper bootstrapper = BootstrapperFactory.GetBootstrapper(); string packageLocation = await _packageManager.GetNuGetPackage("Microsoft.DotNet.Common.ProjectTemplates.5.0").ConfigureAwait(false); await bootstrapper.InstallTemplateAsync(packageLocation).ConfigureAwait(false); string output = TestUtils.CreateTemporaryFolder(); var foundTemplates = await bootstrapper.GetTemplatesAsync(new[] { WellKnownSearchFilters.NameFilter("console") }).ConfigureAwait(false); var result = await bootstrapper.GetCreationEffectsAsync(foundTemplates[0].Info, "test", output, new Dictionary <string, string>(), "").ConfigureAwait(false); Assert.Equal(2, result.CreationResult.PrimaryOutputs.Count); Assert.Equal(2, result.CreationResult.PostActions.Count); Assert.Equal(2, result.FileChanges.Count); var expectedFileChanges = new FileChange[] { new FileChange("Company.ConsoleApplication1.csproj", "test.csproj", ChangeKind.Create), new FileChange("Program.cs", "Program.cs", ChangeKind.Create), }; IFileChangeComparer comparer = new IFileChangeComparer(); Assert.Equal( expectedFileChanges.OrderBy(s => s, comparer), result.FileChanges.OrderBy(s => s, comparer), comparer); }
internal async Task GetCreationEffects_BasicTest_Package() { var bootstrapper = BootstrapperFactory.GetBootstrapper(); string packageLocation = _packageManager.PackProjectTemplatesNuGetPackage("microsoft.dotnet.common.projecttemplates.5.0"); bootstrapper.InstallTemplate(packageLocation); string output = TestHelper.CreateTemporaryFolder(); var template = bootstrapper.ListTemplates(true, WellKnownSearchFilters.NameFilter("console")); var result = await bootstrapper.GetCreationEffectsAsync(template.First().Info, "test", output, new Dictionary <string, string>(), "").ConfigureAwait(false); Assert.Equal(2, result.CreationResult.PrimaryOutputs.Count); Assert.Equal(2, result.CreationResult.PostActions.Count); Assert.Equal(2, result.FileChanges.Count); var expectedFileChanges = new FileChange[] { new FileChange("Company.ConsoleApplication1.csproj", "test.csproj", ChangeKind.Create), new FileChange("Program.cs", "Program.cs", ChangeKind.Create), }; IFileChangeComparer comparer = new IFileChangeComparer(); Assert.Equal( expectedFileChanges.OrderBy(s => s, comparer), result.FileChanges.OrderBy(s => s, comparer), comparer); }