From 8df0c4e9fa30a20e8e3195a64a60847fa2fbc350 Mon Sep 17 00:00:00 2001 From: Rafael Andrade Date: Thu, 31 Jul 2025 11:51:33 +0100 Subject: [PATCH 1/3] feat: Update ServiceLifetime --- .../Mappers/FarewellEventMessageMapper.cs | 116 +++++++++--------- .../Mappers/GreetingEventMessageMapper.cs | 104 ++++++++-------- .../BrighterOptions.cs | 8 +- .../ServiceCollectionExtensions.cs | 2 +- 4 files changed, 114 insertions(+), 116 deletions(-) diff --git a/samples/TaskQueue/RMQTaskQueue/Greetings/Ports/Mappers/FarewellEventMessageMapper.cs b/samples/TaskQueue/RMQTaskQueue/Greetings/Ports/Mappers/FarewellEventMessageMapper.cs index 31537a8c4c..020435987d 100644 --- a/samples/TaskQueue/RMQTaskQueue/Greetings/Ports/Mappers/FarewellEventMessageMapper.cs +++ b/samples/TaskQueue/RMQTaskQueue/Greetings/Ports/Mappers/FarewellEventMessageMapper.cs @@ -1,58 +1,58 @@ -#region Licence -/* The MIT License (MIT) -Copyright © 2014 Ian Cooper - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the “Software”), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. */ - -#endregion - -using System.Net.Mime; -using Greetings.Ports.Commands; -using MessagePack; -using Paramore.Brighter; -using Paramore.Brighter.Extensions; - -namespace Greetings.Ports.Mappers -{ - public class FarewellEventMessageMapper : IAmAMessageMapper - { - public IRequestContext Context { get; set; } - - public Message MapToMessage(FarewellEvent request, Publication publication) - { - var contentType = new ContentType("application/vnd.msgpack"); - var header = new MessageHeader( - messageId: request.Id, - topic: publication.Topic, - messageType: request.RequestToMessageType(), - contentType: contentType); - - var body = new MessageBody(MessagePackSerializer.Serialize(request), contentType); - var message = new Message(header, body); - return message; - } - - public FarewellEvent MapToRequest(Message message) - { - var farewellCommand = MessagePackSerializer.Deserialize(message.Body.Bytes); - - return farewellCommand; - } - } -} +// #region Licence +// /* The MIT License (MIT) +// Copyright © 2014 Ian Cooper +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the “Software”), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. */ +// +// #endregion +// +// using System.Net.Mime; +// using Greetings.Ports.Commands; +// using MessagePack; +// using Paramore.Brighter; +// using Paramore.Brighter.Extensions; +// +// namespace Greetings.Ports.Mappers +// { +// public class FarewellEventMessageMapper : IAmAMessageMapper +// { +// public IRequestContext Context { get; set; } +// +// public Message MapToMessage(FarewellEvent request, Publication publication) +// { +// var contentType = new ContentType("application/vnd.msgpack"); +// var header = new MessageHeader( +// messageId: request.Id, +// topic: publication.Topic, +// messageType: request.RequestToMessageType(), +// contentType: contentType); +// +// var body = new MessageBody(MessagePackSerializer.Serialize(request), contentType); +// var message = new Message(header, body); +// return message; +// } +// +// public FarewellEvent MapToRequest(Message message) +// { +// var farewellCommand = MessagePackSerializer.Deserialize(message.Body.Bytes); +// +// return farewellCommand; +// } +// } +// } diff --git a/samples/TaskQueue/RMQTaskQueue/Greetings/Ports/Mappers/GreetingEventMessageMapper.cs b/samples/TaskQueue/RMQTaskQueue/Greetings/Ports/Mappers/GreetingEventMessageMapper.cs index 83e349d8dd..fea2ebbf4a 100644 --- a/samples/TaskQueue/RMQTaskQueue/Greetings/Ports/Mappers/GreetingEventMessageMapper.cs +++ b/samples/TaskQueue/RMQTaskQueue/Greetings/Ports/Mappers/GreetingEventMessageMapper.cs @@ -1,52 +1,52 @@ -#region Licence -/* The MIT License (MIT) -Copyright © 2014 Ian Cooper - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the “Software”), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. */ - -#endregion - -using System.Text.Json; -using Greetings.Ports.Commands; -using Paramore.Brighter; -using Paramore.Brighter.Extensions; -using Paramore.Brighter.JsonConverters; - -namespace Greetings.Ports.Mappers -{ - public class GreetingEventMessageMapper : IAmAMessageMapper - { - public IRequestContext Context { get; set; } - - public Message MapToMessage(GreetingEvent request, Publication publication) - { - var header = new MessageHeader(messageId: request.Id, topic: publication.Topic, messageType: request.RequestToMessageType()); - var body = new MessageBody(JsonSerializer.Serialize(request, JsonSerialisationOptions.Options)); - var message = new Message(header, body); - return message; - } - - public GreetingEvent MapToRequest(Message message) - { - var greetingCommand = JsonSerializer.Deserialize(message.Body.Value, JsonSerialisationOptions.Options); - - return greetingCommand; - } - } -} +// #region Licence +// /* The MIT License (MIT) +// Copyright © 2014 Ian Cooper +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the “Software”), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. */ +// +// #endregion +// +// using System.Text.Json; +// using Greetings.Ports.Commands; +// using Paramore.Brighter; +// using Paramore.Brighter.Extensions; +// using Paramore.Brighter.JsonConverters; +// +// namespace Greetings.Ports.Mappers +// { +// public class GreetingEventMessageMapper : IAmAMessageMapper +// { +// public IRequestContext Context { get; set; } +// +// public Message MapToMessage(GreetingEvent request, Publication publication) +// { +// var header = new MessageHeader(messageId: request.Id, topic: publication.Topic, messageType: request.RequestToMessageType()); +// var body = new MessageBody(JsonSerializer.Serialize(request, JsonSerialisationOptions.Options)); +// var message = new Message(header, body); +// return message; +// } +// +// public GreetingEvent MapToRequest(Message message) +// { +// var greetingCommand = JsonSerializer.Deserialize(message.Body.Value, JsonSerialisationOptions.Options); +// +// return greetingCommand; +// } +// } +// } diff --git a/src/Paramore.Brighter.Extensions.DependencyInjection/BrighterOptions.cs b/src/Paramore.Brighter.Extensions.DependencyInjection/BrighterOptions.cs index b081f8637d..5a724017d1 100644 --- a/src/Paramore.Brighter.Extensions.DependencyInjection/BrighterOptions.cs +++ b/src/Paramore.Brighter.Extensions.DependencyInjection/BrighterOptions.cs @@ -34,9 +34,9 @@ public class BrighterOptions : IBrighterOptions public InstrumentationOptions InstrumentationOptions { get; set; } /// - /// Configures the lifetime of mappers. Defaults to Singleton + /// Configures the lifetime of mappers. Defaults to transit /// - public ServiceLifetime MapperLifetime { get; set; } = ServiceLifetime.Singleton; + public ServiceLifetime MapperLifetime { get; set; } = ServiceLifetime.Transient; /// /// Configures the polly policy registry. @@ -51,9 +51,7 @@ public class BrighterOptions : IBrighterOptions /// /// Configures the lifetime of any transformers. Defaults to Singleton /// - public ServiceLifetime TransformerLifetime { get; set; } = ServiceLifetime.Singleton; - - + public ServiceLifetime TransformerLifetime { get; set; } = ServiceLifetime.Transient; } public interface IBrighterOptions diff --git a/src/Paramore.Brighter.Extensions.DependencyInjection/ServiceCollectionExtensions.cs b/src/Paramore.Brighter.Extensions.DependencyInjection/ServiceCollectionExtensions.cs index b259c27964..7961804b33 100644 --- a/src/Paramore.Brighter.Extensions.DependencyInjection/ServiceCollectionExtensions.cs +++ b/src/Paramore.Brighter.Extensions.DependencyInjection/ServiceCollectionExtensions.cs @@ -146,7 +146,7 @@ public static IBrighterBuilder BrighterHandlerBuilder(IServiceCollection service public static IBrighterBuilder AddProducers( this IBrighterBuilder brighterBuilder, Action configure, - ServiceLifetime serviceLifetime = ServiceLifetime.Scoped) + ServiceLifetime serviceLifetime = ServiceLifetime.Transient) { if (brighterBuilder is null) throw new ArgumentNullException($"{nameof(brighterBuilder)} cannot be null.", nameof(brighterBuilder)); From c889c5d93247ffccde0c617d814a48b9e281080f Mon Sep 17 00:00:00 2001 From: Rafael Andrade Date: Thu, 31 Jul 2025 11:53:29 +0100 Subject: [PATCH 2/3] feat: uncomment code --- .../Mappers/FarewellEventMessageMapper.cs | 116 +++++++++--------- .../Mappers/GreetingEventMessageMapper.cs | 104 ++++++++-------- 2 files changed, 110 insertions(+), 110 deletions(-) diff --git a/samples/TaskQueue/RMQTaskQueue/Greetings/Ports/Mappers/FarewellEventMessageMapper.cs b/samples/TaskQueue/RMQTaskQueue/Greetings/Ports/Mappers/FarewellEventMessageMapper.cs index 020435987d..31537a8c4c 100644 --- a/samples/TaskQueue/RMQTaskQueue/Greetings/Ports/Mappers/FarewellEventMessageMapper.cs +++ b/samples/TaskQueue/RMQTaskQueue/Greetings/Ports/Mappers/FarewellEventMessageMapper.cs @@ -1,58 +1,58 @@ -// #region Licence -// /* The MIT License (MIT) -// Copyright © 2014 Ian Cooper -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the “Software”), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. */ -// -// #endregion -// -// using System.Net.Mime; -// using Greetings.Ports.Commands; -// using MessagePack; -// using Paramore.Brighter; -// using Paramore.Brighter.Extensions; -// -// namespace Greetings.Ports.Mappers -// { -// public class FarewellEventMessageMapper : IAmAMessageMapper -// { -// public IRequestContext Context { get; set; } -// -// public Message MapToMessage(FarewellEvent request, Publication publication) -// { -// var contentType = new ContentType("application/vnd.msgpack"); -// var header = new MessageHeader( -// messageId: request.Id, -// topic: publication.Topic, -// messageType: request.RequestToMessageType(), -// contentType: contentType); -// -// var body = new MessageBody(MessagePackSerializer.Serialize(request), contentType); -// var message = new Message(header, body); -// return message; -// } -// -// public FarewellEvent MapToRequest(Message message) -// { -// var farewellCommand = MessagePackSerializer.Deserialize(message.Body.Bytes); -// -// return farewellCommand; -// } -// } -// } +#region Licence +/* The MIT License (MIT) +Copyright © 2014 Ian Cooper + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the “Software”), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. */ + +#endregion + +using System.Net.Mime; +using Greetings.Ports.Commands; +using MessagePack; +using Paramore.Brighter; +using Paramore.Brighter.Extensions; + +namespace Greetings.Ports.Mappers +{ + public class FarewellEventMessageMapper : IAmAMessageMapper + { + public IRequestContext Context { get; set; } + + public Message MapToMessage(FarewellEvent request, Publication publication) + { + var contentType = new ContentType("application/vnd.msgpack"); + var header = new MessageHeader( + messageId: request.Id, + topic: publication.Topic, + messageType: request.RequestToMessageType(), + contentType: contentType); + + var body = new MessageBody(MessagePackSerializer.Serialize(request), contentType); + var message = new Message(header, body); + return message; + } + + public FarewellEvent MapToRequest(Message message) + { + var farewellCommand = MessagePackSerializer.Deserialize(message.Body.Bytes); + + return farewellCommand; + } + } +} diff --git a/samples/TaskQueue/RMQTaskQueue/Greetings/Ports/Mappers/GreetingEventMessageMapper.cs b/samples/TaskQueue/RMQTaskQueue/Greetings/Ports/Mappers/GreetingEventMessageMapper.cs index fea2ebbf4a..83e349d8dd 100644 --- a/samples/TaskQueue/RMQTaskQueue/Greetings/Ports/Mappers/GreetingEventMessageMapper.cs +++ b/samples/TaskQueue/RMQTaskQueue/Greetings/Ports/Mappers/GreetingEventMessageMapper.cs @@ -1,52 +1,52 @@ -// #region Licence -// /* The MIT License (MIT) -// Copyright © 2014 Ian Cooper -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the “Software”), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. */ -// -// #endregion -// -// using System.Text.Json; -// using Greetings.Ports.Commands; -// using Paramore.Brighter; -// using Paramore.Brighter.Extensions; -// using Paramore.Brighter.JsonConverters; -// -// namespace Greetings.Ports.Mappers -// { -// public class GreetingEventMessageMapper : IAmAMessageMapper -// { -// public IRequestContext Context { get; set; } -// -// public Message MapToMessage(GreetingEvent request, Publication publication) -// { -// var header = new MessageHeader(messageId: request.Id, topic: publication.Topic, messageType: request.RequestToMessageType()); -// var body = new MessageBody(JsonSerializer.Serialize(request, JsonSerialisationOptions.Options)); -// var message = new Message(header, body); -// return message; -// } -// -// public GreetingEvent MapToRequest(Message message) -// { -// var greetingCommand = JsonSerializer.Deserialize(message.Body.Value, JsonSerialisationOptions.Options); -// -// return greetingCommand; -// } -// } -// } +#region Licence +/* The MIT License (MIT) +Copyright © 2014 Ian Cooper + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the “Software”), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. */ + +#endregion + +using System.Text.Json; +using Greetings.Ports.Commands; +using Paramore.Brighter; +using Paramore.Brighter.Extensions; +using Paramore.Brighter.JsonConverters; + +namespace Greetings.Ports.Mappers +{ + public class GreetingEventMessageMapper : IAmAMessageMapper + { + public IRequestContext Context { get; set; } + + public Message MapToMessage(GreetingEvent request, Publication publication) + { + var header = new MessageHeader(messageId: request.Id, topic: publication.Topic, messageType: request.RequestToMessageType()); + var body = new MessageBody(JsonSerializer.Serialize(request, JsonSerialisationOptions.Options)); + var message = new Message(header, body); + return message; + } + + public GreetingEvent MapToRequest(Message message) + { + var greetingCommand = JsonSerializer.Deserialize(message.Body.Value, JsonSerialisationOptions.Options); + + return greetingCommand; + } + } +} From ecaae9dd8c258defaf8789a251e62533e54f6a36 Mon Sep 17 00:00:00 2001 From: Rafael Andrade Date: Fri, 1 Aug 2025 10:02:17 +0100 Subject: [PATCH 3/3] fix: Unit Tests --- .../AssemblyResolutionDefaultTransientTests.cs | 2 +- ...utionHandlerLifetimeScopedAndMapperLifetimeSingletonTests.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Paramore.Brighter.Extensions.Tests/AssemblyResolutionDefaultTransientTests.cs b/tests/Paramore.Brighter.Extensions.Tests/AssemblyResolutionDefaultTransientTests.cs index c094e438c8..920113d2ec 100644 --- a/tests/Paramore.Brighter.Extensions.Tests/AssemblyResolutionDefaultTransientTests.cs +++ b/tests/Paramore.Brighter.Extensions.Tests/AssemblyResolutionDefaultTransientTests.cs @@ -47,7 +47,7 @@ public void ShouldHaveTestHandlerRegisteredCorrectly() [Fact] public void ShouldHaveTestMapperRegisteredCorrectly() { - TestRegistration(typeof(TestEventMessageMapper), ServiceLifetime.Singleton); + TestRegistration(typeof(TestEventMessageMapper), ServiceLifetime.Transient); } [Fact] diff --git a/tests/Paramore.Brighter.Extensions.Tests/AssemblyResolutionHandlerLifetimeScopedAndMapperLifetimeSingletonTests.cs b/tests/Paramore.Brighter.Extensions.Tests/AssemblyResolutionHandlerLifetimeScopedAndMapperLifetimeSingletonTests.cs index aeed748e4f..691b232be9 100644 --- a/tests/Paramore.Brighter.Extensions.Tests/AssemblyResolutionHandlerLifetimeScopedAndMapperLifetimeSingletonTests.cs +++ b/tests/Paramore.Brighter.Extensions.Tests/AssemblyResolutionHandlerLifetimeScopedAndMapperLifetimeSingletonTests.cs @@ -48,7 +48,7 @@ public void ShouldHaveTestHandlerRegisteredCorrectly() [Fact] public void ShouldHaveTestMapperRegisteredCorrectly() { - TestRegistration(typeof(TestEventMessageMapper), ServiceLifetime.Singleton); + TestRegistration(typeof(TestEventMessageMapper), ServiceLifetime.Transient); } [Fact]