Skip to content

Commit de80b85

Browse files
committed
New .NET 6 test projects
1 parent 3858ae5 commit de80b85

14 files changed

+254
-3
lines changed

TestProject/TestProject.sln

+15-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.29806.167
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.1.32407.343
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestProject", "TestProject\TestProject.csproj", "{BF9C0A64-28FC-400E-8DBA-9380258919B3}"
77
EndProject
@@ -11,7 +11,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestWebProject", "TestWebPr
1111
EndProject
1212
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestProject5", "TestProject5\TestProject5.csproj", "{D7E3D2EA-3D93-429C-918A-8A542F9E2827}"
1313
EndProject
14-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestWebProject5", "TestWebProject5\TestWebProject5.csproj", "{407315B9-4DCF-4CAD-939E-3395E7DCFD96}"
14+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestWebProject5", "TestWebProject5\TestWebProject5.csproj", "{407315B9-4DCF-4CAD-939E-3395E7DCFD96}"
15+
EndProject
16+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestProject6", "TestProject6\TestProject6.csproj", "{A63D843B-00A0-42A3-8EB6-D835026CE115}"
17+
EndProject
18+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestWebProject6", "TestWebProject6\TestWebProject6.csproj", "{3642E33B-F185-4BCF-B275-8861CC99660F}"
1519
EndProject
1620
Global
1721
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -41,6 +45,14 @@ Global
4145
{407315B9-4DCF-4CAD-939E-3395E7DCFD96}.Debug|Any CPU.Build.0 = Debug|Any CPU
4246
{407315B9-4DCF-4CAD-939E-3395E7DCFD96}.Release|Any CPU.ActiveCfg = Release|Any CPU
4347
{407315B9-4DCF-4CAD-939E-3395E7DCFD96}.Release|Any CPU.Build.0 = Release|Any CPU
48+
{A63D843B-00A0-42A3-8EB6-D835026CE115}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
49+
{A63D843B-00A0-42A3-8EB6-D835026CE115}.Debug|Any CPU.Build.0 = Debug|Any CPU
50+
{A63D843B-00A0-42A3-8EB6-D835026CE115}.Release|Any CPU.ActiveCfg = Release|Any CPU
51+
{A63D843B-00A0-42A3-8EB6-D835026CE115}.Release|Any CPU.Build.0 = Release|Any CPU
52+
{3642E33B-F185-4BCF-B275-8861CC99660F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
53+
{3642E33B-F185-4BCF-B275-8861CC99660F}.Debug|Any CPU.Build.0 = Debug|Any CPU
54+
{3642E33B-F185-4BCF-B275-8861CC99660F}.Release|Any CPU.ActiveCfg = Release|Any CPU
55+
{3642E33B-F185-4BCF-B275-8861CC99660F}.Release|Any CPU.Build.0 = Release|Any CPU
4456
EndGlobalSection
4557
GlobalSection(SolutionProperties) = preSolution
4658
HideSolutionNode = FALSE

TestProject/TestProject6/AClass.cs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace RdJNL.TextTemplatingCore.TestProject6
2+
{
3+
public static class AClass
4+
{
5+
public static string X => "TextABC";
6+
}
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<RootNamespace>RdJNL.TextTemplatingCore.TestProject6</RootNamespace>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.2" />
10+
</ItemGroup>
11+
12+
<ItemGroup>
13+
<None Update="TextTemplate.tt">
14+
<Generator>TextTemplatingFileGeneratorCore</Generator>
15+
<LastGenOutput>TextTemplate.txt</LastGenOutput>
16+
</None>
17+
<None Update="TextTemplate.txt">
18+
<DesignTime>True</DesignTime>
19+
<AutoGen>True</AutoGen>
20+
<DependentUpon>TextTemplate.tt</DependentUpon>
21+
</None>
22+
</ItemGroup>
23+
24+
<ItemGroup>
25+
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
26+
</ItemGroup>
27+
28+
</Project>
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<#@ template debug="true" language="C#" #>
2+
<#@ output extension=".txt" encoding="utf-8" #>
3+
<#@ assembly name="$(ProjectDir)\bin\Debug\net6.0\TestProject6.dll" #>
4+
<#= RdJNL.TextTemplatingCore.TestProject6.AClass.X #>
5+
<#= System.Environment.Version #>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
TextABC
2+
6.0.4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
using Microsoft.Extensions.Logging;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Linq;
6+
using System.Threading.Tasks;
7+
8+
namespace TestWebProject6.Controllers
9+
{
10+
[ApiController]
11+
[Route("[controller]")]
12+
public class WeatherForecastController : ControllerBase
13+
{
14+
private static readonly string[] Summaries = new[]
15+
{
16+
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
17+
};
18+
19+
private readonly ILogger<WeatherForecastController> _logger;
20+
21+
public WeatherForecastController(ILogger<WeatherForecastController> logger)
22+
{
23+
_logger = logger;
24+
}
25+
26+
[HttpGet]
27+
public IEnumerable<WeatherForecast> Get()
28+
{
29+
var rng = new Random();
30+
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
31+
{
32+
Date = DateTime.Now.AddDays(index),
33+
TemperatureC = rng.Next(-20, 55),
34+
Summary = Summaries[rng.Next(Summaries.Length)]
35+
})
36+
.ToArray();
37+
}
38+
}
39+
}
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using Microsoft.AspNetCore.Hosting;
2+
using Microsoft.Extensions.Configuration;
3+
using Microsoft.Extensions.Hosting;
4+
using Microsoft.Extensions.Logging;
5+
using System;
6+
using System.Collections.Generic;
7+
using System.Linq;
8+
using System.Threading.Tasks;
9+
10+
namespace TestWebProject6
11+
{
12+
public class Program
13+
{
14+
public static void Main(string[] args)
15+
{
16+
CreateHostBuilder(args).Build().Run();
17+
}
18+
19+
public static IHostBuilder CreateHostBuilder(string[] args) =>
20+
Host.CreateDefaultBuilder(args)
21+
.ConfigureWebHostDefaults(webBuilder =>
22+
{
23+
webBuilder.UseStartup<Startup>();
24+
});
25+
}
26+
}
+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
using Microsoft.AspNetCore.Builder;
2+
using Microsoft.AspNetCore.Hosting;
3+
using Microsoft.AspNetCore.Mvc;
4+
using Microsoft.Extensions.Configuration;
5+
using Microsoft.Extensions.DependencyInjection;
6+
using Microsoft.Extensions.Hosting;
7+
using Microsoft.Extensions.Logging;
8+
using System;
9+
using System.Collections.Generic;
10+
using System.Linq;
11+
using System.Threading.Tasks;
12+
13+
namespace TestWebProject6
14+
{
15+
public class Startup
16+
{
17+
public Startup(IConfiguration configuration)
18+
{
19+
Configuration = configuration;
20+
}
21+
22+
public IConfiguration Configuration { get; }
23+
24+
// This method gets called by the runtime. Use this method to add services to the container.
25+
public void ConfigureServices(IServiceCollection services)
26+
{
27+
services.AddControllers();
28+
}
29+
30+
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
31+
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
32+
{
33+
if (env.IsDevelopment())
34+
{
35+
app.UseDeveloperExceptionPage();
36+
}
37+
38+
app.UseRouting();
39+
40+
app.UseAuthorization();
41+
42+
app.UseEndpoints(endpoints =>
43+
{
44+
endpoints.MapControllers();
45+
});
46+
}
47+
}
48+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net6.0</TargetFramework>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<None Update="WebTest.tt">
9+
<LastGenOutput>WebTest.txt</LastGenOutput>
10+
<Generator>TextTemplatingFileGeneratorCore</Generator>
11+
</None>
12+
<None Update="WebTest.txt">
13+
<DesignTime>True</DesignTime>
14+
<AutoGen>True</AutoGen>
15+
<DependentUpon>WebTest.tt</DependentUpon>
16+
</None>
17+
</ItemGroup>
18+
19+
<ItemGroup>
20+
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
21+
</ItemGroup>
22+
23+
24+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
3+
namespace TestWebProject6
4+
{
5+
public class WeatherForecast
6+
{
7+
public DateTime Date { get; set; }
8+
9+
public int TemperatureC { get; set; }
10+
11+
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
12+
13+
public string Summary { get; set; }
14+
}
15+
}
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<#@ template language="C#" #>
2+
<#@ output extension=".txt" encoding="utf-8" #>
3+
<#@ assembly name="bin\Debug\net6.0\TestWebProject6.dll" #>
4+
<#@ assembly name="System.Text.Json" #>
5+
<#
6+
var type = typeof(TestWebProject6.Controllers.WeatherForecastController);
7+
#>
8+
Test
9+
<# for( int i = 0; i < 12; ++i ) { #>
10+
#<#= i + 1 #>
11+
<# } #>
12+
<#= type.FullName #>
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Test
2+
#1
3+
#2
4+
#3
5+
#4
6+
#5
7+
#6
8+
#7
9+
#8
10+
#9
11+
#10
12+
#11
13+
#12
14+
TestWebProject6.Controllers.WeatherForecastController
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft": "Warning",
6+
"Microsoft.Hosting.Lifetime": "Information"
7+
}
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft": "Warning",
6+
"Microsoft.Hosting.Lifetime": "Information"
7+
}
8+
},
9+
"AllowedHosts": "*"
10+
}

0 commit comments

Comments
 (0)