Skip to content

Commit

Permalink
Update target framework versions
Browse files Browse the repository at this point in the history
tom-howlett-sonarsource committed Mar 27, 2024
1 parent 0f684b0 commit 236c28b
Showing 6 changed files with 88 additions and 3 deletions.
35 changes: 35 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"version": "0.2.0",
"configurations": [
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md.
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/DotNet5WebApi/bin/Debug/net5.0/DotNet5WebApi.dll",
"args": [],
"cwd": "${workspaceFolder}/DotNet5WebApi",
"stopAtEntry": false,
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}
41 changes: 41 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/DotNet5WebApi.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary;ForceNoAlign"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/DotNet5WebApi.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary;ForceNoAlign"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/DotNet5WebApi.sln"
],
"problemMatcher": "$msCompile"
}
]
}
2 changes: 1 addition & 1 deletion DotNet5WebApi/DotNet5WebApi.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

</Project>
2 changes: 1 addition & 1 deletion DotNet5WebApi/WeatherForecast.cs
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ public class WeatherForecast

public bool IsFreezing()
{
return TemperatureC < 0;
return TemperatureC <= 0;
}

public string Summary { get; set; }
2 changes: 1 addition & 1 deletion TestProject1/TestProject1.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>
9 changes: 9 additions & 0 deletions TestProject1/WeatherForecastTests.cs
Original file line number Diff line number Diff line change
@@ -26,5 +26,14 @@ public void IsNotFreezingTest()
forecast.TemperatureC = 6;
Assert.IsFalse(forecast.IsFreezing());
}

// Test if 0 is considered freezing
[TestMethod()]
public void IsZeroFreezingTest()
{
var forecast = new WeatherForecast();
forecast.TemperatureC = 0;
Assert.IsTrue(forecast.IsFreezing());
}
}
}

0 comments on commit 236c28b

Please sign in to comment.