mirror of
https://github.com/lantean-code/qbtmud.git
synced 2025-10-22 20:42:24 +00:00
Update project name and namespaces
This commit is contained in:
3
Lantean.QBTMud.Test/ContentItemSizeComparer.cs
Normal file
3
Lantean.QBTMud.Test/ContentItemSizeComparer.cs
Normal file
@@ -0,0 +1,3 @@
|
||||
namespace Lantean.QBTMud.Test
|
||||
{
|
||||
}
|
||||
33
Lantean.QBTMud.Test/Lantean.QBTMud.Test.csproj
Normal file
33
Lantean.QBTMud.Test/Lantean.QBTMud.Test.csproj
Normal file
@@ -0,0 +1,33 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
<IsTestProject>true</IsTestProject>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FluentAssertions" Version="6.12.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
|
||||
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
|
||||
<PackageReference Include="xunit" Version="2.9.2" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Lantean.QBitTorrentClient\Lantean.QBitTorrentClient.csproj" />
|
||||
<ProjectReference Include="..\Lantean.QBTMud\Lantean.QBTMud.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="Xunit" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
6
Lantean.QBTMud.Test/Tests.cs
Normal file
6
Lantean.QBTMud.Test/Tests.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Lantean.QBTMud.Test
|
||||
{
|
||||
internal class Tests
|
||||
{
|
||||
}
|
||||
}
|
||||
67
Lantean.QBTMud.Test/UnitTest1.cs
Normal file
67
Lantean.QBTMud.Test/UnitTest1.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using Lantean.QBitTorrentClient;
|
||||
using Lantean.QBitTorrentClient.Models;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text.Json;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace Lantean.QBTMud.Test
|
||||
{
|
||||
public class UnitTest1
|
||||
{
|
||||
private readonly ITestOutputHelper _testOutputHelper;
|
||||
|
||||
public UnitTest1(ITestOutputHelper testOutputHelper)
|
||||
{
|
||||
_testOutputHelper = testOutputHelper;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Test()
|
||||
{
|
||||
Test2(a => a.Name);
|
||||
}
|
||||
|
||||
private void Test2(Expression<Func<TestClass, object>> expr)
|
||||
{
|
||||
var body = expr.Body;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Create()
|
||||
{
|
||||
var propInfo = typeof(TestClass).GetProperty("Name")!;
|
||||
|
||||
ParameterExpression expression = Expression.Parameter(typeof(TestClass), "a");
|
||||
var propertyExpression = Expression.Property(expression, "Value");
|
||||
|
||||
var convertExpression = Expression.Convert(propertyExpression, typeof(object));
|
||||
|
||||
var l = Expression.Lambda<Func<TestClass, object>>(convertExpression, expression);
|
||||
|
||||
Expression<Func<TestClass, object>> expr2 = a => a.Name;
|
||||
|
||||
var x = l.Compile();
|
||||
var res = (long)x(new TestClass { Name = "Name", Value = 12 });
|
||||
Assert.Equal(12, res);
|
||||
expr2.Compile();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ScanDir()
|
||||
{
|
||||
//Dictionary<string, string>
|
||||
var json = "{\r\n\t\"/this/is/path\": 1,\r\n\t\"/this/other\": 0,\r\n\t\"/home\": \"/path\"\r\n}";
|
||||
|
||||
var obj = JsonSerializer.Deserialize<Dictionary<string, SaveLocation>>(json, SerializerOptions.Options);
|
||||
}
|
||||
}
|
||||
|
||||
public class TestClass
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Description { get; set; }
|
||||
|
||||
public long Value { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user