Added JsonTester
Added LicenserTester Added SqliteCacheTester Updated EnvTester Updated LoggerTester
This commit is contained in:
parent
d2ac9710f0
commit
b85fa5a6b9
|
@ -1,12 +1,20 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<EVDefaultVersion>999</EVDefaultVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="EonaCat.Versioning" Version="1.0.3">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="EonaCat.Env">
|
<Reference Include="EonaCat.Env">
|
||||||
<HintPath>..\..\..\EonaCat.Env\EonaCat.Env\bin\Debug\net6.0\EonaCat.Env.dll</HintPath>
|
<HintPath>..\..\..\EonaCat.Env\EonaCat.Env\bin\Debug\net6.0\EonaCat.Env.dll</HintPath>
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="EonaCat.Logger" Version="1.0.4" />
|
<PackageReference Include="EonaCat.Logger" Version="1.1.2" />
|
||||||
<PackageReference Include="EonaCat.Web.Tracer" Version="1.0.0" />
|
<PackageReference Include="EonaCat.Web.Tracer" Version="1.0.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
|
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
using EonaCat.Logger;
|
using EonaCat.Logger;
|
||||||
|
using EonaCat.Logger.EonaCatCoreLogger;
|
||||||
|
using EonaCat.Logger.EonaCatCoreLogger.Extensions;
|
||||||
using EonaCat.Logger.Extensions;
|
using EonaCat.Logger.Extensions;
|
||||||
using EonaCat.Logger.Managers;
|
using EonaCat.Logger.Managers;
|
||||||
using EonaCat.Web.RateLimiter;
|
using EonaCat.Web.RateLimiter;
|
||||||
|
@ -105,7 +107,7 @@ void RunLoggingExceptionTests()
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
logger.Write(exception);
|
logger.WriteAsync(exception);
|
||||||
Console.WriteLine($"Normal ExceptionLogged: {i}");
|
Console.WriteLine($"Normal ExceptionLogged: {i}");
|
||||||
}
|
}
|
||||||
Task.Delay(1);
|
Task.Delay(1);
|
||||||
|
@ -155,7 +157,7 @@ void RunLoggingTests()
|
||||||
|
|
||||||
for (int i = 0; i < 9000000; i++)
|
for (int i = 0; i < 9000000; i++)
|
||||||
{
|
{
|
||||||
logger.Write($"test to file {i}");
|
logger.WriteAsync($"test to file {i}");
|
||||||
Console.WriteLine($"Logged: {i}");
|
Console.WriteLine($"Logged: {i}");
|
||||||
Task.Delay(1);
|
Task.Delay(1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="EonaCat.HttpClient" Version="1.2.9" />
|
<PackageReference Include="EonaCat.HttpClient" Version="1.3.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>disable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="EonaCat.Json" Version="1.1.4" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
|
@ -0,0 +1,22 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.12.35728.132 d17.12
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JsonTester", "JsonTester.csproj", "{4893C0BA-F847-45BF-9035-0E01ED028FF7}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{4893C0BA-F847-45BF-9035-0E01ED028FF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{4893C0BA-F847-45BF-9035-0E01ED028FF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{4893C0BA-F847-45BF-9035-0E01ED028FF7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{4893C0BA-F847-45BF-9035-0E01ED028FF7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
|
@ -0,0 +1,15 @@
|
||||||
|
using EonaCat.Json;
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace EonaCat.Tester
|
||||||
|
{
|
||||||
|
public static class JsonTest
|
||||||
|
{
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
var test = JsonHelper.ToObject<dynamic>(File.ReadAllText("E:\\TestFiles\\large-file.json"));
|
||||||
|
Console.WriteLine(JsonHelper.ToJson(test));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>disable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="EonaCat.Licenser.Nuget" Version="1.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
|
@ -0,0 +1,25 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.0.32112.339
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LicenserTester", "LicenserTester.csproj", "{CBAAC232-26BD-4168-B621-322C806B343D}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{CBAAC232-26BD-4168-B621-322C806B343D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{CBAAC232-26BD-4168-B621-322C806B343D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{CBAAC232-26BD-4168-B621-322C806B343D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{CBAAC232-26BD-4168-B621-322C806B343D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {7E7E2E90-9289-4D68-A918-A465BE4315AF}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
|
@ -0,0 +1,26 @@
|
||||||
|
|
||||||
|
using EonaCat.Json;
|
||||||
|
using EonaCat.Mocking;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace EonaCat.Tester.Mocking
|
||||||
|
{
|
||||||
|
public static class MockTest
|
||||||
|
{
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
var user = new MockHelper().Generate<User>();
|
||||||
|
Console.WriteLine(JsonHelper.ToJson(user));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class User
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string FirstName { get; set; }
|
||||||
|
public string LastName { get; set; }
|
||||||
|
public DateTime BirthDate { get; set; }
|
||||||
|
public string CompanyName { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,6 +6,7 @@
|
||||||
<ImplicitUsings>disable</ImplicitUsings>
|
<ImplicitUsings>disable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||||
|
|
||||||
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
|
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
|
||||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||||
<PackageIcon>icon.png</PackageIcon>
|
<PackageIcon>icon.png</PackageIcon>
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.4.33110.190
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SqliteCacheTester", "SqliteCacheTester\SqliteCacheTester.csproj", "{013B9DD8-707B-40CE-8143-7649C9557128}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{013B9DD8-707B-40CE-8143-7649C9557128}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{013B9DD8-707B-40CE-8143-7649C9557128}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{013B9DD8-707B-40CE-8143-7649C9557128}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{013B9DD8-707B-40CE-8143-7649C9557128}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {FA1E89EA-0D00-4FBA-8AED-3F46FF0A692D}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
|
@ -0,0 +1,31 @@
|
||||||
|
using EonaCat.Cache.Sqlite;
|
||||||
|
|
||||||
|
namespace SqliteCacheTester
|
||||||
|
{
|
||||||
|
public static class DnsCache
|
||||||
|
{
|
||||||
|
private static SqliteCache _cache;
|
||||||
|
|
||||||
|
static DnsCache()
|
||||||
|
{
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Init()
|
||||||
|
{
|
||||||
|
_cache = new SqliteCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static T? GetCacheAsync<T>(string cacheKey)
|
||||||
|
{
|
||||||
|
var cached = _cache.HasKey(cacheKey) ? _cache.Get<T>($"{cacheKey}") : default;
|
||||||
|
return cached;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetCache<T>(string cacheKey,
|
||||||
|
T cachedObject)
|
||||||
|
{
|
||||||
|
_cache.Set(cacheKey, cachedObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
using SqliteCacheTester;
|
||||||
|
|
||||||
|
var hoi = new TEST();
|
||||||
|
hoi.Bar = "LOL";
|
||||||
|
DnsCache.SetCache("MY_KEY", hoi);
|
||||||
|
|
||||||
|
var test = DnsCache.GetCacheAsync<TEST>("MY_KEY");
|
||||||
|
Console.WriteLine(test);
|
||||||
|
public class TEST
|
||||||
|
{
|
||||||
|
public string Type { get; set; }
|
||||||
|
public string Test { get; set; }
|
||||||
|
public string Hello { get; set; }
|
||||||
|
public string Bar { get; set; }
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="EonaCat.Json" Version="1.0.3" />
|
||||||
|
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="7.0.9" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="7.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.1" />
|
||||||
|
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.1.5" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="EonaCat.Cache.Sqlite">
|
||||||
|
<HintPath>..\..\..\EonaCat.Cache.Sqlite\EonaCat.Cache.Sqlite\bin\Debug\net7.0\EonaCat.Cache.Sqlite.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
Loading…
Reference in New Issue