Update to latest code and nugets packages
This commit is contained in:
@@ -41,9 +41,10 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="GerstITS.Common" />
|
||||
<PackageReference Include="GerstITS.System" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" />
|
||||
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -12,6 +12,7 @@ public class Module : IIoCModule<IServiceCollection>
|
||||
|
||||
public void RegisterComponents(IServiceCollection container)
|
||||
{
|
||||
container.AddTransient<IApplicationStart, CommonFeaturesRunner>();
|
||||
container.AddTransient<IApplicationStart, TestRunner>();
|
||||
|
||||
container.AddTransient<IConfiguration>(c => new ConfigurationBuilder().SetBasePath(AppDomain.CurrentDomain.BaseDirectory)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using GerstITS.Examples.WebClients.Examples.Api;
|
||||
using GerstITS.Examples.WebClients.Examples.Api;
|
||||
using GerstITS.IoC.DotNetCore;
|
||||
using GerstITS.Web.WebClients;
|
||||
|
||||
@@ -12,37 +12,55 @@ internal sealed class TestRunner : IApplicationStart
|
||||
|
||||
#endregion
|
||||
|
||||
#region Construtors
|
||||
#region Constructors
|
||||
|
||||
public TestRunner(IWebClient webClient)
|
||||
{
|
||||
_webClient = webClient;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ITestRunner
|
||||
#region IApplicationStart
|
||||
|
||||
public void Run()
|
||||
{
|
||||
var result1 = _webClient.Request<ICountry>()
|
||||
.Execute(c => c.Search(new SearchCriteria
|
||||
{ SortBy = nameof(Country.Name), SortDirection = SortingDirections.Descending, Skip = 5, Take = 5}));
|
||||
var created = _webClient.Request<ICustomer>()
|
||||
.Execute(c => c.Create(new Customer
|
||||
{ FirstName = "Erika", LastName = $"Mustermann-{Guid.NewGuid():N}", EMail = "erika.mustermann@example.com" }));
|
||||
|
||||
var result2 = _webClient.Request<ICountry>()
|
||||
.Execute(c => c.Get(result1.Value.Result.First().Id));
|
||||
var loaded = _webClient.Request<ICustomer>()
|
||||
.Execute(c => c.Get(created.Value.Id));
|
||||
|
||||
var test3 = _webClient.Request<ICountry>()
|
||||
.Execute(c => c.Create(new Country {Name = $"Country-{Guid.NewGuid()}"}));
|
||||
var searched = _webClient.Request<ICustomer>()
|
||||
.Execute(c => c.Search(new CustomerSearchCriteria
|
||||
{ Name = "Mustermann", SortBy = nameof(Customer.LastName), SortDirection = SortingDirections.Descending, Skip = 0, Take = 5 }));
|
||||
|
||||
test3.Value.Name += "_Renamed";
|
||||
loaded.Value.FirstName = "Max";
|
||||
|
||||
var test4 = _webClient.Request<ICountry>()
|
||||
.Execute(c => c.Update(test3.Value));
|
||||
var updated = _webClient.Request<ICustomer>()
|
||||
.Execute(c => c.Update(loaded.Value));
|
||||
|
||||
var note = _webClient.Request<ICustomer>()
|
||||
.Execute(c => c.AddNote(updated.Value.Id, new CustomerNote { Text = "Created by the example web client." }));
|
||||
|
||||
var notes = _webClient.Request<ICustomer>()
|
||||
.Execute(c => c.GetNotes(updated.Value.Id));
|
||||
|
||||
var deleted = _webClient.Request<ICustomer>()
|
||||
.Execute(c => c.Delete(updated.Value.Id));
|
||||
|
||||
Print($"---> {nameof(TestRunner)}: Found {searched.Value.TotalCount} customer(s), added {notes.Value.Count()} note(s), deleted: {deleted.Value}");
|
||||
}
|
||||
|
||||
var test5 = _webClient.Request<ICountry>()
|
||||
.Execute(c => c.Delete(test3.Value.Id));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region Methods
|
||||
|
||||
private static void Print(string message)
|
||||
{
|
||||
global::System.Console.WriteLine(message);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"ExampleApiClient": {
|
||||
"BaseUrl": "https://localhost:44350/api/v1.1/"
|
||||
"BaseUrl": "https://localhost:44350/api/"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user