mirror of
https://github.com/nilaoda/N_m3u8DL-RE.git
synced 2026-04-02 02:28:24 +00:00
增加单元测试框架 (#726)
This commit is contained in:
20
src/N_m3u8DL-RE.Tests/Common/Util/HexUtilTests.cs
Normal file
20
src/N_m3u8DL-RE.Tests/Common/Util/HexUtilTests.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using N_m3u8DL_RE.Common.Util;
|
||||
|
||||
namespace N_m3u8DL_RE.Tests.Common.Util;
|
||||
|
||||
public class HexUtilTests
|
||||
{
|
||||
[Fact]
|
||||
public void BytesToHex_MultipleBytesWithDefaultSplit_ReturnsHexChars()
|
||||
{
|
||||
var result = HexUtil.BytesToHex([0xAB, 0xCD, 0xEF]);
|
||||
Assert.Equal("ABCDEF", result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BytesToHex_MultipleBytesWithCustomSplit_ReturnsHexChars()
|
||||
{
|
||||
var result = HexUtil.BytesToHex([0xAA, 0xBB, 0xCC], ":");
|
||||
Assert.Equal("AA:BB:CC", result);
|
||||
}
|
||||
}
|
||||
28
src/N_m3u8DL-RE.Tests/N_m3u8DL-RE.Tests.csproj
Normal file
28
src/N_m3u8DL-RE.Tests/N_m3u8DL-RE.Tests.csproj
Normal file
@@ -0,0 +1,28 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>N_m3u8DL_RE.Tests</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
<IsTestProject>true</IsTestProject>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.0"/>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
|
||||
<PackageReference Include="xunit" Version="2.5.3"/>
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="Xunit"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\N_m3u8DL-RE.Common\N_m3u8DL-RE.Common.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "N_m3u8DL-RE.Common", "N_m3u
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "N_m3u8DL-RE.Parser", "N_m3u8DL-RE.Parser\N_m3u8DL-RE.Parser.csproj", "{0DA02925-AF3A-4598-AF01-91AE5539FCA1}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "N_m3u8DL-RE.Tests", "N_m3u8DL-RE.Tests\N_m3u8DL-RE.Tests.csproj", "{CF51B8FF-E4EF-49D6-8595-AFAFD96D9253}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -27,6 +29,10 @@ Global
|
||||
{0DA02925-AF3A-4598-AF01-91AE5539FCA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0DA02925-AF3A-4598-AF01-91AE5539FCA1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0DA02925-AF3A-4598-AF01-91AE5539FCA1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CF51B8FF-E4EF-49D6-8595-AFAFD96D9253}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CF51B8FF-E4EF-49D6-8595-AFAFD96D9253}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CF51B8FF-E4EF-49D6-8595-AFAFD96D9253}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CF51B8FF-E4EF-49D6-8595-AFAFD96D9253}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
Reference in New Issue
Block a user