-
Notifications
You must be signed in to change notification settings - Fork 255
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #532 from sharwell/integration-tests
Add integration tests for successful project creation from templates
- Loading branch information
Showing
43 changed files
with
2,055 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/VisualStudio.Roslyn.SDK/Roslyn.SDK.Template.Wizard/RoslynSDKCodeFixTemplateWizard.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using EnvDTE; | ||
using VSLangProj; | ||
|
||
public class RoslynSDKCodeFixTemplateWizard : RoslynSDKChildTemplateWizard | ||
{ | ||
public static Project Project { get; private set; } | ||
|
||
public override void OnProjectFinishedGenerating(Project project) | ||
{ | ||
Project = project; | ||
|
||
// There is no good way for the test project to reference the main project, so we will use the wizard. | ||
#pragma warning disable VSTHRD010 // Invoke single-threaded types on Main thread | ||
if (project.Object is VSProject vsProject) | ||
#pragma warning restore VSTHRD010 // Invoke single-threaded types on Main thread | ||
{ | ||
var referenceProject = vsProject.References.AddProject(RoslynSDKAnalyzerTemplateWizard.Project); | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/VisualStudio.Roslyn.SDK/Roslyn.SDK.Template.Wizard/RoslynSDKPackageTemplateWizard.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using EnvDTE; | ||
using VSLangProj; | ||
|
||
public class RoslynSDKPackageTemplateWizard : RoslynSDKChildTemplateWizard | ||
{ | ||
public override void OnProjectFinishedGenerating(Project project) | ||
{ | ||
// There is no good way for the test project to reference the main project, so we will use the wizard. | ||
#pragma warning disable VSTHRD010 // Invoke single-threaded types on Main thread | ||
if (project.Object is VSProject vsProject) | ||
#pragma warning restore VSTHRD010 // Invoke single-threaded types on Main thread | ||
{ | ||
_ = vsProject.References.AddProject(RoslynSDKAnalyzerTemplateWizard.Project); | ||
_ = vsProject.References.AddProject(RoslynSDKCodeFixTemplateWizard.Project); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...o.Roslyn.SDK/Roslyn.SDK/ProjectTemplates/CSharp/Diagnostic/CodeFix/CodeFixProvider.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
<IsPackable>false</IsPackable> | ||
<RootNamespace>$saferootprojectname$</RootNamespace> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.3.1" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Compile Update="CodeFixResources.Designer.cs" DesignTime="True" AutoGen="True" DependentUpon="CodeFixResources.resx" /> | ||
<EmbeddedResource Update="CodeFixResources.resx" Generator="ResXFileCodeGenerator" LastGenOutput="CodeFixResources.Designer.cs" /> | ||
</ItemGroup> | ||
|
||
</Project> |
30 changes: 30 additions & 0 deletions
30
...slyn.SDK/Roslyn.SDK/ProjectTemplates/CSharp/Diagnostic/CodeFix/CodeFixProvider.vstemplate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<VSTemplate Version="3.0.0" | ||
Type="Project" | ||
xmlns="http://schemas.microsoft.com/developer/vstemplate/2005"> | ||
<TemplateData> | ||
<Name>CodeFixProvider</Name> | ||
<Description><No description available></Description> | ||
<Icon></Icon> | ||
<ProjectType>CSharp</ProjectType> | ||
<RequiredFrameworkVersion>2.0</RequiredFrameworkVersion> | ||
<SortOrder>952</SortOrder> | ||
<TemplateID>bb967cab-2ca5-4dac-8809-65b2b28a6350</TemplateID> | ||
<CreateNewFolder>true</CreateNewFolder> | ||
<CreateInPlace>true</CreateInPlace> | ||
<DefaultName>CodeFixProvider</DefaultName> | ||
<ProvideDefaultName>true</ProvideDefaultName> | ||
<PromptForSaveOnCreation>true</PromptForSaveOnCreation> | ||
</TemplateData> | ||
<TemplateContent> | ||
<Project TargetFileName="$projectname$.csproj" File="CodeFixProvider.csproj" ReplaceParameters="true"> | ||
<ProjectItem ReplaceParameters="true" TargetFileName="$saferootidentifiername$CodeFixProvider.cs" OpenInEditor="true" OpenOrder="3" >CodeFixProvider.cs</ProjectItem> | ||
<ProjectItem ReplaceParameters="true" TargetFileName="CodeFixResources.resx">CodeFixResources.resx</ProjectItem> | ||
<ProjectItem ReplaceParameters="true" TargetFileName="CodeFixResources.Designer.cs">CodeFixResources.Designer.cs</ProjectItem> | ||
</Project> | ||
</TemplateContent> | ||
<WizardExtension> | ||
<Assembly>Roslyn.SDK.Template.Wizard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35</Assembly> | ||
<FullClassName>RoslynSDKCodeFixTemplateWizard</FullClassName> | ||
</WizardExtension> | ||
</VSTemplate> |
84 changes: 84 additions & 0 deletions
84
...yn.SDK/Roslyn.SDK/ProjectTemplates/CSharp/Diagnostic/CodeFix/CodeFixResources.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.