diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/dotnet/assert_run_project.sh | 8 | ||||
-rw-r--r-- | test/dotnet/example_project/.gitignore | 2 | ||||
-rw-r--r-- | test/dotnet/example_project/Movie.cs | 8 | ||||
-rw-r--r-- | test/dotnet/example_project/Program.cs | 27 | ||||
-rw-r--r-- | test/dotnet/example_project/example_project.csproj | 14 | ||||
-rw-r--r-- | test/dotnet/install_additional_dotnet.sh | 2 | ||||
-rw-r--r-- | test/dotnet/install_dotnet_3.sh | 2 | ||||
-rw-r--r-- | test/dotnet/install_dotnet_6_focal.sh | 2 | ||||
-rw-r--r-- | test/dotnet/install_dotnet_7_bullseye.sh | 2 | ||||
-rw-r--r-- | test/dotnet/install_dotnet_7_jammy.sh | 2 | ||||
-rw-r--r-- | test/dotnet/install_dotnet_latest.sh | 2 | ||||
-rw-r--r-- | test/dotnet/install_dotnet_lts.sh | 2 | ||||
-rw-r--r-- | test/dotnet/install_non_root_remoteUser.sh | 13 | ||||
-rw-r--r-- | test/dotnet/install_wo_apt.sh | 2 | ||||
-rw-r--r-- | test/dotnet/scenarios.json | 9 | ||||
-rwxr-xr-x | test/dotnet/test.sh | 2 |
16 files changed, 99 insertions, 0 deletions
diff --git a/test/dotnet/assert_run_project.sh b/test/dotnet/assert_run_project.sh new file mode 100644 index 0000000..872d068 --- /dev/null +++ b/test/dotnet/assert_run_project.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -e + +source dev-container-features-test-lib + +cd example_project +check "dotnet run" bash -c "dotnet run | grep 'Inception'"
\ No newline at end of file diff --git a/test/dotnet/example_project/.gitignore b/test/dotnet/example_project/.gitignore new file mode 100644 index 0000000..8d4a6c0 --- /dev/null +++ b/test/dotnet/example_project/.gitignore @@ -0,0 +1,2 @@ +bin +obj
\ No newline at end of file diff --git a/test/dotnet/example_project/Movie.cs b/test/dotnet/example_project/Movie.cs new file mode 100644 index 0000000..9d549ef --- /dev/null +++ b/test/dotnet/example_project/Movie.cs @@ -0,0 +1,8 @@ +// See https://aka.ms/new-console-template for more information + +internal class Movie +{ + public string Name { get; set; } = "Default Name"; + public DateTime ReleaseDate { get; set; } + public List<string> Genres { get; set; } = new List<string>(); +} diff --git a/test/dotnet/example_project/Program.cs b/test/dotnet/example_project/Program.cs new file mode 100644 index 0000000..7beb65f --- /dev/null +++ b/test/dotnet/example_project/Program.cs @@ -0,0 +1,27 @@ +// See https://aka.ms/new-console-template for more information
+
+using Newtonsoft.Json;
+
+Console.WriteLine("Hello, World!");
+
+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($"Name: {m.Name}");
+ Console.WriteLine($"Release Date: {m.ReleaseDate}");
+ Console.WriteLine($"Genres: {string.Join(", ", m.Genres)}");
+}
diff --git a/test/dotnet/example_project/example_project.csproj b/test/dotnet/example_project/example_project.csproj new file mode 100644 index 0000000..6132c9e --- /dev/null +++ b/test/dotnet/example_project/example_project.csproj @@ -0,0 +1,14 @@ +<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>net7.0</TargetFramework>
+ <ImplicitUsings>enable</ImplicitUsings>
+ <Nullable>enable</Nullable>
+ </PropertyGroup>
+
+ <ItemGroup> + <PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> + </ItemGroup>
+
+</Project>
diff --git a/test/dotnet/install_additional_dotnet.sh b/test/dotnet/install_additional_dotnet.sh index e69c7dc..b077462 100644 --- a/test/dotnet/install_additional_dotnet.sh +++ b/test/dotnet/install_additional_dotnet.sh @@ -13,5 +13,7 @@ check "dotnet version 3.1.420 installed" bash -c "ls -l /usr/local/dotnet | gre check "current link dotnet" /usr/local/dotnet/current/dotnet --info check "current link sdk" ls -l /usr/local/dotnet/current/sdk +./assert_run_project.sh + # Report result reportResults diff --git a/test/dotnet/install_dotnet_3.sh b/test/dotnet/install_dotnet_3.sh index 51d871b..aed11f5 100644 --- a/test/dotnet/install_dotnet_3.sh +++ b/test/dotnet/install_dotnet_3.sh @@ -13,5 +13,7 @@ check "dotnet version 3 installed" bash -c "ls -l /usr/share/dotnet/sdk | grep check "current link dotnet" /usr/local/dotnet/current/dotnet --info check "current link sdk" ls -l /usr/local/dotnet/current/sdk +./assert_run_project.sh + # Report result reportResults diff --git a/test/dotnet/install_dotnet_6_focal.sh b/test/dotnet/install_dotnet_6_focal.sh index 758f040..2b97e75 100644 --- a/test/dotnet/install_dotnet_6_focal.sh +++ b/test/dotnet/install_dotnet_6_focal.sh @@ -13,5 +13,7 @@ check "dotnet version 6 installed" bash -c "ls -l /usr/share/dotnet/sdk | grep check "current link dotnet" /usr/local/dotnet/current/dotnet --info check "current link sdk" ls -l /usr/local/dotnet/current/sdk +./assert_run_project.sh + # Report result reportResults diff --git a/test/dotnet/install_dotnet_7_bullseye.sh b/test/dotnet/install_dotnet_7_bullseye.sh index 2c015fc..6e78d7a 100644 --- a/test/dotnet/install_dotnet_7_bullseye.sh +++ b/test/dotnet/install_dotnet_7_bullseye.sh @@ -13,5 +13,7 @@ check "dotnet version 7 installed" bash -c "ls -l /usr/share/dotnet/sdk | grep check "current link dotnet" /usr/local/dotnet/current/dotnet --info check "current link sdk" ls -l /usr/local/dotnet/current/sdk +./assert_run_project.sh + # Report result reportResults diff --git a/test/dotnet/install_dotnet_7_jammy.sh b/test/dotnet/install_dotnet_7_jammy.sh index 2c015fc..6e78d7a 100644 --- a/test/dotnet/install_dotnet_7_jammy.sh +++ b/test/dotnet/install_dotnet_7_jammy.sh @@ -13,5 +13,7 @@ check "dotnet version 7 installed" bash -c "ls -l /usr/share/dotnet/sdk | grep check "current link dotnet" /usr/local/dotnet/current/dotnet --info check "current link sdk" ls -l /usr/local/dotnet/current/sdk +./assert_run_project.sh + # Report result reportResults diff --git a/test/dotnet/install_dotnet_latest.sh b/test/dotnet/install_dotnet_latest.sh index 2c015fc..6e78d7a 100644 --- a/test/dotnet/install_dotnet_latest.sh +++ b/test/dotnet/install_dotnet_latest.sh @@ -13,5 +13,7 @@ check "dotnet version 7 installed" bash -c "ls -l /usr/share/dotnet/sdk | grep check "current link dotnet" /usr/local/dotnet/current/dotnet --info check "current link sdk" ls -l /usr/local/dotnet/current/sdk +./assert_run_project.sh + # Report result reportResults diff --git a/test/dotnet/install_dotnet_lts.sh b/test/dotnet/install_dotnet_lts.sh index 758f040..2b97e75 100644 --- a/test/dotnet/install_dotnet_lts.sh +++ b/test/dotnet/install_dotnet_lts.sh @@ -13,5 +13,7 @@ check "dotnet version 6 installed" bash -c "ls -l /usr/share/dotnet/sdk | grep check "current link dotnet" /usr/local/dotnet/current/dotnet --info check "current link sdk" ls -l /usr/local/dotnet/current/sdk +./assert_run_project.sh + # Report result reportResults diff --git a/test/dotnet/install_non_root_remoteUser.sh b/test/dotnet/install_non_root_remoteUser.sh new file mode 100644 index 0000000..e9680cb --- /dev/null +++ b/test/dotnet/install_non_root_remoteUser.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +set -e + +# Optional: Import test library +source dev-container-features-test-lib + +check "ensure i am user codespace" bash -c "whoami | grep 'codespace'" + +./install_dotnet_7_jammy.sh + +# Report result +reportResults diff --git a/test/dotnet/install_wo_apt.sh b/test/dotnet/install_wo_apt.sh index a1745c5..6a8b9ce 100644 --- a/test/dotnet/install_wo_apt.sh +++ b/test/dotnet/install_wo_apt.sh @@ -13,5 +13,7 @@ check "dotnet version 7 installed" bash -c "ls -l /usr/local/dotnet | grep '7\. check "current link dotnet" /usr/local/dotnet/current/dotnet --info check "current link sdk" ls -l /usr/local/dotnet/current/sdk +./assert_run_project.sh + # Report result reportResults diff --git a/test/dotnet/scenarios.json b/test/dotnet/scenarios.json index 37f83d5..1b88819 100644 --- a/test/dotnet/scenarios.json +++ b/test/dotnet/scenarios.json @@ -72,5 +72,14 @@ "installUsingApt": false } } + }, + "install_non_root_remoteUser": { + "image": "mcr.microsoft.com/devcontainers/universal:2", + "remoteUser": "codespace", + "features": { + "dotnet": { + "version": "7" + } + } } }
\ No newline at end of file diff --git a/test/dotnet/test.sh b/test/dotnet/test.sh index 7eb0cf6..3befeec 100755 --- a/test/dotnet/test.sh +++ b/test/dotnet/test.sh @@ -17,5 +17,7 @@ check "some major version of dotnet 7 is installed" bash -c "dotnet --version | check "current link dotnet" /usr/local/dotnet/current/dotnet --info check "current link sdk" ls -l /usr/local/dotnet/current/sdk +./assert_run_project.sh + # Report result reportResults
\ No newline at end of file |