From eaf0c92c21414adc9f40a5facc5729d5b3aa2a78 Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Tue, 30 Jun 2020 12:02:33 +0100 Subject: [PATCH 1/3] Upgraded Messaging to latest ES --- ...essagingService.BusinessLogic.Tests.csproj | 8 +- .../Services/EmailDomainServiceTests.cs | 5 +- .../MessagingService.BusinessLogic.csproj | 4 +- .../Services/EmailDomainService.cs | 53 +++++++-- ...ssagingService.EmailAggregate.Tests.csproj | 8 +- ...ngService.EmailMessage.DomainEvents.csproj | 4 +- .../EmailAggregate.cs | 4 +- ...sagingService.EmailMessageAggregate.csproj | 4 +- .../Common/DockerHelper.cs | 5 +- .../Email/SendEmail.feature.cs | 12 +-- .../MessagingService.IntegrationTests.csproj | 22 ++-- MessagingService.IntegrationTests/nlog.config | 17 +++ .../General/BootstrapperTests.cs | 5 +- .../MessagingService.Tests.csproj | 8 +- MessagingService/MessagingService.csproj | 25 ++--- MessagingService/Startup.cs | 102 +++++++++--------- MessagingService/appsettings.Development.json | 7 +- MessagingService/appsettings.json | 7 +- 18 files changed, 178 insertions(+), 122 deletions(-) create mode 100644 MessagingService.IntegrationTests/nlog.config diff --git a/MessagingService.BusinessLogic.Tests/MessagingService.BusinessLogic.Tests.csproj b/MessagingService.BusinessLogic.Tests/MessagingService.BusinessLogic.Tests.csproj index 789e69f..ab41e42 100644 --- a/MessagingService.BusinessLogic.Tests/MessagingService.BusinessLogic.Tests.csproj +++ b/MessagingService.BusinessLogic.Tests/MessagingService.BusinessLogic.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 @@ -7,15 +7,15 @@ - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/MessagingService.BusinessLogic.Tests/Services/EmailDomainServiceTests.cs b/MessagingService.BusinessLogic.Tests/Services/EmailDomainServiceTests.cs index 7fdbadf..9277016 100644 --- a/MessagingService.BusinessLogic.Tests/Services/EmailDomainServiceTests.cs +++ b/MessagingService.BusinessLogic.Tests/Services/EmailDomainServiceTests.cs @@ -10,7 +10,6 @@ namespace MessagingService.BusinessLogic.Tests.Services using BusinessLogic.Services.EmailServices; using EmailMessageAggregate; using Moq; - using Shared.DomainDrivenDesign.EventStore; using Shared.EventStore.EventStore; using Testing; using Xunit; @@ -22,8 +21,6 @@ public async Task TransactionDomainService_ProcessLogonTransaction_TransactionIs { Mock> aggregateRepository = new Mock>(); aggregateRepository.Setup(a => a.GetLatestVersion(It.IsAny(), It.IsAny())).ReturnsAsync(TestData.GetEmptyEmailAggregate()); - Mock aggregateRepositoryManager = new Mock(); - aggregateRepositoryManager.Setup(a => a.GetAggregateRepository(It.IsAny())).Returns(aggregateRepository.Object); Mock emailServiceProxy = new Mock(); emailServiceProxy .Setup(e => e.SendEmail(It.IsAny(), @@ -39,7 +36,7 @@ public async Task TransactionDomainService_ProcessLogonTransaction_TransactionIs //Logger.Initialise(NullLogger.Instance); EmailDomainService emailDomainService = - new EmailDomainService(aggregateRepositoryManager.Object, emailServiceProxy.Object); + new EmailDomainService(aggregateRepository.Object, emailServiceProxy.Object); await emailDomainService.SendEmailMessage(TestData.ConnectionIdentifier, TestData.MessageId, diff --git a/MessagingService.BusinessLogic/MessagingService.BusinessLogic.csproj b/MessagingService.BusinessLogic/MessagingService.BusinessLogic.csproj index ba572f1..feee804 100644 --- a/MessagingService.BusinessLogic/MessagingService.BusinessLogic.csproj +++ b/MessagingService.BusinessLogic/MessagingService.BusinessLogic.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 @@ -10,7 +10,7 @@ - + diff --git a/MessagingService.BusinessLogic/Services/EmailDomainService.cs b/MessagingService.BusinessLogic/Services/EmailDomainService.cs index 41eb16c..cb7d73c 100644 --- a/MessagingService.BusinessLogic/Services/EmailDomainService.cs +++ b/MessagingService.BusinessLogic/Services/EmailDomainService.cs @@ -6,8 +6,9 @@ using System.Threading.Tasks; using EmailMessageAggregate; using EmailServices; - using Shared.DomainDrivenDesign.EventStore; + using Microsoft.Extensions.Logging; using Shared.EventStore.EventStore; + using Shared.Logger; /// /// @@ -18,9 +19,9 @@ public class EmailDomainService : IEmailDomainService #region Fields /// - /// The aggregate repository manager + /// The email aggregate repository /// - private readonly IAggregateRepositoryManager AggregateRepositoryManager; + private readonly IAggregateRepository EmailAggregateRepository; /// /// The email service proxy @@ -32,15 +33,16 @@ public class EmailDomainService : IEmailDomainService #region Constructors /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// The aggregate repository manager. + /// The email aggregate repository. /// The email service proxy. - public EmailDomainService(IAggregateRepositoryManager aggregateRepositoryManager, + public EmailDomainService(IAggregateRepository emailAggregateRepository, IEmailServiceProxy emailServiceProxy) { - this.AggregateRepositoryManager = aggregateRepositoryManager; + this.EmailAggregateRepository = emailAggregateRepository; this.EmailServiceProxy = emailServiceProxy; + this.EmailAggregateRepository.TraceGenerated += this.EmailAggregateRepository_TraceGenerated; } #endregion @@ -67,10 +69,8 @@ public async Task SendEmailMessage(Guid connectionIdentifier, Boolean isHtml, CancellationToken cancellationToken) { - IAggregateRepository emailAggregateRepository = this.AggregateRepositoryManager.GetAggregateRepository(connectionIdentifier); - // Rehydrate Email Message aggregate - EmailAggregate emailAggregate = await emailAggregateRepository.GetLatestVersion(messageId, cancellationToken); + EmailAggregate emailAggregate = await this.EmailAggregateRepository.GetLatestVersion(messageId, cancellationToken); // send message to provider (record event) emailAggregate.SendRequestToProvider(fromAddress, toAddresses, subject, body, isHtml); @@ -83,7 +83,38 @@ public async Task SendEmailMessage(Guid connectionIdentifier, emailAggregate.ReceiveResponseFromProvider(emailResponse.RequestIdentifier, emailResponse.EmailIdentifier); // Save Changes to persistance - await emailAggregateRepository.SaveChanges(emailAggregate, cancellationToken); + await this.EmailAggregateRepository.SaveChanges(emailAggregate, cancellationToken); + } + + /// + /// Emails the aggregate repository trace generated. + /// + /// The trace. + /// The log level. + private void EmailAggregateRepository_TraceGenerated(String trace, + LogLevel logLevel) + { + switch(logLevel) + { + case LogLevel.Critical: + Logger.LogCritical(new Exception(trace)); + break; + case LogLevel.Debug: + Logger.LogDebug(trace); + break; + case LogLevel.Error: + Logger.LogError(new Exception(trace)); + break; + case LogLevel.Information: + Logger.LogInformation(trace); + break; + case LogLevel.Trace: + Logger.LogTrace(trace); + break; + case LogLevel.Warning: + Logger.LogWarning(trace); + break; + } } #endregion diff --git a/MessagingService.EmailAggregate.Tests/MessagingService.EmailAggregate.Tests.csproj b/MessagingService.EmailAggregate.Tests/MessagingService.EmailAggregate.Tests.csproj index 261f8ca..de1a4dc 100644 --- a/MessagingService.EmailAggregate.Tests/MessagingService.EmailAggregate.Tests.csproj +++ b/MessagingService.EmailAggregate.Tests/MessagingService.EmailAggregate.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 @@ -8,14 +8,14 @@ - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/MessagingService.EmailMessage.DomainEvents/MessagingService.EmailMessage.DomainEvents.csproj b/MessagingService.EmailMessage.DomainEvents/MessagingService.EmailMessage.DomainEvents.csproj index 44c1c40..906fd7a 100644 --- a/MessagingService.EmailMessage.DomainEvents/MessagingService.EmailMessage.DomainEvents.csproj +++ b/MessagingService.EmailMessage.DomainEvents/MessagingService.EmailMessage.DomainEvents.csproj @@ -1,11 +1,11 @@ - + netstandard2.1 - + diff --git a/MessagingService.EmailMessageAggregate/EmailAggregate.cs b/MessagingService.EmailMessageAggregate/EmailAggregate.cs index 85e09d8..63fa2f8 100644 --- a/MessagingService.EmailMessageAggregate/EmailAggregate.cs +++ b/MessagingService.EmailMessageAggregate/EmailAggregate.cs @@ -5,13 +5,13 @@ using System.Diagnostics.CodeAnalysis; using EmailMessage.DomainEvents; using Shared.DomainDrivenDesign.EventSourcing; - using Shared.DomainDrivenDesign.EventStore; + using Shared.EventStore.EventStore; using Shared.General; /// /// /// - /// + /// public class EmailAggregate : Aggregate { #region Fields diff --git a/MessagingService.EmailMessageAggregate/MessagingService.EmailMessageAggregate.csproj b/MessagingService.EmailMessageAggregate/MessagingService.EmailMessageAggregate.csproj index 94b4885..e76dc8b 100644 --- a/MessagingService.EmailMessageAggregate/MessagingService.EmailMessageAggregate.csproj +++ b/MessagingService.EmailMessageAggregate/MessagingService.EmailMessageAggregate.csproj @@ -1,11 +1,11 @@ - + netcoreapp3.1 - + diff --git a/MessagingService.IntegrationTests/Common/DockerHelper.cs b/MessagingService.IntegrationTests/Common/DockerHelper.cs index 15723aa..e6d169f 100644 --- a/MessagingService.IntegrationTests/Common/DockerHelper.cs +++ b/MessagingService.IntegrationTests/Common/DockerHelper.cs @@ -130,7 +130,7 @@ public override async Task StartContainersForScenarioRun(String scenarioName) INetworkService testNetwork = DockerHelper.SetupTestNetwork(); this.TestNetworks.Add(testNetwork); IContainerService eventStoreContainer = - DockerHelper.SetupEventStoreContainer(this.EventStoreContainerName, this.Logger, "eventstore/eventstore:release-5.0.2", testNetwork, traceFolder); + DockerHelper.SetupEventStoreContainer(this.EventStoreContainerName, this.Logger, "eventstore/eventstore:20.6.0-buster-slim", testNetwork, traceFolder, usesEventStore2006OrLater:true); IContainerService securityServiceContainer = DockerHelper.SetupSecurityServiceContainer(this.SecurityServiceContainerName, this.Logger, @@ -215,8 +215,7 @@ public static IContainerService SetupMessagingServiceContainer(String containerN logger.LogInformation("About to Start Messaging Service Container"); List environmentVariables = new List(); - environmentVariables - .Add($"EventStoreSettings:ConnectionString=ConnectTo=tcp://admin:changeit@{eventStoreContainerName}:{DockerHelper.EventStoreTcpDockerPort};VerboseLogging=true;"); + environmentVariables.Add($"EventStoreSettings:ConnectionString=https://{eventStoreContainerName}:{DockerHelper.EventStoreHttpDockerPort}"); environmentVariables.Add($"AppSettings:SecurityService=http://{securityServiceContainerName}:{securityServicePort}"); environmentVariables.Add($"SecurityConfiguration:Authority=http://{securityServiceContainerName}:{securityServicePort}"); environmentVariables.Add($"urls=http://*:{DockerHelper.MessagingServiceDockerPort}"); diff --git a/MessagingService.IntegrationTests/Email/SendEmail.feature.cs b/MessagingService.IntegrationTests/Email/SendEmail.feature.cs index 84b3cb7..c01f1f5 100644 --- a/MessagingService.IntegrationTests/Email/SendEmail.feature.cs +++ b/MessagingService.IntegrationTests/Email/SendEmail.feature.cs @@ -1,7 +1,7 @@ // ------------------------------------------------------------------------------ // -// This code was generated by SpecFlow (http://www.specflow.org/). -// SpecFlow Version:3.1.0.0 +// This code was generated by SpecFlow (https://www.specflow.org/). +// SpecFlow Version:3.3.0.0 // SpecFlow Generator Version:3.1.0.0 // // Changes to this file may cause incorrect behavior and will be lost if @@ -17,7 +17,7 @@ namespace MessagingService.IntegrationTests.Email using System.Linq; - [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "3.1.0.0")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "3.3.0.0")] [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [Xunit.TraitAttribute("Category", "base")] [Xunit.TraitAttribute("Category", "shared")] @@ -140,8 +140,8 @@ public virtual void SendEmail() { string[] tagsOfScenario = new string[] { "PRTest"}; - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Send Email", null, new string[] { - "PRTest"}); + System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Send Email", null, tagsOfScenario, argumentsOfScenario); #line 18 this.ScenarioInitialize(scenarioInfo); #line hidden @@ -190,7 +190,7 @@ public virtual void SendEmail() this.ScenarioCleanup(); } - [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "3.1.0.0")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "3.3.0.0")] [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class FixtureData : System.IDisposable { diff --git a/MessagingService.IntegrationTests/MessagingService.IntegrationTests.csproj b/MessagingService.IntegrationTests/MessagingService.IntegrationTests.csproj index 4979514..9adb615 100644 --- a/MessagingService.IntegrationTests/MessagingService.IntegrationTests.csproj +++ b/MessagingService.IntegrationTests/MessagingService.IntegrationTests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 @@ -7,20 +7,20 @@ - + - - + + - - + + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -44,4 +44,10 @@ + + + Always + + + diff --git a/MessagingService.IntegrationTests/nlog.config b/MessagingService.IntegrationTests/nlog.config new file mode 100644 index 0000000..f94fa5f --- /dev/null +++ b/MessagingService.IntegrationTests/nlog.config @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MessagingService.Tests/General/BootstrapperTests.cs b/MessagingService.Tests/General/BootstrapperTests.cs index fb08480..9218705 100644 --- a/MessagingService.Tests/General/BootstrapperTests.cs +++ b/MessagingService.Tests/General/BootstrapperTests.cs @@ -44,9 +44,10 @@ private IConfigurationRoot SetupMemoryConfiguration() IConfigurationBuilder builder = new ConfigurationBuilder(); - configuration.Add("EventStoreSettings:ConnectionString", "ConnectTo=tcp://admin:changeit@127.0.0.1:1112;VerboseLogging=true;"); + configuration.Add("EventStoreSettings:ConnectionString", "https://127.0.0.1:2113"); configuration.Add("EventStoreSettings:ConnectionName", "UnitTestConnection"); - configuration.Add("EventStoreSettings:HttpPort", "2113"); + configuration.Add("EventStoreSettings:UserName", "admin"); + configuration.Add("EventStoreSettings:Password", "changeit"); configuration.Add("AppSettings:UseConnectionStringConfig", "false"); configuration.Add("AppSettings:ClientId", "clientId"); configuration.Add("AppSettings:ClientSecret", "clientSecret"); diff --git a/MessagingService.Tests/MessagingService.Tests.csproj b/MessagingService.Tests/MessagingService.Tests.csproj index b46eea3..1714751 100644 --- a/MessagingService.Tests/MessagingService.Tests.csproj +++ b/MessagingService.Tests/MessagingService.Tests.csproj @@ -7,15 +7,15 @@ - + - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/MessagingService/MessagingService.csproj b/MessagingService/MessagingService.csproj index 9fb5660..8e83f02 100644 --- a/MessagingService/MessagingService.csproj +++ b/MessagingService/MessagingService.csproj @@ -7,19 +7,20 @@ - + + - - - - - - - - - - - + + + + + + + + + + + diff --git a/MessagingService/Startup.cs b/MessagingService/Startup.cs index bf978dc..737e465 100644 --- a/MessagingService/Startup.cs +++ b/MessagingService/Startup.cs @@ -24,7 +24,7 @@ namespace MessagingService using BusinessLogic.Services.EmailServices.Smtp2Go; using Common; using EmailMessageAggregate; - using EventStore.ClientAPI; + using EventStore.Client; using MediatR; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Mvc.ApiExplorer; @@ -34,7 +34,6 @@ namespace MessagingService using Newtonsoft.Json.Serialization; using NLog.Extensions.Logging; using Service.Services.Email.IntegrationTest; - using Shared.DomainDrivenDesign.EventStore; using Shared.EntityFramework.ConnectionStringConfiguration; using Shared.EventStore.EventStore; using Shared.Extensions; @@ -43,7 +42,6 @@ namespace MessagingService using Shared.Repositories; using Swashbuckle.AspNetCore.Filters; using Swashbuckle.AspNetCore.SwaggerGen; - using ILogger = EventStore.ClientAPI.ILogger; [ExcludeFromCodeCoverage] public class Startup @@ -70,33 +68,8 @@ public void ConfigureServices(IServiceCollection services) services.AddTransient(); ConfigurationReader.Initialise(Startup.Configuration); - String connString = Startup.Configuration.GetValue("EventStoreSettings:ConnectionString"); - String connectionName = Startup.Configuration.GetValue("EventStoreSettings:ConnectionName"); - Int32 httpPort = Startup.Configuration.GetValue("EventStoreSettings:HttpPort"); Boolean useConnectionStringConfig = Boolean.Parse(ConfigurationReader.GetValue("AppSettings", "UseConnectionStringConfig")); - EventStoreConnectionSettings settings = EventStoreConnectionSettings.Create(connString, connectionName, httpPort); - services.AddSingleton(settings); - - services.AddSingleton>(cont => (connectionSettings) => - { - return EventStoreConnection.Create(connectionSettings - .ConnectionString); - }); - - services.AddSingleton>(cont => (connectionString) => - { - EventStoreConnectionSettings connectionSettings = - EventStoreConnectionSettings.Create(connectionString, connectionName, httpPort); - - Func eventStoreConnectionFunc = cont.GetService>(); - - IEventStoreContext context = - new EventStoreContext(connectionSettings, eventStoreConnectionFunc); - - return context; - }); - if (useConnectionStringConfig) { @@ -106,38 +79,67 @@ public void ConfigureServices(IServiceCollection services) { return new ConnectionStringConfigurationContext(connectionStringConfigurationConnString); }); - - services.AddSingleton(c => - { - Func contextFunc = c.GetService>(); - IConnectionStringConfigurationRepository connectionStringConfigurationRepository = - c.GetService(); - return new EventStoreContextManager(contextFunc, - connectionStringConfigurationRepository); - }); + + // TODO: Read this from a the database and set } else { - services.AddSingleton(c => - { - IEventStoreContext context = c.GetService(); - return new EventStoreContextManager(context); - }); + services.AddEventStoreClient((settings) => + { + settings.CreateHttpMessageHandler = () => new SocketsHttpHandler + { + SslOptions = + { + RemoteCertificateValidationCallback = (sender, + certificate, + chain, + errors) => true, + } + }; + settings.ConnectionName = Startup.Configuration.GetValue("EventStoreSettings:ConnectionName"); + settings.ConnectivitySettings = new EventStoreClientConnectivitySettings + { + Address = + new Uri(Startup.Configuration.GetValue("EventStoreSettings:ConnectionString")), + }; + settings.DefaultCredentials = new UserCredentials(Startup.Configuration.GetValue("EventStoreSettings:UserName"), + Startup.Configuration.GetValue("EventStoreSettings:Password")); + }); + + + + services.AddEventStoreProjectionManagerClient((settings) => + { + settings.CreateHttpMessageHandler = () => new SocketsHttpHandler + { + SslOptions = + { + RemoteCertificateValidationCallback = (sender, + certificate, + chain, + errors) => true, + } + }; + settings.ConnectionName = Startup.Configuration.GetValue("EventStoreSettings:ConnectionName"); + settings.ConnectivitySettings = new EventStoreClientConnectivitySettings + { + Address = + new Uri(Startup.Configuration.GetValue("EventStoreSettings:ConnectionString")) + }; + settings.DefaultCredentials = new UserCredentials(Startup.Configuration.GetValue("EventStoreSettings:UserName"), + Startup.Configuration.GetValue("EventStoreSettings:Password")); + }); services.AddSingleton(); } + services.AddTransient(); - services.AddSingleton(); - services.AddSingleton, AggregateRepository>(); services.AddSingleton(); + services.AddSingleton, AggregateRepository>(); this.RegisterEmailProxy(services); - //services.AddSingleton(); - //services.AddSingleton(); - //services.AddSingleton(); - - //// request & notification handlers + // request & notification handlers services.AddTransient(context => { return t => context.GetService(t); @@ -151,7 +153,7 @@ public void ConfigureServices(IServiceCollection services) }); services.AddSingleton(); } - + /// /// Registers the email proxy. /// diff --git a/MessagingService/appsettings.Development.json b/MessagingService/appsettings.Development.json index 7ea7725..3e34132 100644 --- a/MessagingService/appsettings.Development.json +++ b/MessagingService/appsettings.Development.json @@ -7,13 +7,14 @@ } }, "EventStoreSettings": { - "ConnectionString": "ConnectTo=tcp://admin:changeit@127.0.0.1:1113;VerboseLogging=true;", + "ConnectionString": "https://localhost:2113", "ConnectionName": "Messaging Service", - "HttpPort": 2113, + "UserName": "admin", + "Password": "changeit", "START_PROJECTIONS": false, "ContinuousProjectionsFolder": "" }, "ConnectionStrings": { - "ConnectionStringConfiguration": "server=127.0.0.1;database=ConnectionStringConfiguration;user id=sa;password=Sc0tland", + "ConnectionStringConfiguration": "server=127.0.0.1;database=ConnectionStringConfiguration;user id=sa;password=Sc0tland" } } diff --git a/MessagingService/appsettings.json b/MessagingService/appsettings.json index 746da91..9f0a026 100644 --- a/MessagingService/appsettings.json +++ b/MessagingService/appsettings.json @@ -7,9 +7,10 @@ } }, "EventStoreSettings": { - "ConnectionString": "ConnectTo=tcp://admin:changeit@192.168.1.133:1113;VerboseLogging=true;", - "ConnectionName": "Estate Management", - "HttpPort": 2113, + "ConnectionString": "https://192.168.1.133:2113", + "ConnectionName": "Messaging Service", + "UserName": "admin", + "Password": "changeit", "START_PROJECTIONS": false, "ContinuousProjectionsFolder": "" }, From 1cdc5abf19431cf5911f7632ee6b5ba7cf475363 Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Tue, 30 Jun 2020 12:08:18 +0100 Subject: [PATCH 2/3] Fix nuget issue --- .../MessagingService.IntegrationTests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MessagingService.IntegrationTests/MessagingService.IntegrationTests.csproj b/MessagingService.IntegrationTests/MessagingService.IntegrationTests.csproj index 9adb615..89de71e 100644 --- a/MessagingService.IntegrationTests/MessagingService.IntegrationTests.csproj +++ b/MessagingService.IntegrationTests/MessagingService.IntegrationTests.csproj @@ -7,7 +7,7 @@ - + From fd84e773345c98418c8c7e155584310a279ff906 Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Tue, 30 Jun 2020 12:39:52 +0100 Subject: [PATCH 3/3] Updates from code review --- .../Services/EmailDomainService.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/MessagingService.BusinessLogic/Services/EmailDomainService.cs b/MessagingService.BusinessLogic/Services/EmailDomainService.cs index cb7d73c..dd7cdac 100644 --- a/MessagingService.BusinessLogic/Services/EmailDomainService.cs +++ b/MessagingService.BusinessLogic/Services/EmailDomainService.cs @@ -42,7 +42,7 @@ public EmailDomainService(IAggregateRepository emailAggregateRep { this.EmailAggregateRepository = emailAggregateRepository; this.EmailServiceProxy = emailServiceProxy; - this.EmailAggregateRepository.TraceGenerated += this.EmailAggregateRepository_TraceGenerated; + this.EmailAggregateRepository.TraceGenerated += EmailDomainService.EmailAggregateRepository_TraceGenerated; } #endregion @@ -91,7 +91,7 @@ public async Task SendEmailMessage(Guid connectionIdentifier, /// /// The trace. /// The log level. - private void EmailAggregateRepository_TraceGenerated(String trace, + private static void EmailAggregateRepository_TraceGenerated(String trace, LogLevel logLevel) { switch(logLevel) @@ -114,6 +114,9 @@ private void EmailAggregateRepository_TraceGenerated(String trace, case LogLevel.Warning: Logger.LogWarning(trace); break; + default: + Logger.LogInformation(trace); + break; } }