Updated
This commit is contained in:
parent
3b3670af19
commit
527ba10c1a
|
@ -8,7 +8,12 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="EonaCat.HttpClient" Version="1.1.2" />
|
||||
<Reference Include="EonaCat.Helpers">
|
||||
<HintPath>..\..\EonaCatHelpers\EonaCat.Helpers\bin\Release\net5.0\EonaCat.Helpers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EonaCat.HttpClient">
|
||||
<HintPath>..\..\EonaCatHttpClient\bin\Debug\EonaCat.HttpClient.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
namespace EonaCat.Testers.HttpClient
|
||||
{
|
||||
public class Actor
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string login { get; set; }
|
||||
public string gravatar_id { get; set; }
|
||||
public string url { get; set; }
|
||||
public string avatar_url { get; set; }
|
||||
}
|
||||
|
||||
public class Repo
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string url { get; set; }
|
||||
}
|
||||
|
||||
public class Payload
|
||||
{
|
||||
public string @ref { get; set; }
|
||||
public string ref_type { get; set; }
|
||||
public string master_branch { get; set; }
|
||||
public string description { get; set; }
|
||||
public string pusher_type { get; set; }
|
||||
}
|
||||
|
||||
public class Large_Json
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string type { get; set; }
|
||||
public Actor actor { get; set; }
|
||||
public Repo repo { get; set; }
|
||||
public Payload payload { get; set; }
|
||||
public bool @public { get; set; }
|
||||
public DateTime created_at { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,13 +1,26 @@
|
|||
|
||||
using EonaCat.HttpClient;
|
||||
|
||||
namespace EonaCat.Testers.HttpClient
|
||||
{
|
||||
public static class HttpClientTest
|
||||
{
|
||||
public static void Main()
|
||||
private const string Large_Json_file = "https://raw.githubusercontent.com/json-iterator/test-data/master/large-file.json";
|
||||
|
||||
public static async Task Main()
|
||||
{
|
||||
Console.WriteLine("Test");
|
||||
var httpClient = new EonaCat.HttpClient.HttpClient("test");
|
||||
httpClient.
|
||||
var httpClient = new EonaCat.HttpClient.HttpClient(Large_Json_file);
|
||||
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");
|
||||
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}");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -32,13 +32,14 @@ namespace Webtester.Pages
|
|||
Console.WriteLine("Testing for injections:");
|
||||
getDone = true;
|
||||
}
|
||||
|
||||
TestInjection(test);
|
||||
}
|
||||
|
||||
private void TestInjection(string text)
|
||||
{
|
||||
var result = SqlHelper.ExecuteQuery(
|
||||
new Microsoft.Data.SqlClient.SqlConnection(@"Server=localhost;Database=NorthWind;User Id=sa;Password=jeroen;TrustServerCertificate=Yes;"),
|
||||
var connectionString = @"Server=localhost;Database=NorthWind;User Id=sa;Password=jeroen;TrustServerCertificate=Yes;";
|
||||
var result = SqlHelper.ExecuteQuery(connectionString,
|
||||
$"SELECT * FROM Customers WHERE Country = @0", true, text);
|
||||
|
||||
if (!result.HasResult)
|
||||
|
@ -76,8 +77,8 @@ namespace Webtester.Pages
|
|||
private static async void TestsqlServer()
|
||||
{
|
||||
var customerId = "AROUT";
|
||||
var result = SqlHelper.ExecuteQuery(
|
||||
new Microsoft.Data.SqlClient.SqlConnection(@"Server=localhost;Database=NorthWind;User Id=sa;Password=jeroen;TrustServerCertificate=Yes;"),
|
||||
var connectionString = @"Server=localhost;Database=NorthWind;User Id=sa;Password=jeroen;TrustServerCertificate=Yes;";
|
||||
var result = SqlHelper.ExecuteQuery(connectionString,
|
||||
$"SELECT * FROM Customers WHERE CustomerID = @0 AND Country = @1"
|
||||
, true, customerId, "UK");
|
||||
|
||||
|
|
Loading…
Reference in New Issue