Skip to content

Commit

Permalink
To check tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaniska244 committed Dec 17, 2024
1 parent 675952b commit e01c9ad
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 11 deletions.
2 changes: 1 addition & 1 deletion test/dotnet/install_dotnet_exact_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ check ".NET SDK 8.0.100-preview.6.23330.14 installed" \
is_dotnet_sdk_version_installed "8.0.100-preview.6.23330.14"

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
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
2 changes: 1 addition & 1 deletion test/dotnet/install_dotnet_lts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ check "Latest LTS 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
3 changes: 0 additions & 3 deletions test/dotnet/install_dotnet_multiple_versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ is_dotnet_sdk_version_installed "8.0"
check ".NET SDK 7.0 installed" \
is_dotnet_sdk_version_installed "7.0"

check ".NET SDK 6.0 installed" \
is_dotnet_sdk_version_installed "6.0"

check "Build example class library" \
dotnet build projects/multitargeting

Expand Down
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

# 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>
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

0 comments on commit e01c9ad

Please sign in to comment.