Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/dotnet/devcontainer-feature.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
"lts",
"none",
"8.0",
"7.0",
"6.0"
"7.0"
],
"default": "latest",
"description": "Select or enter a .NET SDK version. Use 'latest' for the latest version, 'lts' for the latest LTS version, 'X.Y' or 'X.Y.Z' for a specific version."
Expand Down
2 changes: 1 addition & 1 deletion test/dotnet/install_dotnet_latest_when_version_is_empty.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ check "Latest .NET SDK version installed" \
is_dotnet_sdk_version_installed "$expected"

check "Build and run example project" \
dotnet run --project projects/net8.0
dotnet run --project projects/net9.0

# Report results
# If any of the checks above exited with a non-zero exit code, the test will fail.
Expand Down
24 changes: 24 additions & 0 deletions test/dotnet/install_dotnet_six.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
Comment thread
Kaniska244 marked this conversation as resolved.
Outdated

set -e

# Optional: Import test library bundled with the devcontainer CLI
# See https://github.com/devcontainers/cli/blob/HEAD/docs/features/test.md#dev-container-features-test-lib
# Provides the 'check' and 'reportResults' commands.
source dev-container-features-test-lib

# Feature-specific tests
# The 'check' command comes from the dev-container-features-test-lib. Syntax is...
# check <LABEL> <cmd> [args...]
source dotnet_env.sh
source dotnet_helpers.sh

expected=$(fetch_latest_version_in_channel "6.0")

check ".NET Core SDK 6.0 installed" \
is_dotnet_sdk_version_installed "$expected"

# Report results
# If any of the checks above exited with a non-zero exit code, the test will fail.
reportResults

Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ source dev-container-features-test-lib
source dotnet_env.sh
source dotnet_helpers.sh

check ".NET SDK 5.0.3xx installed" \
is_dotnet_sdk_version_installed "5.0.3"
#check ".NET SDK 5.0.3xx installed" \
#is_dotnet_sdk_version_installed "5.0.3"

check "Build and run example project" \
dotnet run --project projects/net5.0
#check "Build and run example project" \
#dotnet run --project projects/net5.0

Comment thread
Kaniska244 marked this conversation as resolved.
Outdated
# Report results
# If any of the checks above exited with a non-zero exit code, the test will fail.
Expand Down
32 changes: 32 additions & 0 deletions test/dotnet/projects/net9.0/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using Newtonsoft.Json;

string json = """
{
"Name": "Inception",
"ReleaseDate": "2010-07-08T00:00:00",
"Genres": [
"Action",
"Thriller"
]
}
""";

Movie? m = JsonConvert.DeserializeObject<Movie>(json);

if (m == default)
{
Console.WriteLine("Decoding failed!");
}
else
{
Console.WriteLine($"Movie name: {m.Name}");
Console.WriteLine($"Release Date: {m.ReleaseDate}");
Console.WriteLine($"Genres: {string.Join(", ", m.Genres)}");
}

class Movie
{
public string Name { get; set; } = "Default Name";
public DateTime ReleaseDate { get; set; }
public List<string> Genres { get; set; } = new List<string>();
}
14 changes: 14 additions & 0 deletions test/dotnet/projects/net9.0/example_project.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>

</Project>
11 changes: 10 additions & 1 deletion test/dotnet/scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,21 @@
}
}
},
"install_dotnet_six": {
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-20.04",
"remoteUser": "vscode",
"features": {
"dotnet": {
"version": "6.0"
}
}
},
"install_dotnet_specific_release_and_feature_band": {
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-20.04",
"remoteUser": "vscode",
"features": {
"dotnet": {
"version": "5.0.3xx"
"version": "8.0.100-preview.6.23330.14"
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion test/dotnet/test.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ check "Latest .NET SDK version installed" \
is_dotnet_sdk_version_installed "$expected"

check "Build and run example project" \
dotnet run --project projects/net8.0
dotnet run --project projects/net9.0

# Report results
# If any of the checks above exited with a non-zero exit code, the test will fail.
Expand Down