From dc11f0b5adde3acb7f07375114466ba7b455e7d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Thu, 6 Mar 2025 22:23:18 +0100 Subject: [PATCH] Add test that AppContext.BaseDirectory is rooted --- .../System/AppContext/AppContextTests.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/AppContext/AppContextTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/AppContext/AppContextTests.cs index 9b47feed876c80..6cf9ce9ac7f995 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/AppContext/AppContextTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/AppContext/AppContextTests.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.IO; using Xunit; namespace System.Tests @@ -28,5 +29,11 @@ public void AppContext_ThrowTest() { AssertExtensions.Throws("name", () => AppContext.SetData(null, 123)); } + + [Fact] + public void BaseDirectory_PathRooted() + { + Assert.True(Path.IsPathRooted(AppContext.BaseDirectory), "BaseDirectory should be a rooted path"); + } } }