Updated
This commit is contained in:
parent
527ba10c1a
commit
40150215f2
|
@ -9,10 +9,10 @@
|
|||
|
||||
<ItemGroup>
|
||||
<Reference Include="EonaCat.Helpers">
|
||||
<HintPath>..\..\EonaCatHelpers\EonaCat.Helpers\bin\Release\net5.0\EonaCat.Helpers.dll</HintPath>
|
||||
<HintPath>..\..\EonaCat.Helpers\EonaCat.Helpers\bin\Release\net6.0\EonaCat.Helpers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EonaCat.HttpClient">
|
||||
<HintPath>..\..\EonaCatHttpClient\bin\Debug\EonaCat.HttpClient.dll</HintPath>
|
||||
<HintPath>..\..\EonaCat.HttpClient\EonaCat.HttpClient\bin\Debug\EonaCat.HttpClient.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
|
||||
using EonaCat.HttpClient;
|
||||
using EonaCat.HttpClient.Extensions;
|
||||
using System.Globalization;
|
||||
|
||||
namespace EonaCat.Testers.HttpClient
|
||||
{
|
||||
|
@ -11,16 +13,30 @@ namespace EonaCat.Testers.HttpClient
|
|||
{
|
||||
Console.WriteLine("Test");
|
||||
var httpClient = new EonaCat.HttpClient.HttpClient(Large_Json_file);
|
||||
httpClient.OnReadProgressChanged += HttpClient_OnReadProgressChanged;
|
||||
httpClient.OnWriteProgressChanged += HttpClient_OnWriteProgressChanged;
|
||||
var getRequest = httpClient.GetRequest();
|
||||
var response = await getRequest.ExecuteAsync<List<Large_Json>>().ConfigureAwait(false);
|
||||
Console.WriteLine($"We got {(response.HasResult ? response.Result.Count : 0)} results - elapsed: {response.Elapsed.Value}");
|
||||
|
||||
Console.WriteLine("Test2");
|
||||
var httpClient2 = new EonaCat.HttpClient.HttpClient("https://google.com");
|
||||
httpClient2.OnReadProgressChanged += HttpClient_OnReadProgressChanged;
|
||||
httpClient2.OnWriteProgressChanged += HttpClient_OnWriteProgressChanged;
|
||||
var getRequest2 = httpClient2.GetRequest();
|
||||
var response2 = await getRequest2.ExecuteAsHttpResponseMessageAsync().ConfigureAwait(false);
|
||||
Console.WriteLine($"We got {(response2.HasResult ? await response2.Result.Content.ReadAsStringAsync() : 0)} - elapsed: {response2.Elapsed.Value}");
|
||||
Console.WriteLine($"We got {(response2.HasResult ? await response2.Result.Content.ReadAsStringWithProgressAsync("test", (x) => { Console.WriteLine($"{x.PercentageAsString}%"); }) : 0)} - elapsed: {response2.Elapsed.Value}");
|
||||
|
||||
}
|
||||
|
||||
private static void HttpClient_OnWriteProgressChanged(object? sender, ProgressArgs e)
|
||||
{
|
||||
Console.WriteLine($"WRITE: {e.Identifier} : {e.PercentageAsString}");
|
||||
}
|
||||
|
||||
private static void HttpClient_OnReadProgressChanged(object? sender, ProgressArgs e)
|
||||
{
|
||||
Console.WriteLine($"READ: {e.Identifier} : {e.PercentageAsString}");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="EonaCatHelpers" Version="1.3.6" />
|
||||
<PackageReference Include="Microsoft.Data.SqlClient" Version="4.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\EonaCatMocker\EonaCat.Mocking.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="EonaCat.Helpers">
|
||||
<HintPath>..\..\EonaCatHelpers\EonaCat.Helpers\bin\Release\net6.0\EonaCat.Helpers.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,31 @@
|
|||
|
||||
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}") = "MockTester", "MockTester.csproj", "{D5E2E874-0FD2-4481-BE8C-517C382342AE}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EonaCat.Mocking", "..\..\EonaCatMocker\EonaCat.Mocking.csproj", "{2FB81818-47C1-47CE-931D-8DF6810CED50}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D5E2E874-0FD2-4481-BE8C-517C382342AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D5E2E874-0FD2-4481-BE8C-517C382342AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D5E2E874-0FD2-4481-BE8C-517C382342AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D5E2E874-0FD2-4481-BE8C-517C382342AE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2FB81818-47C1-47CE-931D-8DF6810CED50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2FB81818-47C1-47CE-931D-8DF6810CED50}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2FB81818-47C1-47CE-931D-8DF6810CED50}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2FB81818-47C1-47CE-931D-8DF6810CED50}.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; }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue