Remove Program
This commit is contained in:
parent
c59e66861f
commit
d96e4db08c
@ -18,4 +18,8 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\Services.Common\Services.Common.csproj" />
|
<ProjectReference Include="..\..\Services.Common\Services.Common.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<InternalsVisibleTo Include="Basket.FunctionalTests" />
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -71,7 +71,7 @@ public class BasketController : ControllerBase
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "ERROR Publishing integration event: {IntegrationEventId} from {AppName}", eventMessage.Id, Program.AppName);
|
_logger.LogError(ex, "ERROR Publishing integration event: {IntegrationEventId}", eventMessage.Id);
|
||||||
|
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,9 @@ public class OrderStartedIntegrationEventHandler : IIntegrationEventHandler<Orde
|
|||||||
|
|
||||||
public async Task Handle(OrderStartedIntegrationEvent @event)
|
public async Task Handle(OrderStartedIntegrationEvent @event)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}"))
|
||||||
{
|
{
|
||||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||||
|
|
||||||
await _repository.DeleteBasketAsync(@event.UserId.ToString());
|
await _repository.DeleteBasketAsync(@event.UserId.ToString());
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,9 @@ public class ProductPriceChangedIntegrationEventHandler : IIntegrationEventHandl
|
|||||||
|
|
||||||
public async Task Handle(ProductPriceChangedIntegrationEvent @event)
|
public async Task Handle(ProductPriceChangedIntegrationEvent @event)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}"))
|
||||||
{
|
{
|
||||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, @event);
|
||||||
|
|
||||||
var userIds = _repository.GetUsers();
|
var userIds = _repository.GetUsers();
|
||||||
|
|
||||||
|
@ -63,12 +63,6 @@ try
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
app.Logger.LogCritical(ex, "Program terminated unexpectedly ({ApplicationContext})!", AppName);
|
app.Logger.LogCritical(ex, "Program terminated unexpectedly");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public partial class Program
|
|
||||||
{
|
|
||||||
private static string Namespace = typeof(Program).Assembly.GetName().Name;
|
|
||||||
public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.', Namespace.LastIndexOf('.') - 1) + 1);
|
|
||||||
}
|
|
||||||
|
@ -3,13 +3,14 @@ using Microsoft.Extensions.Hosting;
|
|||||||
|
|
||||||
namespace Basket.FunctionalTests.Base;
|
namespace Basket.FunctionalTests.Base;
|
||||||
|
|
||||||
public class BasketScenarioBase : WebApplicationFactory<Program>
|
public class BasketScenarioBase
|
||||||
{
|
{
|
||||||
private const string ApiUrlBase = "api/v1/basket";
|
private const string ApiUrlBase = "api/v1/basket";
|
||||||
|
|
||||||
public TestServer CreateServer()
|
public TestServer CreateServer()
|
||||||
{
|
{
|
||||||
return Server;
|
var factory = new BasketApplicaton();
|
||||||
|
return factory.Server;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Get
|
public static class Get
|
||||||
@ -26,6 +27,8 @@ public class BasketScenarioBase : WebApplicationFactory<Program>
|
|||||||
public static string CheckoutOrder = $"{ApiUrlBase}/checkout";
|
public static string CheckoutOrder = $"{ApiUrlBase}/checkout";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class BasketApplicaton : WebApplicationFactory<Program>
|
||||||
|
{
|
||||||
protected override IHost CreateHost(IHostBuilder builder)
|
protected override IHost CreateHost(IHostBuilder builder)
|
||||||
{
|
{
|
||||||
builder.ConfigureServices(services =>
|
builder.ConfigureServices(services =>
|
||||||
@ -56,3 +59,4 @@ public class BasketScenarioBase : WebApplicationFactory<Program>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -9,7 +9,8 @@ namespace Basket.FunctionalTests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task UpdateBasket_return_and_add_basket()
|
public async Task UpdateBasket_return_and_add_basket()
|
||||||
{
|
{
|
||||||
var redis = Services.GetRequiredService<ConnectionMultiplexer>();
|
var server = CreateServer();
|
||||||
|
var redis = server.Services.GetRequiredService<ConnectionMultiplexer>();
|
||||||
|
|
||||||
var redisBasketRepository = BuildBasketRepository(redis);
|
var redisBasketRepository = BuildBasketRepository(redis);
|
||||||
|
|
||||||
@ -26,7 +27,8 @@ namespace Basket.FunctionalTests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Delete_Basket_return_null()
|
public async Task Delete_Basket_return_null()
|
||||||
{
|
{
|
||||||
var redis = Services.GetRequiredService<ConnectionMultiplexer>();
|
var server = CreateServer();
|
||||||
|
var redis = server.Services.GetRequiredService<ConnectionMultiplexer>();
|
||||||
|
|
||||||
var redisBasketRepository = BuildBasketRepository(redis);
|
var redisBasketRepository = BuildBasketRepository(redis);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user