Files
utilcore 139753da4b 1. 表格单元格<util-td> 添加 tooltip 相关属性.
2. 新增Spa管道中间件,由于微软已放弃维护, 故从 Microsoft.AspNetCore.SpaServices 复制源码进行修改.
3. IAppBuilder 扩展方法 AddNgZorro ,新增 EnableWatchRazor 选项, 用于启用Razor监视服务 ,并默认开启.
4. WebApplication 扩展方法 UseNgZorro , 新增 isAutoStartAngularServer 参数,用于自动启动Angular服务器, 并默认开启.
5. 修复描述列表项 <util-descriptions-item> 显示数值类型不正确的bug.
6. 修复具有嵌套列的情况下表格设置加载列不正确的bug.
2024-03-28 17:03:12 +08:00

84 lines
2.3 KiB
C#

using Util.Helpers;
using Xunit;
namespace Util.Tests.Helpers;
/// <summary>
/// Url测试
/// </summary>
public class UrlTest {
/// <summary>
/// 测试连接路径
/// </summary>
[Theory]
[InlineData( null, null, "" )]
[InlineData( "", "", "" )]
[InlineData( "a", "", "a" )]
[InlineData( "", "a", "a" )]
[InlineData( "a", "b", "a/b" )]
[InlineData( "a/", "b", "a/b" )]
[InlineData( "a", "/b", "a/b" )]
[InlineData( "a", "\\b", "a/b" )]
[InlineData( "/a", "b", "/a/b" )]
[InlineData( "a", "b/", "a/b/" )]
[InlineData( "/a/", "/b/", "/a/b/" )]
public void TestJoinPath( string path1, string path2, string result ) {
Assert.Equal( result, Url.JoinPath( path1, path2 ) );
}
/// <summary>
/// 测试连接路径 - 上级路径带./
/// </summary>
[Fact]
public void TestJoinPath_2() {
Assert.Equal( "a/b", Url.JoinPath( "./a", "b" ) );
}
/// <summary>
/// 测试连接路径 - 下级路径带./
/// </summary>
[Fact]
public void TestJoinPath_3() {
Assert.Equal( "a/b", Url.JoinPath( "a", "./b" ) );
}
/// <summary>
/// 测试连接路径 - 下级路径带../
/// </summary>
[Fact]
public void TestJoinPath_4() {
Assert.Equal( "a/c", Url.JoinPath( "a/b", "../c" ) );
}
/// <summary>
/// 测试连接路径 - http打头
/// </summary>
[Fact]
public void TestJoinPath_5() {
Assert.Equal( "http://a.com/a/c", Url.JoinPath( "http://a.com", "a/b", "../c" ) );
}
/// <summary>
/// 测试连接路径 - https打头
/// </summary>
[Fact]
public void TestJoinPath_6() {
Assert.Equal( "https://a.com/a/c", Url.JoinPath( "https://a.com/", "a/b/", "../c" ) );
}
/// <summary>
/// 测试连接路径 - https打头,带..路径
/// </summary>
[Fact]
public void TestJoinPath_7() {
Assert.Equal( "https://a.com/a/c/D/F/g", Url.JoinPath( "Https://a.com/a/b/", "../c/D/e/", "../F/g" ) );
}
/// <summary>
/// 测试连接路径 - https打头,带..路径
/// </summary>
[Fact]
public void TestJoinPath_8() {
Assert.Equal( "https://a.com/view/a", Url.JoinPath( "https://a.com", "view", "a" ) );
}
}