aboutsummaryrefslogtreecommitdiff
path: root/test/dotnet/test.sh
diff options
context:
space:
mode:
Diffstat (limited to 'test/dotnet/test.sh')
-rw-r--r--[-rwxr-xr-x]test/dotnet/test.sh31
1 files changed, 20 insertions, 11 deletions
diff --git a/test/dotnet/test.sh b/test/dotnet/test.sh
index f433654..7418892 100755..100644
--- a/test/dotnet/test.sh
+++ b/test/dotnet/test.sh
@@ -2,20 +2,29 @@
set -e
-# Optional: Import test library
+# 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
-# Definition specific tests
-check "dotnet" dotnet --info
-check "sdks" dotnet --list-sdks
-check "version" dotnet --version
+# 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
-echo "Validating expected version present..."
-check "some major version of dotnet (7/8) is installed" bash -c "dotnet --version | grep '[7-8]\.[0-9]*\.[0-9]*'"
+expected=$(fetch_latest_version)
-# Verify current symlink exists and works
-check "current link dotnet" /usr/local/dotnet/current/dotnet --info
-check "current link sdk" ls -l /usr/local/dotnet/current/sdk
+check "Latest .NET SDK version installed" \
+is_dotnet_sdk_version_installed "$expected"
-# Report result
+# Expect this check to fail in November 2023 when .NET 8.0 becomes GA
+check "It is a flavor of .NET 7.0" \
+is_dotnet_sdk_version_installed "7.0"
+
+check "Build and run example project" \
+dotnet run --project projects/net7.0
+
+# Report results
+# If any of the checks above exited with a non-zero exit code, the test will fail.
reportResults \ No newline at end of file