-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
841da6a
commit 4adfb28
Showing
6 changed files
with
139 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/CSharp/EasyMicroservices.TemplateGeneratorMicroservice.Tests/Fixtures/TestFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using EasyMicroservices.Cores.AspEntityFrameworkCoreApi; | ||
using EasyMicroservices.Cores.AspEntityFrameworkCoreApi.Interfaces; | ||
using EasyMicroservices.IdentityMicroservice.BackgroundServices; | ||
using EasyMicroservices.IdentityMicroservice.Database.Contexts; | ||
using EasyMicroservices.IdentityMicroservice.Interfaces; | ||
using EasyMicroservices.IdentityMicroservice.WebApi.Controllers; | ||
using EasyMicroservices.TemplateGeneratorMicroservice.Database.Contexts; | ||
using EasyMicroservices.TemplateGeneratorMicroservice.DatabaseLogics; | ||
using EasyMicroservices.TemplateGeneratorMicroservice.Helpers; | ||
using EasyMicroservices.TemplateGeneratorMicroservice.WebApi; | ||
using EasyMicroservices.TemplateGeneratorMicroservice.WebApi.Controllers; | ||
using Identity.GeneratedServices; | ||
using Microsoft.AspNetCore.Builder; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using TemplateGenerators.GeneratedServices; | ||
using Xunit; | ||
|
||
namespace EasyMicroservices.TemplateGeneratorMicroservice.Tests.Fixtures; | ||
public class TestFixture : IAsyncLifetime | ||
{ | ||
public IServiceProvider ServiceProvider { get; private set; } | ||
public Task DisposeAsync() | ||
{ | ||
return Task.CompletedTask; | ||
} | ||
|
||
public async Task InitializeAsync() | ||
{ | ||
var app = Program.CreateBuilder(null); | ||
UnitOfWork.MapperTypeAssembly = typeof(ItemTypeDatabaseLogic); | ||
string authBaseUrl = $"http://localhost:{2007}"; | ||
string generatorBaseUrl = $"http://localhost:{1050}"; | ||
app.Services.AddSingleton(s => new HttpClient()); | ||
app.Services.AddTransient(s => new AuthenticationClient(authBaseUrl, s.GetService<HttpClient>())); | ||
app.Services.AddTransient(s => new NoParentFormItemClient(generatorBaseUrl, s.GetService<HttpClient>())); | ||
app.Services.AddMvc().AddApplicationPart(typeof(FormController).Assembly); | ||
|
||
var build = await app.BuildWithUseCors<TemplateGeneratorContext>(default, true); | ||
build.MapControllers(); | ||
var scope = build.Services.CreateScope(); | ||
ApplicationManager.Instance.DependencyManager = scope.ServiceProvider.GetService<IUnitOfWork>(); | ||
ServiceProvider = app.Services.BuildServiceProvider(); | ||
_ = build.RunAsync(); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
src/CSharp/EasyMicroservices.TemplateGeneratorMicroservice.Tests/appsettings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning" | ||
} | ||
}, | ||
"AllowedHosts": "*", | ||
"Databases": [ | ||
{ | ||
"Name": "Entity", | ||
"ProviderName": "InMemory", | ||
"ConnectionString": "Server=.;Database=TemplateGenerator;Integrated Security=True;Trusted_Connection=True;TrustServerCertificate=True" | ||
} | ||
], | ||
"ServiceAddresses": [ | ||
{ | ||
"Name": "Authentication", | ||
"Address": "http://localhost:1044", | ||
"Databases": null | ||
}, | ||
{ | ||
"Name": "WhiteLabel", | ||
"Address": "http://localhost:1041", | ||
"Databases": null | ||
}, | ||
{ | ||
"Name": "Content", | ||
"Address": "http://localhost:2003", | ||
"Databases": null | ||
} | ||
], | ||
"Authorization": { | ||
"IsUse": true, | ||
"JWT": { | ||
"Key": "VGhpc0lzGHGHGHlY3JldEtleUZvckp3dEF1dGhlbnRpY2F0aW9u=", | ||
"Issuer": "https://github.com/easymicroservices", | ||
"Audience": "easymicroservices", | ||
|
||
"TokenExpireTimeInSeconds": 86400 | ||
}, | ||
"FullAccessPAT": "ownerpat" | ||
}, | ||
"Swagger": { | ||
"IsUse": true, | ||
"SwaggerUI": { | ||
"Endpoints": [] | ||
} | ||
}, | ||
|
||
"HasSSL": false, | ||
"Urls": "http://*:1050" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters