Use file scoped namepace
This commit is contained in:
@@ -5,21 +5,20 @@ using GerstITS.IoC.DotNetCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace GerstITS.Examples.WebClient.Console
|
||||
namespace GerstITS.Examples.WebClient.Console;
|
||||
|
||||
public class Module : IIoCModule<IServiceCollection>
|
||||
{
|
||||
public class Module : IIoCModule<IServiceCollection>
|
||||
#region IIoCModule
|
||||
|
||||
public void RegisterComponents(IServiceCollection container)
|
||||
{
|
||||
#region IIoCModule
|
||||
container.AddTransient<IApplicationStart, TestRunner>();
|
||||
|
||||
public void RegisterComponents(IServiceCollection container)
|
||||
{
|
||||
container.AddTransient<IApplicationStart, TestRunner>();
|
||||
|
||||
container.AddTransient<IConfiguration>(c => new ConfigurationBuilder().SetBasePath(AppDomain.CurrentDomain.BaseDirectory)
|
||||
.AddJsonFile("appsettings.json", false, true)
|
||||
.Build());
|
||||
}
|
||||
|
||||
#endregion
|
||||
container.AddTransient<IConfiguration>(c => new ConfigurationBuilder().SetBasePath(AppDomain.CurrentDomain.BaseDirectory)
|
||||
.AddJsonFile("appsettings.json", false, true)
|
||||
.Build());
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,31 +1,30 @@
|
||||
using GerstITS.IoC.DotNetCore;
|
||||
|
||||
namespace GerstITS.Examples.WebClient.Console
|
||||
namespace GerstITS.Examples.WebClient.Console;
|
||||
|
||||
internal class Program
|
||||
{
|
||||
internal class Program
|
||||
#region Fields
|
||||
|
||||
private static readonly DotNetCoreApplicationBootstrapper _bootstrapper;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
static Program()
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private static readonly DotNetCoreApplicationBootstrapper _bootstrapper;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
static Program()
|
||||
{
|
||||
_bootstrapper = new DotNetCoreApplicationBootstrapper();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
_bootstrapper.Run();
|
||||
}
|
||||
|
||||
#endregion
|
||||
_bootstrapper = new DotNetCoreApplicationBootstrapper();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
_bootstrapper.Run();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -4,48 +4,47 @@ using GerstITS.Examples.WebClients.Examples.Api;
|
||||
using GerstITS.IoC.DotNetCore;
|
||||
using GerstITS.Web.WebClients;
|
||||
|
||||
namespace GerstITS.Examples.WebClient.Console.Tests
|
||||
namespace GerstITS.Examples.WebClient.Console.Tests;
|
||||
|
||||
internal sealed class TestRunner : IApplicationStart
|
||||
{
|
||||
internal sealed class TestRunner : IApplicationStart
|
||||
#region Fields
|
||||
|
||||
private readonly IWebClient _webClient;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Construtors
|
||||
|
||||
public TestRunner(IWebClient webClient)
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private readonly IWebClient _webClient;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Construtors
|
||||
|
||||
public TestRunner(IWebClient webClient)
|
||||
{
|
||||
_webClient = webClient;
|
||||
}
|
||||
_webClient = webClient;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region ITestRunner
|
||||
#region ITestRunner
|
||||
|
||||
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}));
|
||||
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 result2 = _webClient.Request<ICountry>()
|
||||
.Execute(c => c.Get(result1.Value.Result.First().Id));
|
||||
var result2 = _webClient.Request<ICountry>()
|
||||
.Execute(c => c.Get(result1.Value.Result.First().Id));
|
||||
|
||||
var test3 = _webClient.Request<ICountry>()
|
||||
.Execute(c => c.Create(new Country {Name = $"Country-{Guid.NewGuid()}"}));
|
||||
var test3 = _webClient.Request<ICountry>()
|
||||
.Execute(c => c.Create(new Country {Name = $"Country-{Guid.NewGuid()}"}));
|
||||
|
||||
test3.Value.Name += "_Renamed";
|
||||
test3.Value.Name += "_Renamed";
|
||||
|
||||
var test4 = _webClient.Request<ICountry>()
|
||||
.Execute(c => c.Update(test3.Value));
|
||||
var test4 = _webClient.Request<ICountry>()
|
||||
.Execute(c => c.Update(test3.Value));
|
||||
|
||||
var test5 = _webClient.Request<ICountry>()
|
||||
.Execute(c => c.Delete(test3.Value.Id));
|
||||
}
|
||||
var test5 = _webClient.Request<ICountry>()
|
||||
.Execute(c => c.Delete(test3.Value.Id));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
Reference in New Issue
Block a user