Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit 1cc4498

Browse files
author
N. Taylor Mullen
committed
Add end-to-end functional tests.
- This involved building a simple test application to perform dotnet commands onto. - Created a testartifacts directory during functional test runs to isolate functional test package requirements from a users machine. Without this you'd end up with temporary packages polluting your local nuget packages home directory. - Added makefile target to ensure initial builds work when running tests. #62
1 parent 3550d39 commit 1cc4498

28 files changed

Lines changed: 1126 additions & 14 deletions

RazorTooling.TestApps.sln

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 14
4+
VisualStudioVersion = 14.0.25420.1
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "testapps", "testapps", "{0FEA34D0-789B-43BF-BBA3-CD92D56321A4}"
7+
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B8E45335-6D2E-45DE-BED5-D48E67D0DC45}"
9+
ProjectSection(SolutionItems) = preProject
10+
global.json = global.json
11+
NuGet.config = NuGet.config
12+
EndProjectSection
13+
EndProject
14+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "RazorToolingTestApp.Library", "testapps\RazorToolingTestApp.Library\RazorToolingTestApp.Library.xproj", "{CF8D2020-2F4C-4C9F-9B5E-76A0A3E33731}"
15+
EndProject
16+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "RazorToolingTestApp", "testapps\RazorToolingTestApp\RazorToolingTestApp.xproj", "{2F254FF7-6B16-4C1C-8683-0D21C887611E}"
17+
EndProject
18+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{0A6865A4-0097-43B8-8579-9D4ADF2012DA}"
19+
EndProject
20+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "RazorToolingTestApp.LibraryPackage", "src\RazorToolingTestApp.LibraryPackage\RazorToolingTestApp.LibraryPackage.xproj", "{DAE3EE34-5C21-4A05-8C0F-2DD1C18BB25B}"
21+
EndProject
22+
Global
23+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
24+
Debug|Any CPU = Debug|Any CPU
25+
Release|Any CPU = Release|Any CPU
26+
EndGlobalSection
27+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
28+
{CF8D2020-2F4C-4C9F-9B5E-76A0A3E33731}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29+
{CF8D2020-2F4C-4C9F-9B5E-76A0A3E33731}.Debug|Any CPU.Build.0 = Debug|Any CPU
30+
{CF8D2020-2F4C-4C9F-9B5E-76A0A3E33731}.Release|Any CPU.ActiveCfg = Release|Any CPU
31+
{CF8D2020-2F4C-4C9F-9B5E-76A0A3E33731}.Release|Any CPU.Build.0 = Release|Any CPU
32+
{2F254FF7-6B16-4C1C-8683-0D21C887611E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33+
{2F254FF7-6B16-4C1C-8683-0D21C887611E}.Debug|Any CPU.Build.0 = Debug|Any CPU
34+
{2F254FF7-6B16-4C1C-8683-0D21C887611E}.Release|Any CPU.ActiveCfg = Release|Any CPU
35+
{2F254FF7-6B16-4C1C-8683-0D21C887611E}.Release|Any CPU.Build.0 = Release|Any CPU
36+
{DAE3EE34-5C21-4A05-8C0F-2DD1C18BB25B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
37+
{DAE3EE34-5C21-4A05-8C0F-2DD1C18BB25B}.Debug|Any CPU.Build.0 = Debug|Any CPU
38+
{DAE3EE34-5C21-4A05-8C0F-2DD1C18BB25B}.Release|Any CPU.ActiveCfg = Release|Any CPU
39+
{DAE3EE34-5C21-4A05-8C0F-2DD1C18BB25B}.Release|Any CPU.Build.0 = Release|Any CPU
40+
EndGlobalSection
41+
GlobalSection(SolutionProperties) = preSolution
42+
HideSolutionNode = FALSE
43+
EndGlobalSection
44+
GlobalSection(NestedProjects) = preSolution
45+
{CF8D2020-2F4C-4C9F-9B5E-76A0A3E33731} = {0FEA34D0-789B-43BF-BBA3-CD92D56321A4}
46+
{2F254FF7-6B16-4C1C-8683-0D21C887611E} = {0FEA34D0-789B-43BF-BBA3-CD92D56321A4}
47+
{DAE3EE34-5C21-4A05-8C0F-2DD1C18BB25B} = {0A6865A4-0097-43B8-8579-9D4ADF2012DA}
48+
EndGlobalSection
49+
EndGlobal

RazorTooling.sln

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Razor.
1818
EndProject
1919
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Razor.Design.Test", "test\Microsoft.AspNetCore.Razor.Design.Test\Microsoft.AspNetCore.Razor.Design.Test.xproj", "{C4279BCD-DADD-4354-B28D-B7FE24BAD230}"
2020
EndProject
21+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.Razor.Tools.Test", "test\Microsoft.AspNetCore.Razor.Tools.Test\Microsoft.AspNetCore.Razor.Tools.Test.xproj", "{D0754BC0-B357-4ABD-8964-00F61BE15CDD}"
22+
EndProject
23+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "testapps", "testapps", "{55C25CA3-70A9-41BC-A0D5-7B44D06CC6CD}"
24+
EndProject
25+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "RazorToolingTestApp.Library", "testapps\RazorToolingTestApp.Library\RazorToolingTestApp.Library.xproj", "{CF8D2020-2F4C-4C9F-9B5E-76A0A3E33731}"
26+
EndProject
27+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "RazorToolingTestApp.LibraryPackage", "src\RazorToolingTestApp.LibraryPackage\RazorToolingTestApp.LibraryPackage.xproj", "{DAE3EE34-5C21-4A05-8C0F-2DD1C18BB25B}"
28+
EndProject
2129
Global
2230
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2331
debug_x86|Any CPU = debug_x86|Any CPU
@@ -50,6 +58,30 @@ Global
5058
{C4279BCD-DADD-4354-B28D-B7FE24BAD230}.release_x86|Any CPU.Build.0 = Release|Any CPU
5159
{C4279BCD-DADD-4354-B28D-B7FE24BAD230}.Release|Any CPU.ActiveCfg = Release|Any CPU
5260
{C4279BCD-DADD-4354-B28D-B7FE24BAD230}.Release|Any CPU.Build.0 = Release|Any CPU
61+
{D0754BC0-B357-4ABD-8964-00F61BE15CDD}.debug_x86|Any CPU.ActiveCfg = Debug|Any CPU
62+
{D0754BC0-B357-4ABD-8964-00F61BE15CDD}.debug_x86|Any CPU.Build.0 = Debug|Any CPU
63+
{D0754BC0-B357-4ABD-8964-00F61BE15CDD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
64+
{D0754BC0-B357-4ABD-8964-00F61BE15CDD}.Debug|Any CPU.Build.0 = Debug|Any CPU
65+
{D0754BC0-B357-4ABD-8964-00F61BE15CDD}.release_x86|Any CPU.ActiveCfg = Release|Any CPU
66+
{D0754BC0-B357-4ABD-8964-00F61BE15CDD}.release_x86|Any CPU.Build.0 = Release|Any CPU
67+
{D0754BC0-B357-4ABD-8964-00F61BE15CDD}.Release|Any CPU.ActiveCfg = Release|Any CPU
68+
{D0754BC0-B357-4ABD-8964-00F61BE15CDD}.Release|Any CPU.Build.0 = Release|Any CPU
69+
{CF8D2020-2F4C-4C9F-9B5E-76A0A3E33731}.debug_x86|Any CPU.ActiveCfg = Debug|Any CPU
70+
{CF8D2020-2F4C-4C9F-9B5E-76A0A3E33731}.debug_x86|Any CPU.Build.0 = Debug|Any CPU
71+
{CF8D2020-2F4C-4C9F-9B5E-76A0A3E33731}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
72+
{CF8D2020-2F4C-4C9F-9B5E-76A0A3E33731}.Debug|Any CPU.Build.0 = Debug|Any CPU
73+
{CF8D2020-2F4C-4C9F-9B5E-76A0A3E33731}.release_x86|Any CPU.ActiveCfg = Release|Any CPU
74+
{CF8D2020-2F4C-4C9F-9B5E-76A0A3E33731}.release_x86|Any CPU.Build.0 = Release|Any CPU
75+
{CF8D2020-2F4C-4C9F-9B5E-76A0A3E33731}.Release|Any CPU.ActiveCfg = Release|Any CPU
76+
{CF8D2020-2F4C-4C9F-9B5E-76A0A3E33731}.Release|Any CPU.Build.0 = Release|Any CPU
77+
{DAE3EE34-5C21-4A05-8C0F-2DD1C18BB25B}.debug_x86|Any CPU.ActiveCfg = Debug|Any CPU
78+
{DAE3EE34-5C21-4A05-8C0F-2DD1C18BB25B}.debug_x86|Any CPU.Build.0 = Debug|Any CPU
79+
{DAE3EE34-5C21-4A05-8C0F-2DD1C18BB25B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
80+
{DAE3EE34-5C21-4A05-8C0F-2DD1C18BB25B}.Debug|Any CPU.Build.0 = Debug|Any CPU
81+
{DAE3EE34-5C21-4A05-8C0F-2DD1C18BB25B}.release_x86|Any CPU.ActiveCfg = Release|Any CPU
82+
{DAE3EE34-5C21-4A05-8C0F-2DD1C18BB25B}.release_x86|Any CPU.Build.0 = Release|Any CPU
83+
{DAE3EE34-5C21-4A05-8C0F-2DD1C18BB25B}.Release|Any CPU.ActiveCfg = Release|Any CPU
84+
{DAE3EE34-5C21-4A05-8C0F-2DD1C18BB25B}.Release|Any CPU.Build.0 = Release|Any CPU
5385
EndGlobalSection
5486
GlobalSection(SolutionProperties) = preSolution
5587
HideSolutionNode = FALSE
@@ -58,5 +90,8 @@ Global
5890
{6F1CAB8C-2315-46BB-B9B4-00564743590C} = {253024B2-368B-4B24-9CD3-D48E9C1EC948}
5991
{60043E40-0D14-4E41-A97A-52A7A1BB5A26} = {253024B2-368B-4B24-9CD3-D48E9C1EC948}
6092
{C4279BCD-DADD-4354-B28D-B7FE24BAD230} = {8D49C692-BA71-43C4-927F-E9E2BA8FC795}
93+
{D0754BC0-B357-4ABD-8964-00F61BE15CDD} = {8D49C692-BA71-43C4-927F-E9E2BA8FC795}
94+
{CF8D2020-2F4C-4C9F-9B5E-76A0A3E33731} = {55C25CA3-70A9-41BC-A0D5-7B44D06CC6CD}
95+
{DAE3EE34-5C21-4A05-8C0F-2DD1C18BB25B} = {253024B2-368B-4B24-9CD3-D48E9C1EC948}
6196
EndGlobalSection
6297
EndGlobal

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"projects": [ "src" ]
2+
"projects": [ "src", "testapps" ]
33
}

makefile.shade

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ use namespace="System.IO"
22
use namespace="System.IO.Compression"
33
use namespace="System.Linq"
44

5-
default CONFIGURATION_LOCAL='${E("Configuration")}'
65
default BASE_DIR_LOCAL='${Directory.GetCurrentDirectory()}'
76
default BUILD_DIR_LOCAL='${Path.Combine(BASE_DIR_LOCAL, "artifacts", "build")}'
87
default TOOL_PROJECT_NAME='Microsoft.AspNetCore.Razor.Design'
98
default TOOL_EXE_NAME='Microsoft.AspNetCore.Razor.Design.exe'
9+
default TEST_PROJECT_PACKAGE_NAME='RazorToolingTestApp.LibraryPackage'
10+
default TEST_ARTIFACTS_DIR='${Path.Combine(BASE_DIR_LOCAL, "testartifacts")}'
11+
default TEST_ARTIFACTS_INITIAL_PACKAGE_DIR='${Path.Combine(TEST_ARTIFACTS_DIR, "initialpackages")}'
1012
var VERSION='0.1'
1113
var FULL_VERSION='0.1'
1214
var AUTHORS='Microsoft Open Technologies, Inc.'
@@ -15,13 +17,25 @@ var AUTHORS='Microsoft Open Technologies, Inc.'
1517
use-standard-lifecycle
1618
k-standard-goals
1719

18-
#repack-x86 target='compile' if='Directory.Exists("src")'
20+
default CONFIGURATION_LOCAL='${E("Configuration")}'
21+
22+
#pack-test-dependencies target='repo-initialize'
23+
rimraf rimrafDir='${TEST_ARTIFACTS_INITIAL_PACKAGE_DIR}' if='Directory.Exists(TEST_ARTIFACTS_INITIAL_PACKAGE_DIR)'
24+
1925
@{
20-
if (string.IsNullOrEmpty(CONFIGURATION_LOCAL))
21-
{
22-
CONFIGURATION_LOCAL = "Debug";
23-
}
26+
Directory.CreateDirectory(TEST_ARTIFACTS_INITIAL_PACKAGE_DIR);
27+
var projectDirectory = Path.Combine(BASE_DIR_LOCAL, "src", TEST_PROJECT_PACKAGE_NAME);
2428

29+
Dotnet("restore " + projectDirectory);
30+
Dotnet("pack " + projectDirectory + " -o " + TEST_ARTIFACTS_INITIAL_PACKAGE_DIR);
31+
32+
// Restore testapps folder locally to ensure all dynamically generated packages have been cached.
33+
var testProjectDirectory = Path.Combine(BASE_DIR_LOCAL, "testapps");
34+
Dotnet("restore " + testProjectDirectory + " -f " + TEST_ARTIFACTS_INITIAL_PACKAGE_DIR);
35+
}
36+
37+
#repack-x86 target='compile' if='Directory.Exists("src")'
38+
@{
2539
// Forcing to lower to match the entry in the sources project.json.
2640
var configurationX86 = CONFIGURATION_LOCAL.ToLower() + "_x86";
2741

@@ -78,3 +92,7 @@ k-standard-goals
7892
// Don't care if we couldn't delete the temp directory.
7993
}
8094
}
95+
96+
97+
macro name="DotnetRestore" restoreDir='string'
98+
dotnet-restore
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
using System.Collections.Generic;
5+
using Microsoft.AspNetCore.Razor.Compilation.TagHelpers;
6+
7+
namespace Microsoft.AspNetCore.Razor.Design.Internal
8+
{
9+
public class ResolvedTagHelperDescriptorsResult
10+
{
11+
public IEnumerable<TagHelperDescriptor> Descriptors { get; set; }
12+
13+
public IEnumerable<RazorError> Errors { get; set; }
14+
}
15+
}

src/Microsoft.AspNetCore.Razor.Design/ResolveTagHelpersCommandBase.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System;
55
using System.Collections.Generic;
66
using Microsoft.AspNetCore.Razor.Compilation.TagHelpers;
7+
using Microsoft.AspNetCore.Razor.Design.Internal;
78
using Microsoft.Extensions.CommandLineUtils;
89
using Newtonsoft.Json;
910

@@ -70,12 +71,5 @@ private void Register(CommandLineApplication app)
7071
config.OnExecute((Func<int>)OnExecute);
7172
});
7273
}
73-
74-
private class ResolvedTagHelperDescriptorsResult
75-
{
76-
public IEnumerable<TagHelperDescriptor> Descriptors { get; set; }
77-
78-
public IEnumerable<RazorError> Errors { get; set; }
79-
}
8074
}
8175
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0.25420" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25420</VisualStudioVersion>
5+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
6+
</PropertyGroup>
7+
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
8+
<PropertyGroup Label="Globals">
9+
<ProjectGuid>dae3ee34-5c21-4a05-8c0f-2dd1c18bb25b</ProjectGuid>
10+
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
11+
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
12+
</PropertyGroup>
13+
14+
<PropertyGroup>
15+
<SchemaVersion>2.0</SchemaVersion>
16+
</PropertyGroup>
17+
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
18+
</Project>

0 commit comments

Comments
 (0)