using Xunit; namespace Util.Tests.Helpers; /// /// 平台操作测试 /// public class PlatformTest { /// /// 测试获取物理路径 /// [Fact] public void TestGetPhysicalPath_1() { var path = Util.Helpers.Common.GetPhysicalPath( "a/b.txt" ); var result = $"{System.AppContext.BaseDirectory}a/b.txt"; Assert.Equal( result,path ); } /// /// 测试获取物理路径 - 以/开头 /// [Fact] public void TestGetPhysicalPath_2() { var path = Util.Helpers.Common.GetPhysicalPath( "/a/b.txt" ); var result = $"{System.AppContext.BaseDirectory}a/b.txt"; Assert.Equal( result, path ); } /// /// 测试获取物理路径 - 以\开头 /// [Fact] public void TestGetPhysicalPath_3() { var path = Util.Helpers.Common.GetPhysicalPath( "\\a\\b.txt" ); var result = $"{System.AppContext.BaseDirectory}a\\b.txt"; Assert.Equal( result, path ); } /// /// 测试获取物理路径 /// [Fact] public void TestGetPhysicalPath_4() { var path = Util.Helpers.Common.GetPhysicalPath( "~/a/b.txt" ); var result = $"{System.AppContext.BaseDirectory}a/b.txt"; Assert.Equal( result, path ); } }