Update project name and namespaces

This commit is contained in:
ahjephson
2024-10-22 09:57:50 +01:00
parent e83488326b
commit 170b2ca601
226 changed files with 2776 additions and 848 deletions

View File

@@ -0,0 +1,3 @@
namespace Lantean.QBTMud.Test
{
}

View 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>

View File

@@ -0,0 +1,6 @@
namespace Lantean.QBTMud.Test
{
internal class Tests
{
}
}

View 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; }
}
}