diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/BestPractices/When_subscribing_to_command_bestpractices_disabled_on_endpoint.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/BestPractices/When_subscribing_to_command_bestpractices_disabled_on_endpoint.cs deleted file mode 100644 index b53db2099..000000000 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/BestPractices/When_subscribing_to_command_bestpractices_disabled_on_endpoint.cs +++ /dev/null @@ -1,72 +0,0 @@ -namespace NServiceBus.AcceptanceTests.BestPractices -{ - using System.Threading.Tasks; - using AcceptanceTesting; - using EndpointTemplates; - using NUnit.Framework; - - public class When_subscribing_to_command_bestpractices_disabled_on_endpoint : NServiceBusAcceptanceTest - { - [Test] - public Task Should_allow_subscribing_to_commands() - { - return Scenario.Define() - .WithEndpoint(b => b.When((session, c) => session.Subscribe())) - .Done(c => c.EndpointsStarted) - .Run(); - } - - [Test] - public Task Should_allow_publishing_commands() - { - return Scenario.Define() - .WithEndpoint(b => b.When((session, c) => session.Publish(new MyCommand()))) - .Done(c => c.EndpointsStarted) - .Run(); - } - - [Test] - public Task Should_allow_sending_events() - { - return Scenario.Define() - .WithEndpoint(b => b.When((session, c) => session.Send(new MyEvent()))) - .Done(c => c.EndpointsStarted) - .Run(); - } - - public class Endpoint : EndpointConfigurationBuilder - { - public Endpoint() - { - EndpointSetup((c, r) => - { - var routing = c.UseTransport(r.GetTransportType()).Routing(); - routing.DoNotEnforceBestPractices(); - }) - .AddMapping(typeof(Endpoint)) - .AddMapping(typeof(Endpoint)); - } - - public class Handler : IHandleMessages, IHandleMessages - { - public Task Handle(MyCommand message, IMessageHandlerContext context) - { - return Task.FromResult(0); - } - - public Task Handle(MyEvent message, IMessageHandlerContext context) - { - return Task.FromResult(0); - } - } - } - - public class MyCommand : ICommand - { - } - - public class MyEvent : IEvent - { - } - } -} \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/BestPractices/When_unsubscribing_to_command_bestpractices_disabled_on_endpoint.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/BestPractices/When_unsubscribing_to_command_bestpractices_disabled_on_endpoint.cs deleted file mode 100644 index 2434a70a7..000000000 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/BestPractices/When_unsubscribing_to_command_bestpractices_disabled_on_endpoint.cs +++ /dev/null @@ -1,49 +0,0 @@ -namespace NServiceBus.AcceptanceTests.BestPractices -{ - using System.Threading.Tasks; - using AcceptanceTesting; - using EndpointTemplates; - using NUnit.Framework; - - public class When_unsubscribing_to_command_bestpractices_disabled_on_endpoint : NServiceBusAcceptanceTest - { - [Test] - public Task Should_allow_unsubscribing_to_commands() - { - return Scenario.Define() - .WithEndpoint(b => b.When((session, c) => session.Unsubscribe())) - .Done(c => c.EndpointsStarted) - .Run(); - } - - public class Endpoint : EndpointConfigurationBuilder - { - public Endpoint() - { - EndpointSetup((c, r) => - { - var routing = c.UseTransport(r.GetTransportType()).Routing(); - routing.DoNotEnforceBestPractices(); - }) - .AddMapping(typeof(Endpoint)) - .AddMapping(typeof(Endpoint)); - } - - public class Handler : IHandleMessages - { - public Task Handle(MyEvent message, IMessageHandlerContext context) - { - return Task.FromResult(0); - } - } - } - - public class MyCommand : ICommand - { - } - - public class MyEvent : IEvent - { - } - } -} \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ConventionEnforcementTests.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ConventionEnforcementTests.cs deleted file mode 100644 index 68ac9aae8..000000000 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ConventionEnforcementTests.cs +++ /dev/null @@ -1,29 +0,0 @@ -namespace NServiceBus.AcceptanceTests -{ - using System; - using System.Linq; - using System.Reflection; - using NUnit.Framework; - - [TestFixture] - public class ConventionEnforcementTests : NServiceBusAcceptanceTest - { - [Test] - public void Ensure_all_tests_derive_from_a_common_base_class() - { - var testTypes = Assembly.GetExecutingAssembly().GetTypes() - .Where(HasTestMethod); - - var missingBaseClass = testTypes - .Where(t => t.BaseType == null || !typeof(NServiceBusAcceptanceTest).IsAssignableFrom(t)) - .ToList(); - - CollectionAssert.IsEmpty(missingBaseClass, string.Join(",", missingBaseClass)); - } - - static bool HasTestMethod(Type t) - { - return t.GetMethods().Any(m => m.GetCustomAttributes().Any()); - } - } -} \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DelayedDelivery/TimeoutManager/When_TimeoutManager_is_disabled.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DelayedDelivery/TimeoutManager/When_TimeoutManager_is_disabled.cs deleted file mode 100644 index cc34a01d3..000000000 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DelayedDelivery/TimeoutManager/When_TimeoutManager_is_disabled.cs +++ /dev/null @@ -1,89 +0,0 @@ -namespace NServiceBus.AcceptanceTests.DelayedDelivery -{ - using System; - using System.Threading.Tasks; - using AcceptanceTesting; - using EndpointTemplates; - using Features; - using NUnit.Framework; - using ScenarioDescriptors; - - public class When_TimeoutManager_is_disabled : NServiceBusAcceptanceTest - { - [Test] - public Task Bus_Defer_should_throw() - { - return Scenario.Define() - .WithEndpoint(b => b.When((session, c) => - { - var options = new SendOptions(); - - options.RouteToThisEndpoint(); - - return session.Send(new MyMessage(), options); - })) - .Done(c => c.ExceptionThrown || c.SecondMessageReceived) - .Repeat(r => r.For()) - .Should(c => - { - Assert.AreEqual(true, c.ExceptionThrown); - Assert.AreEqual(false, c.SecondMessageReceived); - }) - .Run(); - } - - public class Context : ScenarioContext - { - public bool ExceptionThrown { get; set; } - public bool SecondMessageReceived { get; set; } - } - - public class Endpoint : EndpointConfigurationBuilder - { - public Endpoint() - { - // Explicitly disable TimeoutManager, although this should be default anyway - EndpointSetup(config => config.DisableFeature()); - } - - public class MyMessageHandler : IHandleMessages, IHandleMessages - { - public Context TestContext { get; set; } - - public async Task Handle(MyMessage message, IMessageHandlerContext context) - { - try - { - var opts = new SendOptions(); - opts.DelayDeliveryWith(TimeSpan.FromMilliseconds(1)); - opts.RouteToThisEndpoint(); - - await context.Send(new MyOtherMessage(), opts); - } - catch (Exception x) - { - Console.WriteLine(x.Message); - TestContext.ExceptionThrown = true; - } - } - - public Task Handle(MyOtherMessage message, IMessageHandlerContext context) - { - TestContext.SecondMessageReceived = true; - - return Task.FromResult(0); - } - } - } - - [Serializable] - public class MyMessage : IMessage - { - } - - [Serializable] - public class MyOtherMessage : IMessage - { - } - } -} \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DelayedDelivery/TimeoutManager/When_timeout_dispatch_fails.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DelayedDelivery/TimeoutManager/When_timeout_dispatch_fails.cs deleted file mode 100644 index 0541f12e2..000000000 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DelayedDelivery/TimeoutManager/When_timeout_dispatch_fails.cs +++ /dev/null @@ -1,165 +0,0 @@ -namespace NServiceBus.AcceptanceTests.DelayedDelivery -{ - using System; - using System.Threading.Tasks; - using AcceptanceTesting; - using EndpointTemplates; - using Extensibility; - using Features; - using NServiceBus; - using NServiceBus.Pipeline; - using NUnit.Framework; - using Persistence; - using ScenarioDescriptors; - using Timeout.Core; - using Conventions = AcceptanceTesting.Customization.Conventions; - - public class When_timeout_dispatch_fails : NServiceBusAcceptanceTest - { - [Test] - public Task Should_retry_and_move_to_error() - { - return Scenario.Define() - .WithEndpoint(b => - b.DoNotFailOnErrorMessages() - .When((bus, c) => - { - var options = new SendOptions(); - options.DelayDeliveryWith(VeryLongTimeSpan); - options.RouteToThisEndpoint(); - options.SetMessageId(c.TestRunId.ToString()); - - return bus.Send(new MyMessage(), options); - })) - .Done(c => c.FailedTimeoutMovedToError) - .Repeat(r => r.For()) - .Should(c => - { - Assert.IsFalse(c.DelayedMessageDeliveredToHandler, "Message was unexpectedly delivered to the handler"); - Assert.IsTrue(c.FailedTimeoutMovedToError, "Message should have been moved to the error queue"); - }) - .Run(); - } - - static readonly TimeSpan VeryLongTimeSpan = TimeSpan.FromMinutes(10); - public class Context : ScenarioContext - { - public bool FailedTimeoutMovedToError { get; set; } - public bool DelayedMessageDeliveredToHandler { get; set; } - } - - public class Endpoint : EndpointConfigurationBuilder - { - public Endpoint() - { - EndpointSetup(config => - { - config.EnableFeature(); - config.UsePersistence(); - config.SendFailedMessagesTo(Conventions.EndpointNamingConvention(typeof(Endpoint))); - config.RegisterComponents(c => c.ConfigureComponent(DependencyLifecycle.SingleInstance)); - config.Pipeline.Register(); - }); - } - - class Handler : IHandleMessages - { - public Context TestContext { get; set; } - - public Task Handle(MyMessage message, IMessageHandlerContext context) - { - TestContext.DelayedMessageDeliveredToHandler = true; - return Task.FromResult(0); - } - } - - class FakeTimeoutPersistence : PersistenceDefinition - { - public FakeTimeoutPersistence() - { - Supports(s => { }); - } - } - - class FakeTimeoutStorage : IQueryTimeouts, IPersistTimeouts - { - public Context TestContext { get; set; } - - public Task Add(TimeoutData timeout, ContextBag context) - { - if (TestContext.TestRunId.ToString() == timeout.Headers[Headers.MessageId]) - { - timeout.Id = TestContext.TestRunId.ToString(); - timeout.Time = DateTime.UtcNow; - - timeoutData = timeout; - } - - return Task.FromResult(0); - } - - public Task TryRemove(string timeoutId, ContextBag context) - { - throw new NotImplementedException(); - } - - public Task Peek(string timeoutId, ContextBag context) - { - if (timeoutId != TestContext.TestRunId.ToString()) - { - throw new ArgumentException("The timeoutId is different from one registered in the test context", "timeoutId"); - } - - throw new Exception("Ooops. Timeout storage went bust"); - } - - public Task RemoveTimeoutBy(Guid sagaId, ContextBag context) - { - throw new NotImplementedException(); - } - - public Task GetNextChunk(DateTime startSlice) - { - var timeouts = timeoutData != null - ? new[] - { - new TimeoutsChunk.Timeout(timeoutData.Id, timeoutData.Time) - } - : new TimeoutsChunk.Timeout[0]; - - return Task.FromResult(new TimeoutsChunk(timeouts, DateTime.UtcNow + TimeSpan.FromSeconds(10))); - } - - TimeoutData timeoutData; - } - - class BehaviorThatLogsControlMessageDelivery : IBehavior - { - public Context TestContext { get; set; } - - public Task Invoke(ITransportReceiveContext context, Func next) - { - if (context.Message.Headers.ContainsKey(Headers.ControlMessageHeader) && - context.Message.Headers["Timeout.Id"] == TestContext.TestRunId.ToString()) - { - TestContext.FailedTimeoutMovedToError = true; - return Task.FromResult(0); - } - - return next(context); - } - - public class Registration : RegisterStep - { - public Registration() : base("BehaviorThatLogsControlMessageDelivery", typeof(BehaviorThatLogsControlMessageDelivery), "BehaviorThatLogsControlMessageDelivery") - { - } - } - } - } - - public class MyMessage : IMessage - { - } - } -} \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DelayedDelivery/TimeoutManager/When_timeout_dispatch_fails_on_timeout_data_removal.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DelayedDelivery/TimeoutManager/When_timeout_dispatch_fails_on_timeout_data_removal.cs deleted file mode 100644 index 5118b49b7..000000000 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DelayedDelivery/TimeoutManager/When_timeout_dispatch_fails_on_timeout_data_removal.cs +++ /dev/null @@ -1,168 +0,0 @@ -namespace NServiceBus.AcceptanceTests.DelayedDelivery -{ - using System; - using System.Threading.Tasks; - using AcceptanceTesting; - using EndpointTemplates; - using Extensibility; - using Features; - using NServiceBus; - using NServiceBus.Pipeline; - using NUnit.Framework; - using Persistence; - using ScenarioDescriptors; - using Timeout.Core; - using Conventions = AcceptanceTesting.Customization.Conventions; - - public class When_timeout_dispatch_fails_on_timeout_data_removal : NServiceBusAcceptanceTest - { - [Test] - public Task Should_move_control_message_to_errors_and_not_dispatch_original_message_to_handler() - { - return Scenario.Define() - .WithEndpoint(b => b.DoNotFailOnErrorMessages() - .When((bus, c) => - { - var options = new SendOptions(); - options.DelayDeliveryWith(TimeSpan.FromMinutes(1)); - options.RouteToThisEndpoint(); - options.SetMessageId(c.TestRunId.ToString()); - - return bus.Send(new MyMessage - { - Id = c.TestRunId - }, options); - })) - .Done(c => c.FailedTimeoutMovedToError) - .Repeat(r => r.For()) - .Should(c => Assert.IsFalse(c.DelayedMessageDeliveredToHandler, "Message was unexpectedly delivered to the handler")) - .Run(); - } - - public class Context : ScenarioContext - { - public bool FailedTimeoutMovedToError { get; set; } - public bool DelayedMessageDeliveredToHandler { get; set; } - } - - public class Endpoint : EndpointConfigurationBuilder - { - public Endpoint() - { - EndpointSetup(config => - { - config.EnableFeature(); - config.UsePersistence(); - config.SendFailedMessagesTo(Conventions.EndpointNamingConvention(typeof(Endpoint))); - config.RegisterComponents(c => c.ConfigureComponent(DependencyLifecycle.SingleInstance)); - config.Pipeline.Register(); - config.LimitMessageProcessingConcurrencyTo(1); - }); - } - - class Handler : IHandleMessages - { - public Context TestContext { get; set; } - - public Task Handle(MyMessage message, IMessageHandlerContext context) - { - if (message.Id == TestContext.TestRunId) - { - TestContext.DelayedMessageDeliveredToHandler = true; - } - - return Task.FromResult(0); - } - } - - class FakeTimeoutPersistence : PersistenceDefinition - { - public FakeTimeoutPersistence() - { - Supports(s => { }); - } - } - - class FakeTimeoutStorage : IQueryTimeouts, IPersistTimeouts - { - public Context TestContext { get; set; } - - public Task Add(TimeoutData timeout, ContextBag context) - { - if (TestContext.TestRunId.ToString() == timeout.Headers[Headers.MessageId]) - { - timeout.Id = TestContext.TestRunId.ToString(); - timeout.Time = DateTime.UtcNow; - - timeoutData = timeout; - } - - return Task.FromResult(0); - } - - public Task TryRemove(string timeoutId, ContextBag context) - { - throw new Exception("Simulated exception on removing timeout data."); - } - - public Task Peek(string timeoutId, ContextBag context) - { - if (timeoutId == TestContext.TestRunId.ToString() && timeoutData != null) - { - return Task.FromResult(timeoutData); - } - - return Task.FromResult((TimeoutData) null); - } - - public Task RemoveTimeoutBy(Guid sagaId, ContextBag context) - { - throw new NotImplementedException(); - } - - public Task GetNextChunk(DateTime startSlice) - { - var timeouts = timeoutData != null - ? new[] - { - new TimeoutsChunk.Timeout(timeoutData.Id, timeoutData.Time) - } - : new TimeoutsChunk.Timeout[0]; - - return Task.FromResult(new TimeoutsChunk(timeouts, DateTime.UtcNow + TimeSpan.FromSeconds(10))); - } - - TimeoutData timeoutData; - } - - class BehaviorThatLogsControlMessageDelivery : IBehavior - { - public Context TestContext { get; set; } - - public Task Invoke(ITransportReceiveContext context, Func next) - { - if (context.Message.Headers.ContainsKey(Headers.ControlMessageHeader) && - context.Message.Headers["Timeout.Id"] == TestContext.TestRunId.ToString()) - { - TestContext.FailedTimeoutMovedToError = true; - return Task.FromResult(0); - } - - return next(context); - } - - public class Registration : RegisterStep - { - public Registration() : base("BehaviorThatLogsControlMessageDelivery", typeof(BehaviorThatLogsControlMessageDelivery), "BehaviorThatLogsControlMessageDelivery") - { - } - } - } - } - - public class MyMessage : IMessage - { - public Guid Id { get; set; } - } - } -} \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DelayedDelivery/TimeoutManager/When_timeout_storage_fails.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DelayedDelivery/TimeoutManager/When_timeout_storage_fails.cs deleted file mode 100644 index 192b42e38..000000000 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DelayedDelivery/TimeoutManager/When_timeout_storage_fails.cs +++ /dev/null @@ -1,130 +0,0 @@ -namespace NServiceBus.AcceptanceTests.DelayedDelivery -{ - using System; - using System.Threading.Tasks; - using AcceptanceTesting; - using EndpointTemplates; - using Extensibility; - using Features; - using NServiceBus; - using NUnit.Framework; - using Persistence; - using ScenarioDescriptors; - using Timeout.Core; - - public class When_timeout_storage_fails : NServiceBusAcceptanceTest - { - [Test] - public Task Should_retry_and_move_to_error() - { - return Scenario.Define() - .WithEndpoint(b => b.DoNotFailOnErrorMessages() - .When((bus, c) => - { - var options = new SendOptions(); - - options.DelayDeliveryWith(TimeSpan.FromDays(30)); - - options.RouteToThisEndpoint(); - - return bus.Send(new MyMessage(), options); - })) - .WithEndpoint() - .Done(c => c.FailedTimeoutMovedToError) - .Repeat(r => r.For()) - .Should(c => Assert.AreEqual(5, c.NumTimesStorageCalled)) - .Run(); - } - - const string ErrorQueueForTimeoutErrors = "timeout_store_errors"; - - public class Context : ScenarioContext - { - public bool FailedTimeoutMovedToError { get; set; } - public int NumTimesStorageCalled { get; set; } - } - - public class Endpoint : EndpointConfigurationBuilder - { - public Endpoint() - { - EndpointSetup(config => - { - config.EnableFeature(); - config.UsePersistence(); - config.SendFailedMessagesTo(ErrorQueueForTimeoutErrors); - config.RegisterComponents(c => c.ConfigureComponent(DependencyLifecycle.SingleInstance)); - }); - } - - public class FakeTimeoutPersistence : PersistenceDefinition - { - public FakeTimeoutPersistence() - { - Supports(s => { }); - } - } - - public class FakeTimeoutStorage : IQueryTimeouts, IPersistTimeouts - { - public FakeTimeoutStorage(Context context) - { - testContext = context; - } - - public Task Add(TimeoutData timeout, ContextBag context) - { - testContext.NumTimesStorageCalled++; - - throw new Exception("Simulated exception on storing timeout."); - } - - public Task TryRemove(string timeoutId, ContextBag context) - { - throw new NotImplementedException(); - } - - public Task Peek(string timeoutId, ContextBag context) - { - throw new NotImplementedException(); - } - - public Task RemoveTimeoutBy(Guid sagaId, ContextBag context) - { - throw new NotImplementedException(); - } - - public Task GetNextChunk(DateTime startSlice) - { - return Task.FromResult(new TimeoutsChunk(new TimeoutsChunk.Timeout[0], DateTime.UtcNow + TimeSpan.FromSeconds(10))); - } - - Context testContext; - } - } - - public class ErrorSpy : EndpointConfigurationBuilder - { - public ErrorSpy() - { - EndpointSetup() - .CustomEndpointName(ErrorQueueForTimeoutErrors); - } - - class Handler : IHandleMessages - { - public Context MyContext { get; set; } - - public Task Handle(MyMessage message, IMessageHandlerContext context) - { - MyContext.FailedTimeoutMovedToError = true; - return Task.FromResult(0); - } - } - } - - public class MyMessage : IMessage - { - } - } -} \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DelayedDelivery/TimeoutManager/When_using_external_timeout_manager.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DelayedDelivery/TimeoutManager/When_using_external_timeout_manager.cs deleted file mode 100644 index 7a5b77203..000000000 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DelayedDelivery/TimeoutManager/When_using_external_timeout_manager.cs +++ /dev/null @@ -1,76 +0,0 @@ -namespace NServiceBus.AcceptanceTests.DelayedDelivery -{ - using System; - using System.Threading.Tasks; - using AcceptanceTesting; - using AcceptanceTesting.Customization; - using EndpointTemplates; - using Features; - using NServiceBus.Config; - using NUnit.Framework; - using ScenarioDescriptors; - - public class When_using_external_timeout_manager : NServiceBusAcceptanceTest - { - [Test] - public async Task Should_delay_delivery() - { - await Scenario.Define() - .WithEndpoint() - .WithEndpoint(b => b.When((session, c) => - { - var options = new SendOptions(); - - options.DelayDeliveryWith(TimeSpan.FromMilliseconds(2000)); - options.RouteToThisEndpoint(); - - return session.Send(new MyMessage(), options); - })) - .Done(c => c.WasCalled) - .Repeat(r => r.For()) - .Should(c => { Assert.IsTrue(c.TimeoutManagerHeaderDetected); }) - .Run(); - } - - public class Context : ScenarioContext - { - public bool TimeoutManagerHeaderDetected { get; set; } - public bool WasCalled { get; set; } - } - - public class Endpoint : EndpointConfigurationBuilder - { - public Endpoint() - { - var address = Conventions.EndpointNamingConvention(typeof(EndpointWithTimeoutManager)) + ".Timeouts"; - - EndpointSetup(config => config.DisableFeature()) - .WithConfig(c => { c.TimeoutManagerAddress = address; }); - } - - public class MyMessageHandler : IHandleMessages - { - public Context Context { get; set; } - - public Task Handle(MyMessage message, IMessageHandlerContext context) - { - Context.TimeoutManagerHeaderDetected = context.MessageHeaders.ContainsKey("NServiceBus.Timeout.Expire"); - Context.WasCalled = true; - return Task.FromResult(0); - } - } - } - - public class EndpointWithTimeoutManager : EndpointConfigurationBuilder - { - public EndpointWithTimeoutManager() - { - EndpointSetup(config => config.EnableFeature()); - } - } - - public class MyMessage : IMessage - { - } - } -} diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/MessageDrivenPubSubRoutingExtensions.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/MessageDrivenPubSubRoutingExtensions.cs deleted file mode 100644 index 26eb4e0f2..000000000 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/MessageDrivenPubSubRoutingExtensions.cs +++ /dev/null @@ -1,25 +0,0 @@ -namespace NServiceBus.AcceptanceTests.Routing -{ - using Configuration.AdvanceExtensibility; - using NServiceBus.Routing; - using Settings; - using Transport; - - public static class MessageDrivenPubSubRoutingExtensions - { - public static RoutingSettings MessageDrivenPubSubRouting(this EndpointConfiguration endpointConfiguration) - { - return new RoutingSettings(endpointConfiguration.GetSettings()); - } - - public class MessageDrivenPubSubTransportDefinition : TransportDefinition, IMessageDrivenSubscriptionTransport - { - public override string ExampleConnectionStringForErrorMessage { get; } - - public override TransportInfrastructure Initialize(SettingsHolder settings, string connectionString) - { - throw new System.NotImplementedException(); - } - } - } -} \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ApiExtension/When_extending_sendoptions.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ApiExtension/When_extending_sendoptions.cs similarity index 99% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ApiExtension/When_extending_sendoptions.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ApiExtension/When_extending_sendoptions.cs index 0ce0fc1c4..e61ef1e83 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ApiExtension/When_extending_sendoptions.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ApiExtension/When_extending_sendoptions.cs @@ -80,7 +80,7 @@ public class Context } } - [Serializable] + public class SendMessage : ICommand { public string Secret { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ApiExtension/When_extending_the_publish_api.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ApiExtension/When_extending_the_publish_api.cs similarity index 95% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ApiExtension/When_extending_the_publish_api.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ApiExtension/When_extending_the_publish_api.cs index 575af173d..3d3099389 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ApiExtension/When_extending_the_publish_api.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ApiExtension/When_extending_the_publish_api.cs @@ -92,8 +92,7 @@ public class Subscriber1 : EndpointConfigurationBuilder { public Subscriber1() { - EndpointSetup(builder => { builder.DisableFeature(); }) - .AddMapping(typeof(Publisher)); + EndpointSetup(builder => builder.DisableFeature(), metadata => metadata.RegisterPublisherFor(typeof(Publisher))); } public class MyEventHandler : IHandleMessages @@ -108,7 +107,6 @@ public Task Handle(MyEvent messageThatIsEnlisted, IMessageHandlerContext context } } - [Serializable] public class MyEvent : IEvent { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Audit/When_a_message_is_audited.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Audit/When_a_message_is_audited.cs similarity index 99% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Audit/When_a_message_is_audited.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Audit/When_a_message_is_audited.cs index 1d61d11cf..7ffc6d5e8 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Audit/When_a_message_is_audited.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Audit/When_a_message_is_audited.cs @@ -124,7 +124,7 @@ public Task Handle(MessageToBeAudited message, IMessageHandlerContext context) } } - [Serializable] + public class MessageToBeAudited : IMessage { public Guid RunId { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Audit/When_a_replymessage_is_audited.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Audit/When_a_replymessage_is_audited.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Audit/When_a_replymessage_is_audited.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Audit/When_a_replymessage_is_audited.cs index 7fcb5108f..8c565d8aa 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Audit/When_a_replymessage_is_audited.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Audit/When_a_replymessage_is_audited.cs @@ -1,6 +1,5 @@ namespace NServiceBus.AcceptanceTests.Audit { - using System; using System.Linq; using System.Threading.Tasks; using AcceptanceTesting; @@ -111,12 +110,11 @@ public Task Handle(ResponseToBeAudited message, IMessageHandlerContext context) } } - [Serializable] public class ResponseToBeAudited : IMessage { } - class Request : IMessage + public class Request : IMessage { } } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Audit/When_audit_is_overridden_in_code.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Audit/When_audit_is_overridden_in_code.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Audit/When_audit_is_overridden_in_code.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Audit/When_audit_is_overridden_in_code.cs index a81673c59..1e7a3dbf6 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Audit/When_audit_is_overridden_in_code.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Audit/When_audit_is_overridden_in_code.cs @@ -1,6 +1,5 @@ namespace NServiceBus.AcceptanceTests.Audit { - using System; using System.Threading.Tasks; using AcceptanceTesting; using EndpointTemplates; @@ -61,7 +60,7 @@ public class Context : ScenarioContext public bool MessageAudited { get; set; } } - [Serializable] + public class MessageToBeAudited : IMessage { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Audit/When_auditing.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Audit/When_auditing.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Audit/When_auditing.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Audit/When_auditing.cs index e8dcd527f..de75f0d21 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Audit/When_auditing.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Audit/When_auditing.cs @@ -1,6 +1,5 @@ namespace NServiceBus.AcceptanceTests.Audit { - using System; using System.Threading.Tasks; using AcceptanceTesting; using EndpointTemplates; @@ -101,7 +100,7 @@ public Task Handle(MessageToBeAudited message, IMessageHandlerContext context) } } - [Serializable] + public class MessageToBeAudited : IMessage { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Audit/When_auditing_message_with_TimeToBeReceived.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Audit/When_auditing_message_with_TimeToBeReceived.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Audit/When_auditing_message_with_TimeToBeReceived.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Audit/When_auditing_message_with_TimeToBeReceived.cs index 405e7f5ca..77f73f58e 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Audit/When_auditing_message_with_TimeToBeReceived.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Audit/When_auditing_message_with_TimeToBeReceived.cs @@ -94,9 +94,8 @@ public Task Handle(MessageToBeAudited message, IMessageHandlerContext context) } } - [Serializable] [TimeToBeReceived("00:00:03")] - class MessageToBeAudited : IMessage + public class MessageToBeAudited : IMessage { } } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Basic/When_aborting_the_behavior_chain.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Basic/When_aborting_the_behavior_chain.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Basic/When_aborting_the_behavior_chain.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Basic/When_aborting_the_behavior_chain.cs index 4ea49e70e..8b9600a97 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Basic/When_aborting_the_behavior_chain.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Basic/When_aborting_the_behavior_chain.cs @@ -1,6 +1,5 @@ namespace NServiceBus.AcceptanceTests.Basic { - using System; using System.Threading.Tasks; using AcceptanceTesting; using EndpointTemplates; @@ -26,7 +25,6 @@ public class Context : ScenarioContext public bool SecondHandlerInvoked { get; set; } } - [Serializable] public class SomeMessage : IMessage { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Basic/When_deferring_to_non_local.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Basic/When_deferring_to_non_local.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Basic/When_deferring_to_non_local.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Basic/When_deferring_to_non_local.cs index 0ef08034b..790bb6dad 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Basic/When_deferring_to_non_local.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Basic/When_deferring_to_non_local.cs @@ -60,7 +60,7 @@ public Task Handle(MyMessage message, IMessageHandlerContext context) } } - [Serializable] + public class MyMessage : ICommand { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Basic/When_depending_on_typed_feature.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Basic/When_depending_on_typed_feature.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Basic/When_depending_on_typed_feature.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Basic/When_depending_on_typed_feature.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Basic/When_depending_on_untyped_feature.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Basic/When_depending_on_untyped_feature.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Basic/When_depending_on_untyped_feature.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Basic/When_depending_on_untyped_feature.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Basic/When_extending_behavior_context.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Basic/When_extending_behavior_context.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Basic/When_extending_behavior_context.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Basic/When_extending_behavior_context.cs index 03f557d9a..b567f548d 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Basic/When_extending_behavior_context.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Basic/When_extending_behavior_context.cs @@ -78,7 +78,7 @@ public Task Invoke(IIncomingLogicalMessageContext context, Func() + return Scenario.Define() .WithEndpoint(b => b.When((session, c) => { var publishOptions = new PublishOptions(); @@ -19,9 +20,14 @@ public async Task Should_allow_publishing_commands() return session.Publish(new MyCommand(), publishOptions); })) .Done(c => c.EndpointsStarted) + // This test is only relevant for message driven transports since we need to use the mappings to + // configure the publisher. The code first API would blow up unless we turn off the checks for the entire endpoint. + // But if we do that turning off checks per message becomes pointless since they are already off. + // We would need a new api to turn off startup checks only for this to be testable across the board. + .Repeat(r => r.For()) + .Should(c => Assert.True(c.EndpointsStarted)) .Run(); - Assert.True(context.EndpointsStarted); } public class Endpoint : EndpointConfigurationBuilder @@ -29,30 +35,20 @@ public class Endpoint : EndpointConfigurationBuilder public Endpoint() { EndpointSetup() - .AddMapping(typeof(Endpoint)) - .AddMapping(typeof(Endpoint)); + .AddMapping(typeof(Endpoint)); } - public class Handler : IHandleMessages, IHandleMessages + public class Handler : IHandleMessages { public Task Handle(MyCommand message, IMessageHandlerContext context) { return Task.FromResult(0); } - - public Task Handle(MyEvent message, IMessageHandlerContext context) - { - return Task.FromResult(0); - } } } public class MyCommand : ICommand { } - - public class MyEvent : IEvent - { - } } } \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/BestPractices/When_publishing_command_bestpractices_disabled_on_endpoint.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/BestPractices/When_publishing_command_bestpractices_disabled_on_endpoint.cs similarity index 52% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/BestPractices/When_publishing_command_bestpractices_disabled_on_endpoint.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/BestPractices/When_publishing_command_bestpractices_disabled_on_endpoint.cs index e32ec4385..aab5ff17a 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/BestPractices/When_publishing_command_bestpractices_disabled_on_endpoint.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/BestPractices/When_publishing_command_bestpractices_disabled_on_endpoint.cs @@ -4,6 +4,7 @@ using AcceptanceTesting; using EndpointTemplates; using NUnit.Framework; + using ScenarioDescriptors; public class When_publishing_command_bestpractices_disabled_on_endpoint : NServiceBusAcceptanceTest { @@ -13,51 +14,39 @@ public Task Should_allow_publishing_commands() return Scenario.Define() .WithEndpoint(b => b.When((session, c) => session.Publish(new MyCommand()))) .Done(c => c.EndpointsStarted) + // This test is only relevant for message driven transports since we need to use the mappings to + // configure the publisher. The code first API would blow up unless we turn off the checks for the entire endpoint. + // But if we do that turning off checks per message becomes pointless since they are already off. + // We would need a new api to turn off startup checks only for this to be testable across the board. + .Repeat(r => r.For()) + .Should(c => Assert.True(c.EndpointsStarted)) .Run(); } - [Test] - public Task Should_allow_sending_events() - { - return Scenario.Define() - .WithEndpoint(b => b.When((session, c) => session.Send(new MyEvent()))) - .Done(c => c.EndpointsStarted) - .Run(); - } public class Endpoint : EndpointConfigurationBuilder { public Endpoint() { EndpointSetup((c, r) => - { - var routing = c.UseTransport(r.GetTransportType()).Routing(); - routing.DoNotEnforceBestPractices(); - }) - .AddMapping(typeof(Endpoint)) - .AddMapping(typeof(Endpoint)); + { + var routing = c.UseTransport(r.GetTransportType()).Routing(); + routing.DoNotEnforceBestPractices(); + }) + .AddMapping(typeof(Endpoint)); } - public class Handler : IHandleMessages, IHandleMessages + public class Handler : IHandleMessages { public Task Handle(MyCommand message, IMessageHandlerContext context) { return Task.FromResult(0); } - - public Task Handle(MyEvent message, IMessageHandlerContext context) - { - return Task.FromResult(0); - } } } public class MyCommand : ICommand { } - - public class MyEvent : IEvent - { - } } } \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/BestPractices/When_sending_event.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/BestPractices/When_sending_event.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/BestPractices/When_sending_event.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/BestPractices/When_sending_event.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/BestPractices/When_sending_events_bestpractices_disabled.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/BestPractices/When_sending_events_bestpractices_disabled.cs similarity index 92% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/BestPractices/When_sending_events_bestpractices_disabled.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/BestPractices/When_sending_events_bestpractices_disabled.cs index 3b026d4ae..f020281db 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/BestPractices/When_sending_events_bestpractices_disabled.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/BestPractices/When_sending_events_bestpractices_disabled.cs @@ -30,8 +30,8 @@ public class Endpoint : EndpointConfigurationBuilder public Endpoint() { EndpointSetup() - .AddMapping(typeof(Endpoint)) - .AddMapping(typeof(Endpoint)); + .AddMapping(typeof(Endpoint)) + .AddMapping(typeof(Endpoint)); } public class Handler : IHandleMessages diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/BestPractices/When_sending_events_bestpractices_disabled_on_endpoint.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/BestPractices/When_sending_events_bestpractices_disabled_on_endpoint.cs similarity index 79% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/BestPractices/When_sending_events_bestpractices_disabled_on_endpoint.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/BestPractices/When_sending_events_bestpractices_disabled_on_endpoint.cs index d997755dd..c4d383cdc 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/BestPractices/When_sending_events_bestpractices_disabled_on_endpoint.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/BestPractices/When_sending_events_bestpractices_disabled_on_endpoint.cs @@ -21,11 +21,10 @@ public class Endpoint : EndpointConfigurationBuilder public Endpoint() { EndpointSetup((c, r) => - { - var routing = c.UseTransport(r.GetTransportType()).Routing(); - routing.DoNotEnforceBestPractices(); - }) - .AddMapping(typeof(Endpoint)) + { + var routing = c.UseTransport(r.GetTransportType()).Routing(); + routing.DoNotEnforceBestPractices(); + }) .AddMapping(typeof(Endpoint)); } @@ -38,10 +37,6 @@ public Task Handle(MyEvent message, IMessageHandlerContext context) } } - public class MyCommand : ICommand - { - } - public class MyEvent : IEvent { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/BestPractices/When_subscribing_to_command.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/BestPractices/When_subscribing_to_command.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/BestPractices/When_subscribing_to_command.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/BestPractices/When_subscribing_to_command.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/BestPractices/When_subscribing_to_command_bestpractices_disabled_on_endpoint.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/BestPractices/When_subscribing_to_command_bestpractices_disabled_on_endpoint.cs new file mode 100644 index 000000000..9af58995c --- /dev/null +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/BestPractices/When_subscribing_to_command_bestpractices_disabled_on_endpoint.cs @@ -0,0 +1,43 @@ +namespace NServiceBus.AcceptanceTests.BestPractices +{ + using System.Threading.Tasks; + using AcceptanceTesting; + using EndpointTemplates; + using NUnit.Framework; + using ScenarioDescriptors; + + public class When_subscribing_to_command_bestpractices_disabled_on_endpoint : NServiceBusAcceptanceTest + { + [Test] + public Task Should_allow_subscribing_to_commands() + { + return Scenario.Define() + .WithEndpoint(b => b.When((session, c) => session.Subscribe())) + .Done(c => c.EndpointsStarted) + // This test is only relevant for message driven transports since we need to use the mappings to + // configure the publisher. The code first API would blow up unless we turn off the checks for the entire endpoint. + // But if we do that turning off checks per message becomes pointless since they are already off. + // We would need a new api to turn off startup checks only for this to be testable across the board. + .Repeat(r => r.For()) + .Should(c => Assert.True(c.EndpointsStarted)) + .Run(); + } + + public class Endpoint : EndpointConfigurationBuilder + { + public Endpoint() + { + EndpointSetup((c, r) => + { + var routing = c.UseTransport(r.GetTransportType()).Routing(); + routing.DoNotEnforceBestPractices(); + }) + .AddMapping(typeof(Endpoint)); + } + } + + public class MyCommand : ICommand + { + } + } +} \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/BestPractices/When_unsubscribing_to_command.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/BestPractices/When_unsubscribing_to_command.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/BestPractices/When_unsubscribing_to_command.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/BestPractices/When_unsubscribing_to_command.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/BestPractices/When_unsubscribing_to_command_bestpractices_disabled_on_endpoint.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/BestPractices/When_unsubscribing_to_command_bestpractices_disabled_on_endpoint.cs new file mode 100644 index 000000000..eb3e32416 --- /dev/null +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/BestPractices/When_unsubscribing_to_command_bestpractices_disabled_on_endpoint.cs @@ -0,0 +1,42 @@ +namespace NServiceBus.AcceptanceTests.BestPractices +{ + using System.Threading.Tasks; + using AcceptanceTesting; + using EndpointTemplates; + using NUnit.Framework; + using ScenarioDescriptors; + + public class When_unsubscribing_to_command_bestpractices_disabled_on_endpoint : NServiceBusAcceptanceTest + { + [Test] + public Task Should_allow_unsubscribing_to_commands() + { + return Scenario.Define() + .WithEndpoint(b => b.When((session, c) => session.Unsubscribe())) + .Done(c => c.EndpointsStarted) + // This test is only relevant for message driven transports since we need to use the mappings to + // configure the publisher. The code first API would blow up unless we turn off the checks for the entire endpoint. + // But if we do that turning off checks per message becomes pointless since they are already off. + // We would need a new api to turn off startup checks only for this to be testable across the board. + .Repeat(r => r.For()) + .Should(c => Assert.True(c.EndpointsStarted)).Run(); + } + + public class Endpoint : EndpointConfigurationBuilder + { + public Endpoint() + { + EndpointSetup((c, r) => + { + var routing = c.UseTransport(r.GetTransportType()).Routing(); + routing.DoNotEnforceBestPractices(); + }) + .AddMapping(typeof(Endpoint)); + } + } + + public class MyCommand : ICommand + { + } + } +} \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Causation/When_a_message_is_audited.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Causation/When_a_message_is_audited.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Causation/When_a_message_is_audited.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Causation/When_a_message_is_audited.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Causation/When_a_message_is_faulted.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Causation/When_a_message_is_faulted.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Causation/When_a_message_is_faulted.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Causation/When_a_message_is_faulted.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Causation/When_a_message_is_sent.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Causation/When_a_message_is_sent.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Causation/When_a_message_is_sent.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Causation/When_a_message_is_sent.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Config/When_injecting_message_session_into_handlers.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Config/When_injecting_message_session_into_handlers.cs similarity index 88% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Config/When_injecting_message_session_into_handlers.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Config/When_injecting_message_session_into_handlers.cs index 8f5ac5212..5729fcf3c 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Config/When_injecting_message_session_into_handlers.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Config/When_injecting_message_session_into_handlers.cs @@ -11,7 +11,7 @@ public class When_injecting_message_session_into_handlers : NServiceBusAcceptanc [Test] public void Should_throw_on_startup() { - var exception = Assert.ThrowsAsync(async () => await Scenario.Define() + var exception = Assert.ThrowsAsync(async () => await Scenario.Define() .WithEndpoint() .Done(c => c.EndpointsStarted) .Run()); @@ -38,7 +38,7 @@ public Task Handle(MyMessage message, IMessageHandlerContext context) } } - class MyMessage : IMessage + public class MyMessage : IMessage { } } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Config/When_multiple_configuration_providers.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Config/When_multiple_configuration_providers.cs new file mode 100644 index 000000000..285525585 --- /dev/null +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Config/When_multiple_configuration_providers.cs @@ -0,0 +1,60 @@ +namespace NServiceBus.AcceptanceTests.Config +{ + using System; + using AcceptanceTesting; + using EndpointTemplates; + using Features; + using NServiceBus.Config.ConfigurationSource; + using NUnit.Framework; + + public class When_multiple_configuration_providers : NServiceBusAcceptanceTest + { + [Test] + public void Should_throw_at_startup() + { + var exception = Assert.ThrowsAsync(() => Scenario.Define() + .WithEndpoint() + .Done(c => c.EndpointsStarted) + .Run()); + + Assert.That(exception?.Message, Does.Contain("Multiple configuration providers implementing IProvideConfiguration were found")); + } + + class Endpoint : EndpointConfigurationBuilder + { + public Endpoint() + { + EndpointSetup(e => e + .EnableFeature()); + } + } + + class CustomFeature : Feature + { + protected override void Setup(FeatureConfigurationContext context) + { + context.Settings.GetConfigSection(); + } + } + + public class ConfigProvider1 : IProvideConfiguration + { + public CustomConfigSection GetConfiguration() + { + return new CustomConfigSection(); + } + } + + public class ConfigProvider2 : IProvideConfiguration + { + public CustomConfigSection GetConfiguration() + { + return new CustomConfigSection(); + } + } + + public class CustomConfigSection + { + } + } +} \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Config/When_only_abstract_config_override_is_found.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Config/When_only_abstract_config_override_is_found.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Config/When_only_abstract_config_override_is_found.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Config/When_only_abstract_config_override_is_found.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Config/When_startup_is_complete.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Config/When_startup_is_complete.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Config/When_startup_is_complete.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Config/When_startup_is_complete.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ConfigureEndpointInMemoryPersistence.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ConfigureEndpointInMemoryPersistence.cs similarity index 85% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ConfigureEndpointInMemoryPersistence.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ConfigureEndpointInMemoryPersistence.cs index ae6bd93d3..53978e8e3 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ConfigureEndpointInMemoryPersistence.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ConfigureEndpointInMemoryPersistence.cs @@ -4,7 +4,7 @@ public class ConfigureEndpointInMemoryPersistence : IConfigureEndpointTestExecution { - public Task Configure(string endpointName, EndpointConfiguration configuration, RunSettings settings) + public Task Configure(string endpointName, EndpointConfiguration configuration, RunSettings settings, PublisherMetadata publisherMetadata) { configuration.UsePersistence(); return Task.FromResult(0); diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ConfigureEndpointMsmqTransport.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ConfigureEndpointMsmqTransport.cs similarity index 81% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ConfigureEndpointMsmqTransport.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ConfigureEndpointMsmqTransport.cs index 352f567e5..1ce769c17 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ConfigureEndpointMsmqTransport.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ConfigureEndpointMsmqTransport.cs @@ -19,11 +19,24 @@ public class ConfigureScenariosForMsmqTransport : IConfigureSupportedScenariosFo public class ConfigureEndpointMsmqTransport : IConfigureEndpointTestExecution { - public Task Configure(string endpointName, EndpointConfiguration configuration, RunSettings settings) + public Task Configure(string endpointName, EndpointConfiguration configuration, RunSettings settings, PublisherMetadata publisherMetadata) { queueBindings = configuration.GetSettings().Get(); var connectionString = settings.Get("Transport.ConnectionString"); - configuration.UseTransport().ConnectionString(connectionString); + var transportConfig = configuration.UseTransport(); + + transportConfig.ConnectionString(connectionString); + + var routingConfig = transportConfig.Routing(); + + foreach (var publisher in publisherMetadata.Publishers) + { + foreach (var eventType in publisher.Events) + { + routingConfig.RegisterPublisher(eventType, publisher.PublisherName); + } + } + return Task.FromResult(0); } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ConventionEnforcementTests.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ConventionEnforcementTests.cs new file mode 100644 index 000000000..ea28ad893 --- /dev/null +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ConventionEnforcementTests.cs @@ -0,0 +1,59 @@ +namespace NServiceBus.AcceptanceTests +{ + using System; + using System.Linq; + using System.Reflection; + using NUnit.Framework; + + [TestFixture] + public class ConventionEnforcementTests : NServiceBusAcceptanceTest + { + [Test] + public void Ensure_all_tests_derive_from_a_common_base_class() + { + var testTypes = Assembly.GetExecutingAssembly().GetTypes() + .Where(HasTestMethod); + + var missingBaseClass = testTypes + .Where(t => t.BaseType == null || !typeof(NServiceBusAcceptanceTest).IsAssignableFrom(t)) + .ToList(); + + CollectionAssert.IsEmpty(missingBaseClass, string.Join(",", missingBaseClass)); + } + + [Test] + public void Ensure_all_messages_are_public() + { + var testTypes = Assembly.GetExecutingAssembly().GetTypes(); + + var missingBaseClass = testTypes + .Where(t => !t.IsPublic && !t.IsNestedPublic) + .Where(t => + typeof(ICommand).IsAssignableFrom(t) || + typeof(IMessage).IsAssignableFrom(t) || + typeof(IEvent).IsAssignableFrom(t) + ) + .ToList(); + + CollectionAssert.IsEmpty(missingBaseClass, string.Join(",", missingBaseClass)); + } + + [Test] + public void Ensure_all_sagadatas_are_public() + { + var testTypes = Assembly.GetExecutingAssembly().GetTypes(); + + var sagaDatas = testTypes + .Where(t => !t.IsPublic && !t.IsNestedPublic) + .Where(t => typeof(IContainSagaData).IsAssignableFrom(t)) + .ToList(); + + CollectionAssert.IsEmpty(sagaDatas, string.Join(",", sagaDatas)); + } + + static bool HasTestMethod(Type t) + { + return t.GetMethods().Any(m => m.GetCustomAttributes().Any()); + } + } +} \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Correlation/When_replying_to_received_message_without_correlationid.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Correlation/When_replying_to_received_message_without_correlationid.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Correlation/When_replying_to_received_message_without_correlationid.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Correlation/When_replying_to_received_message_without_correlationid.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Correlation/When_sending_with_no_correlation_id.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Correlation/When_sending_with_no_correlation_id.cs similarity index 97% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Correlation/When_sending_with_no_correlation_id.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Correlation/When_sending_with_no_correlation_id.cs index 5632eaf11..4a11ea168 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Correlation/When_sending_with_no_correlation_id.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Correlation/When_sending_with_no_correlation_id.cs @@ -1,6 +1,5 @@ namespace NServiceBus.AcceptanceTests.Correlation { - using System; using System.Threading.Tasks; using AcceptanceTesting; using EndpointTemplates; @@ -48,7 +47,7 @@ public Task Handle(MyRequest message, IMessageHandlerContext context) } } - [Serializable] + public class MyRequest : IMessage { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Correlation/When_using_a_custom_correlation_id.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Correlation/When_using_a_custom_correlation_id.cs similarity index 94% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Correlation/When_using_a_custom_correlation_id.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Correlation/When_using_a_custom_correlation_id.cs index aa5bca9a7..4572dfe72 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Correlation/When_using_a_custom_correlation_id.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Correlation/When_using_a_custom_correlation_id.cs @@ -1,6 +1,6 @@ -namespace NServiceBus.AcceptanceTests.Correlation + +namespace NServiceBus.AcceptanceTests.Correlation { - using System; using System.Threading.Tasks; using AcceptanceTesting; using EndpointTemplates; @@ -16,7 +16,10 @@ public async Task Should_use_the_given_id_as_the_transport_level_correlation_id( { var options = new SendOptions(); +#pragma warning disable 618 options.SetCorrelationId(CorrelationId); +#pragma warning restore 618 + options.RouteToThisEndpoint(); return session.Send(new MessageWithCustomCorrelationId(), options); @@ -58,7 +61,7 @@ public Task Handle(MessageWithCustomCorrelationId message, IMessageHandlerContex } } - [Serializable] + public class MessageWithCustomCorrelationId : IMessage { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/CriticalError/When_raising_critical_error.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/CriticalError/When_raising_critical_error.cs similarity index 99% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/CriticalError/When_raising_critical_error.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/CriticalError/When_raising_critical_error.cs index b20b69332..1e1b76500 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/CriticalError/When_raising_critical_error.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/CriticalError/When_raising_critical_error.cs @@ -144,7 +144,7 @@ public EndpointWithCriticalErrorStartup() } } - [Serializable] + public class Message : IMessage { public string ContextId { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DataBus/When_sending_databus_properties.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/DataBus/When_sending_databus_properties.cs similarity index 91% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DataBus/When_sending_databus_properties.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/DataBus/When_sending_databus_properties.cs index ca7fbff9e..2c778f51c 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DataBus/When_sending_databus_properties.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/DataBus/When_sending_databus_properties.cs @@ -1,6 +1,7 @@ namespace NServiceBus.AcceptanceTests.DataBus { using System; + using System.IO; using System.Threading.Tasks; using AcceptanceTesting; using EndpointTemplates; @@ -39,7 +40,8 @@ public Sender() { EndpointSetup(builder => { - builder.UseDataBus().BasePath(@".\databus\sender"); + var basePath = Path.Combine(TestContext.CurrentContext.TestDirectory, @"databus\sender"); + builder.UseDataBus().BasePath(basePath); builder.UseSerialization(); }) .AddMapping(typeof(Receiver)); @@ -52,7 +54,8 @@ public Receiver() { EndpointSetup(builder => { - builder.UseDataBus().BasePath(@".\databus\sender"); + var basePath = Path.Combine(TestContext.CurrentContext.TestDirectory, @"databus\sender"); + builder.UseDataBus().BasePath(basePath); builder.UseSerialization(); builder.RegisterComponents(c => c.ConfigureComponent(DependencyLifecycle.InstancePerCall)); }); @@ -83,7 +86,6 @@ public Task MutateIncoming(MutateIncomingTransportMessageContext context) } } - [Serializable] public class MyMessageWithLargePayload : ICommand { public DataBusProperty Payload { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DataBus/When_sending_databus_properties_with_unobtrusive.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/DataBus/When_sending_databus_properties_with_unobtrusive.cs similarity index 92% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DataBus/When_sending_databus_properties_with_unobtrusive.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/DataBus/When_sending_databus_properties_with_unobtrusive.cs index 706e01e88..2a97310fc 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DataBus/When_sending_databus_properties_with_unobtrusive.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/DataBus/When_sending_databus_properties_with_unobtrusive.cs @@ -1,5 +1,6 @@ namespace NServiceBus.AcceptanceTests.DataBus { + using System.IO; using System.Threading.Tasks; using AcceptanceTesting; using EndpointTemplates; @@ -40,7 +41,9 @@ public Sender() builder.Conventions() .DefiningCommandsAs(t => t.Namespace != null && t.FullName == typeof(MyMessageWithLargePayload).FullName) .DefiningDataBusPropertiesAs(t => t.Name.Contains("Payload")); - builder.UseDataBus().BasePath(@".\databus\sender"); + + var basePath = Path.Combine(TestContext.CurrentContext.TestDirectory, @"databus\sender"); + builder.UseDataBus().BasePath(basePath); builder.UseSerialization(); }) .AddMapping(typeof(Receiver)) @@ -58,7 +61,8 @@ public Receiver() .DefiningCommandsAs(t => t.Namespace != null && t.FullName == typeof(MyMessageWithLargePayload).FullName) .DefiningDataBusPropertiesAs(t => t.Name.Contains("Payload")); - builder.UseDataBus().BasePath(@".\databus\sender"); + var basePath = Path.Combine(TestContext.CurrentContext.TestDirectory, @"databus\sender"); + builder.UseDataBus().BasePath(basePath); builder.UseSerialization(); }); } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DataBus/When_using_custom_IDataBus.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/DataBus/When_using_custom_IDataBus.cs similarity index 99% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DataBus/When_using_custom_IDataBus.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/DataBus/When_using_custom_IDataBus.cs index 7dac9a596..ee9cf0a05 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DataBus/When_using_custom_IDataBus.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/DataBus/When_using_custom_IDataBus.cs @@ -87,7 +87,7 @@ public Task Start() } } - [Serializable] + public class MyMessageWithLargePayload : ICommand { public DataBusProperty Payload { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DelayedDelivery/When_Deferring_a_message.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/DelayedDelivery/When_Deferring_a_message.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DelayedDelivery/When_Deferring_a_message.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/DelayedDelivery/When_Deferring_a_message.cs index c073df109..d873dcd84 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DelayedDelivery/When_Deferring_a_message.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/DelayedDelivery/When_Deferring_a_message.cs @@ -59,7 +59,7 @@ public Task Handle(MyMessage message, IMessageHandlerContext context) } } - [Serializable] + public class MyMessage : IMessage { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DelayedDelivery/When_deferring_a_message_to_the_past.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/DelayedDelivery/When_deferring_a_message_to_the_past.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DelayedDelivery/When_deferring_a_message_to_the_past.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/DelayedDelivery/When_deferring_a_message_to_the_past.cs index 25ad3f6e9..2d1aed109 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DelayedDelivery/When_deferring_a_message_to_the_past.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/DelayedDelivery/When_deferring_a_message_to_the_past.cs @@ -52,7 +52,7 @@ public Task Handle(MyMessage message, IMessageHandlerContext context) } } - [Serializable] + public class MyMessage : IMessage { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DeterministicGuid.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/DeterministicGuid.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/DeterministicGuid.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/DeterministicGuid.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Encryption/When_using_Rijndael_with_config.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Encryption/When_using_Rijndael_with_config.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Encryption/When_using_Rijndael_with_config.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Encryption/When_using_Rijndael_with_config.cs index aff7f43dc..f07868252 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Encryption/When_using_Rijndael_with_config.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Encryption/When_using_Rijndael_with_config.cs @@ -89,7 +89,7 @@ public Task Handle(MessageWithSecretData message, IMessageHandlerContext context } } - [Serializable] + public class MessageWithSecretData : IMessage { public WireEncryptedString Secret { get; set; } @@ -97,14 +97,14 @@ public class MessageWithSecretData : IMessage public List CreditCards { get; set; } } - [Serializable] + public class CreditCardDetails { public DateTime ValidTo { get; set; } public WireEncryptedString Number { get; set; } } - [Serializable] + public class MySecretSubProperty { public WireEncryptedString Secret { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Encryption/When_using_Rijndael_with_custom.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Encryption/When_using_Rijndael_with_custom.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Encryption/When_using_Rijndael_with_custom.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Encryption/When_using_Rijndael_with_custom.cs index 27c9c20b0..33133de60 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Encryption/When_using_Rijndael_with_custom.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Encryption/When_using_Rijndael_with_custom.cs @@ -93,7 +93,7 @@ public Task Handle(MessageWithSecretData message, IMessageHandlerContext context } } - [Serializable] + public class MessageWithSecretData : IMessage { public WireEncryptedString Secret { get; set; } @@ -101,14 +101,14 @@ public class MessageWithSecretData : IMessage public List CreditCards { get; set; } } - [Serializable] + public class CreditCardDetails { public DateTime ValidTo { get; set; } public WireEncryptedString Number { get; set; } } - [Serializable] + public class MySecretSubProperty { public WireEncryptedString Secret { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Encryption/When_using_Rijndael_with_multikey.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Encryption/When_using_Rijndael_with_multikey.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Encryption/When_using_Rijndael_with_multikey.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Encryption/When_using_Rijndael_with_multikey.cs index f8731ae0a..771b50c80 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Encryption/When_using_Rijndael_with_multikey.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Encryption/When_using_Rijndael_with_multikey.cs @@ -1,6 +1,5 @@ namespace NServiceBus.AcceptanceTests.Encryption { - using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; @@ -73,7 +72,7 @@ public Task Handle(MessageWithSecretData message, IMessageHandlerContext context } } - [Serializable] + public class MessageWithSecretData : IMessage { public WireEncryptedString Secret { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Encryption/When_using_Rijndael_with_unobtrusive_mode.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Encryption/When_using_Rijndael_with_unobtrusive_mode.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Encryption/When_using_Rijndael_with_unobtrusive_mode.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Encryption/When_using_Rijndael_with_unobtrusive_mode.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Encryption/When_using_Rijndael_without_incoming_key_identifier.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Encryption/When_using_Rijndael_without_incoming_key_identifier.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Encryption/When_using_Rijndael_without_incoming_key_identifier.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Encryption/When_using_Rijndael_without_incoming_key_identifier.cs index a3318537f..8743f4cba 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Encryption/When_using_Rijndael_without_incoming_key_identifier.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Encryption/When_using_Rijndael_without_incoming_key_identifier.cs @@ -1,6 +1,5 @@ namespace NServiceBus.AcceptanceTests.Encryption { - using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; @@ -71,7 +70,7 @@ public Task Handle(MessageWithSecretData message, IMessageHandlerContext context } } - [Serializable] + public class MessageWithSecretData : IMessage { public WireEncryptedString Secret { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Encryption/When_using_encryption_with_custom_service.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Encryption/When_using_encryption_with_custom_service.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Encryption/When_using_encryption_with_custom_service.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Encryption/When_using_encryption_with_custom_service.cs index c5e777048..fd3083441 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Encryption/When_using_encryption_with_custom_service.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Encryption/When_using_encryption_with_custom_service.cs @@ -89,7 +89,7 @@ public Task Handle(MessageWithSecretData message, IMessageHandlerContext context } } - [Serializable] + public class MessageWithSecretData : IMessage { public WireEncryptedString Secret { get; set; } @@ -97,14 +97,14 @@ public class MessageWithSecretData : IMessage public List CreditCards { get; set; } } - [Serializable] + public class CreditCardDetails { public DateTime ValidTo { get; set; } public WireEncryptedString Number { get; set; } } - [Serializable] + public class MySecretSubProperty { public WireEncryptedString Secret { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/EndpointTemplates/ConfigureExtensions.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/EndpointTemplates/ConfigureExtensions.cs similarity index 87% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/EndpointTemplates/ConfigureExtensions.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/EndpointTemplates/ConfigureExtensions.cs index 0678ee80c..9a04b0865 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/EndpointTemplates/ConfigureExtensions.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/EndpointTemplates/ConfigureExtensions.cs @@ -8,7 +8,7 @@ public static class ConfigureExtensions { - public static Task DefineTransport(this EndpointConfiguration config, RunSettings settings, string endpointName) + public static Task DefineTransport(this EndpointConfiguration config, RunSettings settings, EndpointCustomizationConfiguration endpointCustomizationConfiguration) { Type transportType; if (!settings.TryGet("Transport", out transportType)) @@ -16,10 +16,10 @@ public static Task DefineTransport(this EndpointConfiguration config, RunSetting settings.Merge(Transports.Default.Settings); } - return ConfigureTestExecution(TestDependencyType.Transport, config, settings, endpointName); + return ConfigureTestExecution(TestDependencyType.Transport, config, settings, endpointCustomizationConfiguration.EndpointName, endpointCustomizationConfiguration.PublisherMetadata); } - public static Task DefinePersistence(this EndpointConfiguration config, RunSettings settings, string endpointName) + public static Task DefinePersistence(this EndpointConfiguration config, RunSettings settings, EndpointCustomizationConfiguration endpointCustomizationConfiguration) { Type persistenceType; if (!settings.TryGet("Persistence", out persistenceType)) @@ -27,7 +27,7 @@ public static Task DefinePersistence(this EndpointConfiguration config, RunSetti settings.Merge(Persistence.Default.Settings); } - return ConfigureTestExecution(TestDependencyType.Persistence, config, settings, endpointName); + return ConfigureTestExecution(TestDependencyType.Persistence, config, settings, endpointCustomizationConfiguration.EndpointName, endpointCustomizationConfiguration.PublisherMetadata); } public static void DefineBuilder(this EndpointConfiguration config, RunSettings settings) @@ -68,7 +68,7 @@ public static void RegisterComponentsAndInheritanceHierarchy(this EndpointConfig builder.RegisterComponents(r => { RegisterInheritanceHierarchyOfContextOnContainer(runDescriptor, r); }); } - static async Task ConfigureTestExecution(TestDependencyType type, EndpointConfiguration config, RunSettings settings, string endpointName) + static async Task ConfigureTestExecution(TestDependencyType type, EndpointConfiguration config, RunSettings settings, string endpointName, PublisherMetadata publisherMetadata) { var dependencyTypeString = type.ToString(); @@ -90,7 +90,7 @@ static async Task ConfigureTestExecution(TestDependencyType type, EndpointConfig throw new InvalidOperationException($"{typeName} does not implement {typeof(IConfigureEndpointTestExecution).Name}."); } - await configurer.Configure(endpointName, config, settings).ConfigureAwait(false); + await configurer.Configure(endpointName, config, settings, publisherMetadata).ConfigureAwait(false); ActiveTestExecutionConfigurer cleaners; var cleanerKey = "ConfigureTestExecution." + endpointName; diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/EndpointTemplates/DefaultPublisher.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/EndpointTemplates/DefaultPublisher.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/EndpointTemplates/DefaultPublisher.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/EndpointTemplates/DefaultPublisher.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/EndpointTemplates/DefaultServer.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/EndpointTemplates/DefaultServer.cs similarity index 95% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/EndpointTemplates/DefaultServer.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/EndpointTemplates/DefaultServer.cs index 83c7c7c5e..6ac33f422 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/EndpointTemplates/DefaultServer.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/EndpointTemplates/DefaultServer.cs @@ -42,7 +42,7 @@ public async Task GetConfiguration(RunDescriptor runDescr recoverability.Delayed(delayed => delayed.NumberOfRetries(0)); recoverability.Immediate(immediate => immediate.NumberOfRetries(0)); - await configuration.DefineTransport(settings, endpointConfiguration.EndpointName).ConfigureAwait(false); + await configuration.DefineTransport(settings, endpointConfiguration).ConfigureAwait(false); configuration.DefineBuilder(settings); configuration.RegisterComponentsAndInheritanceHierarchy(runDescriptor); @@ -52,7 +52,7 @@ public async Task GetConfiguration(RunDescriptor runDescr { configuration.UseSerialization((SerializationDefinition)Activator.CreateInstance(serializerType)); } - await configuration.DefinePersistence(settings, endpointConfiguration.EndpointName).ConfigureAwait(false); + await configuration.DefinePersistence(settings, endpointConfiguration).ConfigureAwait(false); configuration.GetSettings().SetDefault("ScaleOut.UseSingleBrokerQueue", true); configurationBuilderCustomization(configuration); diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/EndpointTemplates/EndpointCustomizationConfigurationExtensions.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/EndpointTemplates/EndpointCustomizationConfigurationExtensions.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/EndpointTemplates/EndpointCustomizationConfigurationExtensions.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/EndpointTemplates/EndpointCustomizationConfigurationExtensions.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/EndpointTemplates/ServerWithNoDefaultPersistenceDefinitions.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/EndpointTemplates/ServerWithNoDefaultPersistenceDefinitions.cs similarity index 97% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/EndpointTemplates/ServerWithNoDefaultPersistenceDefinitions.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/EndpointTemplates/ServerWithNoDefaultPersistenceDefinitions.cs index 7e35ec415..365f0719e 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/EndpointTemplates/ServerWithNoDefaultPersistenceDefinitions.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/EndpointTemplates/ServerWithNoDefaultPersistenceDefinitions.cs @@ -38,7 +38,7 @@ public async Task GetConfiguration(RunDescriptor runDescr .Delayed(delayed => delayed.NumberOfRetries(0)) .Immediate(immediate => immediate.NumberOfRetries(0)); - await builder.DefineTransport(settings, endpointConfiguration.EndpointName).ConfigureAwait(false); + await builder.DefineTransport(settings, endpointConfiguration).ConfigureAwait(false); builder.RegisterComponentsAndInheritanceHierarchy(runDescriptor); diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Forwarding/When_forwarding_is_configured_for_endpoint.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Forwarding/When_forwarding_is_configured_for_endpoint.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Forwarding/When_forwarding_is_configured_for_endpoint.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Forwarding/When_forwarding_is_configured_for_endpoint.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Forwarding/When_requesting_message_to_be_forwarded.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Forwarding/When_requesting_message_to_be_forwarded.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Forwarding/When_requesting_message_to_be_forwarded.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Forwarding/When_requesting_message_to_be_forwarded.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Hosting/When_a_message_is_audited.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Hosting/When_a_message_is_audited.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Hosting/When_a_message_is_audited.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Hosting/When_a_message_is_audited.cs index 7a09fb528..23cf860a7 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Hosting/When_a_message_is_audited.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Hosting/When_a_message_is_audited.cs @@ -1,6 +1,5 @@ namespace NServiceBus.AcceptanceTests.Hosting { - using System; using System.Threading.Tasks; using AcceptanceTesting; using EndpointTemplates; @@ -72,7 +71,7 @@ public Task Handle(MessageToBeAudited message, IMessageHandlerContext context) } } - [Serializable] + public class MessageToBeAudited : IMessage { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Hosting/When_a_message_is_faulted.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Hosting/When_a_message_is_faulted.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Hosting/When_a_message_is_faulted.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Hosting/When_a_message_is_faulted.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Hosting/When_feature_overrides_hostid.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Hosting/When_feature_overrides_hostid.cs similarity index 99% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Hosting/When_feature_overrides_hostid.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Hosting/When_feature_overrides_hostid.cs index 692177f1b..3675f7530 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Hosting/When_feature_overrides_hostid.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Hosting/When_feature_overrides_hostid.cs @@ -75,7 +75,7 @@ public class Context : ScenarioContext public bool Done { get; set; } } - [Serializable] + public class MyMessage : ICommand { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Hosting/When_feature_overrides_hostinfo.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Hosting/When_feature_overrides_hostinfo.cs similarity index 99% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Hosting/When_feature_overrides_hostinfo.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Hosting/When_feature_overrides_hostinfo.cs index 9daaf599e..a5960544f 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Hosting/When_feature_overrides_hostinfo.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Hosting/When_feature_overrides_hostinfo.cs @@ -70,7 +70,7 @@ public class Context : ScenarioContext public Guid OriginatingHostId { get; set; } } - [Serializable] + public class MyMessage : ICommand { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Hosting/When_overriding_input_queue_name.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Hosting/When_overriding_input_queue_name.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Hosting/When_overriding_input_queue_name.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Hosting/When_overriding_input_queue_name.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Hosting/When_sending_ensure_proper_headers.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Hosting/When_sending_ensure_proper_headers.cs similarity index 99% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Hosting/When_sending_ensure_proper_headers.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Hosting/When_sending_ensure_proper_headers.cs index bccf06d5c..4b1177040 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Hosting/When_sending_ensure_proper_headers.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Hosting/When_sending_ensure_proper_headers.cs @@ -49,7 +49,7 @@ public Receiver() } } - [Serializable] + public class MyMessage : ICommand { public Guid Id { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Licensing/When_a_message_is_audited.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Licensing/When_a_message_is_audited.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Licensing/When_a_message_is_audited.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Licensing/When_a_message_is_audited.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/MessageId/When_message_has_empty_id_header.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/MessageId/When_message_has_empty_id_header.cs similarity index 99% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/MessageId/When_message_has_empty_id_header.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/MessageId/When_message_has_empty_id_header.cs index 1c55e28f1..3f50fbb2c 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/MessageId/When_message_has_empty_id_header.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/MessageId/When_message_has_empty_id_header.cs @@ -62,7 +62,7 @@ public Task Handle(Message message, IMessageHandlerContext context) } } - [Serializable] + public class Message : IMessage { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/MessageId/When_message_has_no_id_header.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/MessageId/When_message_has_no_id_header.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/MessageId/When_message_has_no_id_header.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/MessageId/When_message_has_no_id_header.cs index ccff3e7d6..f88f69183 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/MessageId/When_message_has_no_id_header.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/MessageId/When_message_has_no_id_header.cs @@ -58,7 +58,7 @@ public Task Handle(Message message, IMessageHandlerContext context) } } - [Serializable] + public class Message : IMessage { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Mutators/Issue_1980.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Mutators/Issue_1980.cs similarity index 97% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Mutators/Issue_1980.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Mutators/Issue_1980.cs index 2dbaebb8a..9d41d2c2b 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Mutators/Issue_1980.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Mutators/Issue_1980.cs @@ -1,6 +1,5 @@ namespace NServiceBus.AcceptanceTests.Mutators { - using System; using System.Threading.Tasks; using AcceptanceTesting; using EndpointTemplates; @@ -81,12 +80,12 @@ public Task Handle(V1Message message, IMessageHandlerContext context) } } - [Serializable] + public class V1Message : ICommand { } - [Serializable] + public class V2Message : ICommand { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Mutators/When_defining_outgoing_message_mutators.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Mutators/When_defining_outgoing_message_mutators.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Mutators/When_defining_outgoing_message_mutators.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Mutators/When_defining_outgoing_message_mutators.cs index d3524e147..48a3cb26a 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Mutators/When_defining_outgoing_message_mutators.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Mutators/When_defining_outgoing_message_mutators.cs @@ -1,6 +1,5 @@ namespace NServiceBus.AcceptanceTests.Mutators { - using System; using System.Threading.Tasks; using AcceptanceTesting; using EndpointTemplates; @@ -91,7 +90,7 @@ public Task Handle(Message message, IMessageHandlerContext context) } } - [Serializable] + public class Message : ICommand { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Mutators/When_incoming_mutator_changes_message_type.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Mutators/When_incoming_mutator_changes_message_type.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Mutators/When_incoming_mutator_changes_message_type.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Mutators/When_incoming_mutator_changes_message_type.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Mutators/When_mutating.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Mutators/When_mutating.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Mutators/When_mutating.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Mutators/When_mutating.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Mutators/When_outgoing_mutator_replaces_instance.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Mutators/When_outgoing_mutator_replaces_instance.cs similarity index 97% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Mutators/When_outgoing_mutator_replaces_instance.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Mutators/When_outgoing_mutator_replaces_instance.cs index a28d61ac4..f452259d2 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Mutators/When_outgoing_mutator_replaces_instance.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Mutators/When_outgoing_mutator_replaces_instance.cs @@ -1,6 +1,5 @@ namespace NServiceBus.AcceptanceTests.Mutators { - using System; using System.Threading.Tasks; using AcceptanceTesting; using EndpointTemplates; @@ -82,12 +81,12 @@ public Task Handle(V1Message message, IMessageHandlerContext context) } } - [Serializable] + public class V1Message : ICommand { } - [Serializable] + public class V2Message : ICommand { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Mutators/When_using_outgoing_tm_mutator.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Mutators/When_using_outgoing_tm_mutator.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Mutators/When_using_outgoing_tm_mutator.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Mutators/When_using_outgoing_tm_mutator.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/NServiceBusAcceptanceTest.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/NServiceBusAcceptanceTest.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/NServiceBusAcceptanceTest.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/NServiceBusAcceptanceTest.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/NonTx/When_sending_inside_ambient_tx.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/NonTx/When_sending_inside_ambient_tx.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/NonTx/When_sending_inside_ambient_tx.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/NonTx/When_sending_inside_ambient_tx.cs index b431c446d..63b722109 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/NonTx/When_sending_inside_ambient_tx.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/NonTx/When_sending_inside_ambient_tx.cs @@ -92,12 +92,12 @@ public Task Handle(CompleteTest message, IMessageHandlerContext context) } } - [Serializable] + public class MyMessage : ICommand { } - [Serializable] + public class CompleteTest : ICommand { public bool EnlistedInTheAmbientTx { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/PerfMon/CriticalTime/When_CriticalTime_enabled.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/PerfMon/CriticalTime/When_CriticalTime_enabled.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/PerfMon/CriticalTime/When_CriticalTime_enabled.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/PerfMon/CriticalTime/When_CriticalTime_enabled.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/PerfMon/CriticalTime/When_deferring_a_message.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/PerfMon/CriticalTime/When_deferring_a_message.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/PerfMon/CriticalTime/When_deferring_a_message.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/PerfMon/CriticalTime/When_deferring_a_message.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/PerfMon/CriticalTime/When_slow_with_CriticalTime_enabled.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/PerfMon/CriticalTime/When_slow_with_CriticalTime_enabled.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/PerfMon/CriticalTime/When_slow_with_CriticalTime_enabled.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/PerfMon/CriticalTime/When_slow_with_CriticalTime_enabled.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/PerfMon/SLA/When_sending_slow_with_SLA_enabled.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/PerfMon/SLA/When_sending_slow_with_SLA_enabled.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/PerfMon/SLA/When_sending_slow_with_SLA_enabled.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/PerfMon/SLA/When_sending_slow_with_SLA_enabled.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/PerfMon/SLA/When_sending_with_SLA_enabled.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/PerfMon/SLA/When_sending_with_SLA_enabled.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/PerfMon/SLA/When_sending_with_SLA_enabled.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/PerfMon/SLA/When_sending_with_SLA_enabled.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Performance/TimeToBeReceived/When_TimeToBeReceived_has_expired.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Performance/TimeToBeReceived/When_TimeToBeReceived_has_expired.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Performance/TimeToBeReceived/When_TimeToBeReceived_has_expired.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Performance/TimeToBeReceived/When_TimeToBeReceived_has_expired.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Performance/TimeToBeReceived/When_TimeToBeReceived_has_expired_convention.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Performance/TimeToBeReceived/When_TimeToBeReceived_has_expired_convention.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Performance/TimeToBeReceived/When_TimeToBeReceived_has_expired_convention.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Performance/TimeToBeReceived/When_TimeToBeReceived_has_expired_convention.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Performance/TimeToBeReceived/When_TimeToBeReceived_has_not_expired.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Performance/TimeToBeReceived/When_TimeToBeReceived_has_not_expired.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Performance/TimeToBeReceived/When_TimeToBeReceived_has_not_expired.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Performance/TimeToBeReceived/When_TimeToBeReceived_has_not_expired.cs index 06ec1a4be..9419bbf55 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Performance/TimeToBeReceived/When_TimeToBeReceived_has_not_expired.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Performance/TimeToBeReceived/When_TimeToBeReceived_has_not_expired.cs @@ -46,7 +46,7 @@ public Task Handle(MyMessage message, IMessageHandlerContext context) } } - [Serializable] + [TimeToBeReceived("00:00:10")] public class MyMessage : IMessage { diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Performance/TimeToBeReceived/When_TimeToBeReceived_used_with_unobtrusive_mode.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Performance/TimeToBeReceived/When_TimeToBeReceived_used_with_unobtrusive_mode.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Performance/TimeToBeReceived/When_TimeToBeReceived_used_with_unobtrusive_mode.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Performance/TimeToBeReceived/When_TimeToBeReceived_used_with_unobtrusive_mode.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Performance/When_message_is_audited.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Performance/When_message_is_audited.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Performance/When_message_is_audited.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Performance/When_message_is_audited.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Performance/When_message_is_faulted.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Performance/When_message_is_faulted.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Performance/When_message_is_faulted.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Performance/When_message_is_faulted.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Pipeline/When_replacing_behavior.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Pipeline/When_replacing_behavior.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Pipeline/When_replacing_behavior.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Pipeline/When_replacing_behavior.cs index 320975e7d..bdffd55b0 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Pipeline/When_replacing_behavior.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Pipeline/When_replacing_behavior.cs @@ -91,7 +91,7 @@ public Task Handle(Message message, IMessageHandlerContext context) } } - class Message : IMessage + public class Message : IMessage { } } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Pipeline/When_using_per_uow_component_in_the_pipeline.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Pipeline/When_using_per_uow_component_in_the_pipeline.cs similarity index 99% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Pipeline/When_using_per_uow_component_in_the_pipeline.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Pipeline/When_using_per_uow_component_in_the_pipeline.cs index 1f0e18c4f..ad1e66c97 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Pipeline/When_using_per_uow_component_in_the_pipeline.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Pipeline/When_using_per_uow_component_in_the_pipeline.cs @@ -111,7 +111,7 @@ public Task Handle(Message message, IMessageHandlerContext context) } } - class Message : IMessage + public class Message : IMessage { public string Value { get; set; } } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_Subscribing_to_errors.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_Subscribing_to_errors.cs similarity index 99% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_Subscribing_to_errors.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_Subscribing_to_errors.cs index 76839723d..8d78c8f04 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_Subscribing_to_errors.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_Subscribing_to_errors.cs @@ -94,7 +94,7 @@ public Task Handle(MessageToBeRetried message, IMessageHandlerContext context) } } - [Serializable] + public class MessageToBeRetried : IMessage { public Guid Id { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_custom_policy_always_moves_to_error.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_custom_policy_always_moves_to_error.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_custom_policy_always_moves_to_error.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_custom_policy_always_moves_to_error.cs index b9d553e66..a7959349a 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_custom_policy_always_moves_to_error.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_custom_policy_always_moves_to_error.cs @@ -1,6 +1,5 @@ namespace NServiceBus.AcceptanceTests.Recoverability.Retries { - using System; using System.Threading.Tasks; using AcceptanceTesting; using EndpointTemplates; @@ -59,7 +58,7 @@ public Task Handle(MessageToBeRetried message, IMessageHandlerContext context) } } - [Serializable] + public class MessageToBeRetried : IMessage { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_custom_policy_does_single_delayed_retry_before_move_to_error.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_custom_policy_does_single_delayed_retry_before_move_to_error.cs similarity index 99% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_custom_policy_does_single_delayed_retry_before_move_to_error.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_custom_policy_does_single_delayed_retry_before_move_to_error.cs index dcd2dffc9..4296e350f 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_custom_policy_does_single_delayed_retry_before_move_to_error.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_custom_policy_does_single_delayed_retry_before_move_to_error.cs @@ -70,7 +70,7 @@ public Task Handle(MessageToBeRetried message, IMessageHandlerContext context) } } - [Serializable] + public class MessageToBeRetried : IMessage { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_custom_policy_executed.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_custom_policy_executed.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_custom_policy_executed.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_custom_policy_executed.cs index 6d7c3f458..2ce8d3745 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_custom_policy_executed.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_custom_policy_executed.cs @@ -69,7 +69,7 @@ public Task Handle(MessageToBeRetried message, IMessageHandlerContext context) } } - class MessageToBeRetried : IMessage + public class MessageToBeRetried : IMessage { } } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_custom_policy_provided.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_custom_policy_provided.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_custom_policy_provided.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_custom_policy_provided.cs index 84220a0b3..46890f847 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_custom_policy_provided.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_custom_policy_provided.cs @@ -64,7 +64,7 @@ public Task Handle(MessageToBeRetried message, IMessageHandlerContext context) } } - class MessageToBeRetried : IMessage + public class MessageToBeRetried : IMessage { } } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_delayed_retries_and_counting.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_delayed_retries_and_counting.cs similarity index 99% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_delayed_retries_and_counting.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_delayed_retries_and_counting.cs index 4d9d1f139..ae57120fd 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_delayed_retries_and_counting.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_delayed_retries_and_counting.cs @@ -66,7 +66,7 @@ public Task Handle(MessageToBeRetried message, IMessageHandlerContext context) } } - [Serializable] + public class MessageToBeRetried : IMessage { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_delayed_retries_with_immediate_retries_disabled.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_delayed_retries_with_immediate_retries_disabled.cs similarity index 99% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_delayed_retries_with_immediate_retries_disabled.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_delayed_retries_with_immediate_retries_disabled.cs index 742e172ad..d81ce66d9 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_delayed_retries_with_immediate_retries_disabled.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_delayed_retries_with_immediate_retries_disabled.cs @@ -66,7 +66,7 @@ public Task Handle(MessageToBeRetried message, IMessageHandlerContext context) } } - [Serializable] + public class MessageToBeRetried : IMessage { public Guid Id { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_delayed_retries_with_regular_exception.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_delayed_retries_with_regular_exception.cs similarity index 99% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_delayed_retries_with_regular_exception.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_delayed_retries_with_regular_exception.cs index 73ce1f576..cafd6c29c 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_delayed_retries_with_regular_exception.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_delayed_retries_with_regular_exception.cs @@ -93,7 +93,7 @@ public Task Handle(MessageToBeRetried message, IMessageHandlerContext context) } } - [Serializable] + public class MessageToBeRetried : IMessage { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_delayed_retries_with_serialization_exception.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_delayed_retries_with_serialization_exception.cs similarity index 99% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_delayed_retries_with_serialization_exception.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_delayed_retries_with_serialization_exception.cs index 2e6f3c5e2..7a768aaea 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_delayed_retries_with_serialization_exception.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_delayed_retries_with_serialization_exception.cs @@ -91,7 +91,7 @@ public Task Handle(MessageToBeRetried message, IMessageHandlerContext context) } } - [Serializable] + public class MessageToBeRetried : IMessage { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_fails_with_retries_set_to_0.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_fails_with_retries_set_to_0.cs similarity index 99% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_fails_with_retries_set_to_0.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_fails_with_retries_set_to_0.cs index 9e14ac61f..b90f8306d 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_fails_with_retries_set_to_0.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_fails_with_retries_set_to_0.cs @@ -62,7 +62,7 @@ public Task Handle(MessageToBeRetried message, IMessageHandlerContext context) } } - [Serializable] + public class MessageToBeRetried : IMessage { public Guid ContextId { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_immediate_retries_with_default_settings.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_immediate_retries_with_default_settings.cs similarity index 99% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_immediate_retries_with_default_settings.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_immediate_retries_with_default_settings.cs index b1be1a072..914da9339 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_immediate_retries_with_default_settings.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_immediate_retries_with_default_settings.cs @@ -73,7 +73,7 @@ public Task Handle(MessageToBeRetried message, IMessageHandlerContext context) } } - [Serializable] + public class MessageToBeRetried : IMessage { public Guid Id { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_immediate_retries_with_dtc_on.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_immediate_retries_with_dtc_on.cs similarity index 97% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_immediate_retries_with_dtc_on.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_immediate_retries_with_dtc_on.cs index 2f5c3db85..7e4e41ae6 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_immediate_retries_with_dtc_on.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_immediate_retries_with_dtc_on.cs @@ -55,7 +55,7 @@ public RetryEndpoint() b.Notifications.Errors.MessageSentToErrorQueue += (sender, message) => scenarioContext.GaveUpOnRetries = true; var recoverability = b.Recoverability(); recoverability.Immediate(settings => settings.NumberOfRetries(maxretries)); - recoverability.Delayed(settings => settings.TimeIncrease(TimeSpan.FromMilliseconds(1)).NumberOfRetries(3)); + recoverability.Delayed(settings => settings.NumberOfRetries(0)); }); } @@ -78,10 +78,10 @@ public Task Handle(MessageToBeRetried message, IMessageHandlerContext context) } } - [Serializable] + public class MessageToBeRetried : IMessage { public Guid Id { get; set; } } } -} \ No newline at end of file +} diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_immediate_retries_with_native_transactions.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_immediate_retries_with_native_transactions.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_immediate_retries_with_native_transactions.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_immediate_retries_with_native_transactions.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_message_fails_retries.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_message_fails_retries.cs similarity index 87% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_message_fails_retries.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_message_fails_retries.cs index 85982a9ad..10c416546 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_message_fails_retries.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_message_fails_retries.cs @@ -1,6 +1,5 @@ namespace NServiceBus.AcceptanceTests.Recoverability.Retries { - using System; using System.Linq; using System.Threading.Tasks; using AcceptanceTesting; @@ -11,21 +10,13 @@ public class When_message_fails_retries : NServiceBusAcceptanceTest { [Test] - public async Task Should_forward_message_to_error_queue() + public void Should_forward_message_to_error_queue() { - MessagesFailedException exception = null; - try - { - await Scenario.Define() + var exception = Assert.ThrowsAsync(async () => await Scenario.Define() .WithEndpoint(b => b .When((session, c) => session.SendLocal(new MessageWhichFailsRetries()))) .Done(c => c.ForwardedToErrorQueue) - .Run(); - } - catch (AggregateException ex) - { - exception = ex.ExpectFailedMessages(); - } + .Run()); Assert.AreEqual(1, exception.FailedMessages.Count); var failedMessage = exception.FailedMessages.Single(); diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_message_is_deferred_by_delayed_retries_using_dtc.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_message_is_deferred_by_delayed_retries_using_dtc.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_message_is_deferred_by_delayed_retries_using_dtc.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_message_is_deferred_by_delayed_retries_using_dtc.cs index 8eac425a0..084cb988a 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/When_message_is_deferred_by_delayed_retries_using_dtc.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/When_message_is_deferred_by_delayed_retries_using_dtc.cs @@ -102,7 +102,7 @@ public Task Handle(MessageToFail message, IMessageHandlerContext context) } } - class MessageToFail : IMessage + public class MessageToFail : IMessage { public Guid Id { get; set; } } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/when_immediate_retries_fail.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/when_immediate_retries_fail.cs similarity index 99% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/when_immediate_retries_fail.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/when_immediate_retries_fail.cs index d8c049e01..b9a3d56ea 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/Retries/when_immediate_retries_fail.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/Retries/when_immediate_retries_fail.cs @@ -94,7 +94,7 @@ public Task Handle(MessageToBeRetried message, IMessageHandlerContext context) } } - [Serializable] + public class MessageToBeRetried : IMessage { public Guid Id { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/When_custom_policy_moves_to_overridden_error_queue.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/When_custom_policy_moves_to_overridden_error_queue.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/When_custom_policy_moves_to_overridden_error_queue.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/When_custom_policy_moves_to_overridden_error_queue.cs index 10bf26de8..fda18906f 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/When_custom_policy_moves_to_overridden_error_queue.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/When_custom_policy_moves_to_overridden_error_queue.cs @@ -79,7 +79,7 @@ public Task Handle(InitiatingMessage initiatingMessage, IMessageHandlerContext c } } - class InitiatingMessage : IMessage + public class InitiatingMessage : IMessage { public Guid Id { get; set; } } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/When_error_is_overridden_in_code.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/When_error_is_overridden_in_code.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/When_error_is_overridden_in_code.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/When_error_is_overridden_in_code.cs index 135c6daf9..0620ac1cc 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/When_error_is_overridden_in_code.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/When_error_is_overridden_in_code.cs @@ -1,6 +1,5 @@ namespace NServiceBus.AcceptanceTests.Recoverability { - using System; using System.Threading.Tasks; using AcceptanceTesting; using EndpointTemplates; @@ -63,7 +62,7 @@ public class Context : ScenarioContext public bool MessageReceived { get; set; } } - [Serializable] + public class Message : IMessage { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/When_message_is_moved_to_error_queue.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/When_message_is_moved_to_error_queue.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/When_message_is_moved_to_error_queue.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/When_message_is_moved_to_error_queue.cs index 17db41da9..a543c6979 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Recoverability/When_message_is_moved_to_error_queue.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Recoverability/When_message_is_moved_to_error_queue.cs @@ -167,12 +167,12 @@ public async Task Invoke(ITransportReceiveContext context, Func, IAmStartedByMessages + public class PlaceOrderSaga : Saga, IAmStartedByMessages { public Task Handle(PlaceOrder message, IMessageHandlerContext context) { diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Reliability/Outbox/When_dispatching_forwarded_messages.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Reliability/Outbox/When_dispatching_forwarded_messages.cs similarity index 99% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Reliability/Outbox/When_dispatching_forwarded_messages.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Reliability/Outbox/When_dispatching_forwarded_messages.cs index 9cfc9a1f9..47c672d3b 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Reliability/Outbox/When_dispatching_forwarded_messages.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Reliability/Outbox/When_dispatching_forwarded_messages.cs @@ -90,7 +90,7 @@ public Task Handle(MessageToBeForwarded message, IMessageHandlerContext context) } } - [Serializable] + public class MessageToBeForwarded : IMessage { public string RunId { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Reliability/Outbox/When_receiving_a_message.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Reliability/Outbox/When_receiving_a_message.cs similarity index 95% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Reliability/Outbox/When_receiving_a_message.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Reliability/Outbox/When_receiving_a_message.cs index c5babc17c..2cecc6b24 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Reliability/Outbox/When_receiving_a_message.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Reliability/Outbox/When_receiving_a_message.cs @@ -56,11 +56,11 @@ public Task Handle(SendOrderAcknowledgement message, IMessageHandlerContext cont } } - class PlaceOrder : ICommand + public class PlaceOrder : ICommand { } - class SendOrderAcknowledgement : IMessage + public class SendOrderAcknowledgement : IMessage { } } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Reliability/Outbox/When_sending_from_a_non_dtc_endpoint.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Reliability/Outbox/When_sending_from_a_non_dtc_endpoint.cs similarity index 94% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Reliability/Outbox/When_sending_from_a_non_dtc_endpoint.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Reliability/Outbox/When_sending_from_a_non_dtc_endpoint.cs index 873be5eec..fb41d3be2 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Reliability/Outbox/When_sending_from_a_non_dtc_endpoint.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Reliability/Outbox/When_sending_from_a_non_dtc_endpoint.cs @@ -58,13 +58,11 @@ public Task Handle(SendOrderAcknowledgement message, IMessageHandlerContext cont } } - [Serializable] - class PlaceOrder : ICommand + public class PlaceOrder : ICommand { } - [Serializable] - class SendOrderAcknowledgement : IMessage + public class SendOrderAcknowledgement : IMessage { } } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/AutomaticSubscriptions/When_starting_an_endpoint_with_a_saga.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/AutomaticSubscriptions/When_starting_an_endpoint_with_a_saga.cs similarity index 91% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/AutomaticSubscriptions/When_starting_an_endpoint_with_a_saga.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/AutomaticSubscriptions/When_starting_an_endpoint_with_a_saga.cs index da10612a1..ca2a9aad4 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/AutomaticSubscriptions/When_starting_an_endpoint_with_a_saga.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/AutomaticSubscriptions/When_starting_an_endpoint_with_a_saga.cs @@ -37,9 +37,12 @@ class Subscriber : EndpointConfigurationBuilder { public Subscriber() { - EndpointSetup(c => c.Pipeline.Register("SubscriptionSpy", new SubscriptionSpy((Context)ScenarioContext), "Spies on subscriptions made")) - .AddMapping(typeof(Subscriber)) //just map to our self for this test - .AddMapping(typeof(Subscriber)); //just map to our self for this test + EndpointSetup(c => c.Pipeline.Register("SubscriptionSpy", new SubscriptionSpy((Context) ScenarioContext), "Spies on subscriptions made"), + metadata => + { + metadata.RegisterPublisherFor(typeof(Subscriber)); + metadata.RegisterPublisherFor(typeof(Subscriber)); + }); } class SubscriptionSpy : IBehavior diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/AutomaticSubscriptions/When_starting_an_endpoint_with_a_saga_autosubscribe_disabled.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/AutomaticSubscriptions/When_starting_an_endpoint_with_a_saga_autosubscribe_disabled.cs similarity index 91% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/AutomaticSubscriptions/When_starting_an_endpoint_with_a_saga_autosubscribe_disabled.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/AutomaticSubscriptions/When_starting_an_endpoint_with_a_saga_autosubscribe_disabled.cs index 05e829bf3..125c39bb9 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/AutomaticSubscriptions/When_starting_an_endpoint_with_a_saga_autosubscribe_disabled.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/AutomaticSubscriptions/When_starting_an_endpoint_with_a_saga_autosubscribe_disabled.cs @@ -37,9 +37,12 @@ class Subscriber : EndpointConfigurationBuilder { public Subscriber() { - EndpointSetup(c => c.Pipeline.Register("SubscriptionSpy", new SubscriptionSpy((Context)ScenarioContext), "Spies on subscriptions made")) - .AddMapping(typeof(Subscriber)) //just map to our self for this test - .AddMapping(typeof(Subscriber)); //just map to our self for this test + EndpointSetup(c => c.Pipeline.Register("SubscriptionSpy", new SubscriptionSpy((Context) ScenarioContext), "Spies on subscriptions made"), + metadata => + { + metadata.RegisterPublisherFor(typeof(Subscriber)); + metadata.RegisterPublisherFor(typeof(Subscriber)); + }); } class SubscriptionSpy : IBehavior diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/AutomaticSubscriptions/When_starting_an_endpoint_with_autoSubscribe.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/AutomaticSubscriptions/When_starting_an_endpoint_with_autoSubscribe.cs similarity index 84% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/AutomaticSubscriptions/When_starting_an_endpoint_with_autoSubscribe.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/AutomaticSubscriptions/When_starting_an_endpoint_with_autoSubscribe.cs index 1645c02b3..730d47671 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/AutomaticSubscriptions/When_starting_an_endpoint_with_autoSubscribe.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/AutomaticSubscriptions/When_starting_an_endpoint_with_autoSubscribe.cs @@ -41,11 +41,14 @@ class Subscriber : EndpointConfigurationBuilder { public Subscriber() { - EndpointSetup(c => c.Pipeline.Register("SubscriptionSpy", new SubscriptionSpy((Context)ScenarioContext), "Spies on subscriptions made")) + EndpointSetup(c => c.Pipeline.Register("SubscriptionSpy", new SubscriptionSpy((Context) ScenarioContext), "Spies on subscriptions made"), + metadata => + { + metadata.RegisterPublisherFor(typeof(Subscriber)); + metadata.RegisterPublisherFor(typeof(Subscriber)); + }) .AddMapping(typeof(Subscriber)) //just map to our self for this test - .AddMapping(typeof(Subscriber)) //just map to our self for this test - .AddMapping(typeof(Subscriber)) //just map to our self for this test - .AddMapping(typeof(Subscriber)); //just map to our self for this test + .AddMapping(typeof(Subscriber)); //just map to our self for this test } class SubscriptionSpy : IBehavior @@ -98,23 +101,23 @@ public Task Handle(MyCommand message, IMessageHandlerContext context) } } - class MyMessage : IMessage + public class MyMessage : IMessage { } - class MyCommand : ICommand + public class MyCommand : ICommand { } - class MyEvent : IEvent + public class MyEvent : IEvent { } - class MyEventWithNoRouting : IEvent + public class MyEventWithNoRouting : IEvent { } - class MyEventWithNoHandler : IEvent + public class MyEventWithNoHandler : IEvent { } } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_extending_event_routing.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_extending_event_routing.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_extending_event_routing.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_extending_event_routing.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_multi_subscribing_to_a_polymorphic_event.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_multi_subscribing_to_a_polymorphic_event.cs similarity index 94% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_multi_subscribing_to_a_polymorphic_event.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_multi_subscribing_to_a_polymorphic_event.cs index 5f30ef6f3..d869f07f8 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_multi_subscribing_to_a_polymorphic_event.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_multi_subscribing_to_a_polymorphic_event.cs @@ -93,9 +93,12 @@ public class Subscriber1 : EndpointConfigurationBuilder { public Subscriber1() { - EndpointSetup(c => c.DisableFeature()) - .AddMapping(typeof(Publisher1)) - .AddMapping(typeof(Publisher2)); + EndpointSetup(c => c.DisableFeature(), + metadata => + { + metadata.RegisterPublisherFor(typeof(Publisher1)); + metadata.RegisterPublisherFor(typeof(Publisher2)); + }); } public class MyEventHandler : IHandleMessages diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_publishing_from_sendonly.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_publishing_from_sendonly.cs similarity index 96% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_publishing_from_sendonly.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_publishing_from_sendonly.cs index aff5d0836..cb83d72ed 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_publishing_from_sendonly.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_publishing_from_sendonly.cs @@ -1,6 +1,5 @@ namespace NServiceBus.AcceptanceTests.Routing.MessageDrivenSubscriptions { - using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -50,8 +49,8 @@ public class Subscriber : EndpointConfigurationBuilder { public Subscriber() { - EndpointSetup(c => c.DisableFeature()) - .AddMapping(typeof(SendOnlyPublisher)); + EndpointSetup(c => c.DisableFeature(), + metadata => metadata.RegisterPublisherFor(typeof(SendOnlyPublisher))); } public class MyEventHandler : IHandleMessages @@ -67,7 +66,7 @@ public Task Handle(MyEvent messageThatIsEnlisted, IMessageHandlerContext context } } - [Serializable] + public class MyEvent : IEvent { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_publishing_to_scaled_out_subscribers.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_publishing_to_scaled_out_subscribers.cs similarity index 86% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_publishing_to_scaled_out_subscribers.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_publishing_to_scaled_out_subscribers.cs index 797f14ac2..9cf7da619 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_publishing_to_scaled_out_subscribers.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_publishing_to_scaled_out_subscribers.cs @@ -3,16 +3,13 @@ using System.Threading; using System.Threading.Tasks; using AcceptanceTesting; - using AcceptanceTesting.Customization; using EndpointTemplates; using NUnit.Framework; using ScenarioDescriptors; public class When_publishing_to_scaled_out_subscribers : NServiceBusAcceptanceTest { - static string PublisherEndpoint => Conventions.EndpointNamingConvention(typeof(Publisher)); - - [Test] + [Test] public async Task Each_event_should_be_delivered_to_single_instance_of_each_subscriber() { await Scenario.Define() @@ -71,10 +68,7 @@ public class SubscriberA : EndpointConfigurationBuilder { public SubscriberA() { - EndpointSetup(c => - { - c.MessageDrivenPubSubRouting().RegisterPublisher(typeof(MyEvent), PublisherEndpoint); - }); + EndpointSetup(publisherMetadata: metadata => metadata.RegisterPublisherFor(typeof(Publisher))); } public class MyEventHandler : IHandleMessages @@ -93,10 +87,7 @@ public class SubscriberB : EndpointConfigurationBuilder { public SubscriberB() { - EndpointSetup(c => - { - c.MessageDrivenPubSubRouting().RegisterPublisher(typeof(MyEvent), PublisherEndpoint); - }); + EndpointSetup(publisherMetadata: metadata => metadata.RegisterPublisherFor(typeof(Publisher))); } public class MyEventHandler : IHandleMessages diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_subscribing_to_a_base_event.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_subscribing_to_a_base_event.cs similarity index 96% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_subscribing_to_a_base_event.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_subscribing_to_a_base_event.cs index 73d4f236c..67d025153 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_subscribing_to_a_base_event.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_subscribing_to_a_base_event.cs @@ -54,8 +54,8 @@ public GeneralSubscriber() EndpointSetup(c => { c.DisableFeature(); - }) - .AddMapping(typeof(Publisher)); + }, + metadata => metadata.RegisterPublisherFor(typeof(Publisher))); } public class MyEventHandler : IHandleMessages diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_subscribing_to_a_base_event_with_a_route_for_a_derived_event.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_subscribing_to_a_base_event_with_a_route_for_a_derived_event.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_subscribing_to_a_base_event_with_a_route_for_a_derived_event.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_subscribing_to_a_base_event_with_a_route_for_a_derived_event.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_subscribing_to_a_derived_event.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_subscribing_to_a_derived_event.cs similarity index 96% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_subscribing_to_a_derived_event.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_subscribing_to_a_derived_event.cs index 3435001e0..6b49d083e 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_subscribing_to_a_derived_event.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_subscribing_to_a_derived_event.cs @@ -54,8 +54,8 @@ public Subscriber() { c.DisableFeature(); c.LimitMessageProcessingConcurrencyTo(1); //To ensure Done is processed after the event. - }) - .AddMapping(typeof(Publisher)); + }, + metadata => metadata.RegisterPublisherFor(typeof(Publisher))); } public class MyEventHandler : IHandleMessages diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_subscribing_to_a_base_event_with_routes_to_base_and_specific_events.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_subscribing_to_event_with_routes_to_base_and_specific_events.cs similarity index 96% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_subscribing_to_a_base_event_with_routes_to_base_and_specific_events.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_subscribing_to_event_with_routes_to_base_and_specific_events.cs index acd08db2c..afe0d46ca 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_subscribing_to_a_base_event_with_routes_to_base_and_specific_events.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_subscribing_to_event_with_routes_to_base_and_specific_events.cs @@ -7,7 +7,7 @@ using NUnit.Framework; using ScenarioDescriptors; - public class When_subscribing_to_a_base_event_with_routes_to_base_and_specific_events : NServiceBusAcceptanceTest + public class When_subscribing_to_event_with_routes_to_base_and_specific_events : NServiceBusAcceptanceTest { [Test] public Task Event_from_both_publishers_should_be_delivered() diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_subscribing_to_multiple_publishers.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_subscribing_to_multiple_publishers.cs similarity index 84% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_subscribing_to_multiple_publishers.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_subscribing_to_multiple_publishers.cs index 40b0f989d..92e16abdc 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_subscribing_to_multiple_publishers.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_subscribing_to_multiple_publishers.cs @@ -10,9 +10,9 @@ public class When_subscribing_to_multiple_publishers : NServiceBusAcceptanceTest { [Test] - public async Task Should_subscribe_to_all_registered_publishers_of_same_type() + public Task Should_subscribe_to_all_registered_publishers_of_same_type() { - await Scenario.Define() + return Scenario.Define() .WithEndpoint(e => e .When(s => s.Subscribe())) .WithEndpoint(e => e @@ -50,9 +50,10 @@ public Subscriber() EndpointSetup(c => { c.DisableFeature(); - var routing = c.MessageDrivenPubSubRouting(); - routing.RegisterPublisher(typeof(SomeEvent).Assembly, "Publisher1"); - routing.RegisterPublisher(typeof(SomeEvent), "Publisher2"); + }, metadata => + { + metadata.RegisterPublisherFor("Publisher1"); + metadata.RegisterPublisherFor("Publisher2"); }); } } @@ -65,7 +66,7 @@ public Publisher() } } - class SomeEvent : IEvent + public class SomeEvent : IEvent { } } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_subscribing_to_scaled_out_publisher.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_subscribing_to_scaled_out_publisher.cs similarity index 94% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_subscribing_to_scaled_out_publisher.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_subscribing_to_scaled_out_publisher.cs index b9fcc83ac..c1792835a 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_subscribing_to_scaled_out_publisher.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_subscribing_to_scaled_out_publisher.cs @@ -56,13 +56,12 @@ public Subscriber() // configure the scaled out publisher instances: var publisherName = Conventions.EndpointNamingConvention(typeof(ScaledOutPublisher)); var routing = c.UseTransport(r.GetTransportType()).Routing(); - c.MessageDrivenPubSubRouting().RegisterPublisher(typeof(MyEvent), publisherName); routing.RegisterEndpointInstances(new EndpointInstance(publisherName, "1"), new EndpointInstance(publisherName, "2")); - }); + }, metadata => metadata.RegisterPublisherFor(typeof(ScaledOutPublisher))); } } - class MyEvent : IEvent + public class MyEvent : IEvent { } } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_unsubscribing_from_event.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_unsubscribing_from_event.cs new file mode 100644 index 000000000..105a03eb1 --- /dev/null +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_unsubscribing_from_event.cs @@ -0,0 +1,139 @@ +namespace NServiceBus.AcceptanceTests.Routing.MessageDrivenSubscriptions +{ + using System.Threading.Tasks; + using AcceptanceTesting; + using AcceptanceTesting.Customization; + using EndpointTemplates; + using Features; + using NUnit.Framework; + using ScenarioDescriptors; + + public class When_unsubscribing_from_event : NServiceBusAcceptanceTest + { + [Test] + public Task ShouldNoLongerReceiveEvent() + { + return Scenario.Define() + .WithEndpoint(c => c + .When( + ctx => ctx.Subscriber1Subscribed && ctx.Subscriber2Subscribed, + s => s.Publish(new Event())) + .When( + ctx => ctx.Subscriber2Unsubscribed, + async s => + { + await s.Publish(new Event()); + await s.Publish(new Event()); + await s.Publish(new Event()); + })) + .WithEndpoint(c => c + .When(s => s.Subscribe())) + .WithEndpoint(c => c + .When(s => s.Subscribe()) + .When( + ctx => ctx.Subscriber2ReceivedMessages >= 1, + s => s.Unsubscribe())) + .Done(c => c.Subscriber1ReceivedMessages >= 4) + .Repeat(r => r.For()) + .Should(c => + { + Assert.AreEqual(4, c.Subscriber1ReceivedMessages); + Assert.AreEqual(1, c.Subscriber2ReceivedMessages); + Assert.IsTrue(c.Subscriber2Unsubscribed); + }) + .Run(); + } + + public class Context : ScenarioContext + { + public bool Subscriber1Subscribed { get; set; } + public bool Subscriber2Subscribed { get; set; } + public bool Subscriber2Unsubscribed { get; set; } + public int Subscriber1ReceivedMessages { get; set; } + public int Subscriber2ReceivedMessages { get; set; } + } + + public class Publisher : EndpointConfigurationBuilder + { + public Publisher() + { + EndpointSetup(c => + { + c.OnEndpointSubscribed((args, ctx) => + { + if (args.SubscriberReturnAddress.Contains(Conventions.EndpointNamingConvention(typeof(Subscriber1)))) + { + ctx.Subscriber1Subscribed = true; + } + + if (args.SubscriberReturnAddress.Contains(Conventions.EndpointNamingConvention(typeof(Subscriber2)))) + { + ctx.Subscriber2Subscribed = true; + } + }); + c.OnEndpointUnsubscribed((args, ctx) => + { + if (args.SubscriberReturnAddress.Contains(Conventions.EndpointNamingConvention(typeof(Subscriber2)))) + { + ctx.Subscriber2Unsubscribed = true; + } + }); + }); + } + } + + public class Subscriber1 : EndpointConfigurationBuilder + { + public Subscriber1() + { + EndpointSetup(c => c.DisableFeature(), + metadata => metadata.RegisterPublisherFor(typeof(Publisher))); + } + + public class EventHandler : IHandleMessages + { + public EventHandler(Context testContext) + { + this.testContext = testContext; + } + + public Task Handle(Event message, IMessageHandlerContext context) + { + testContext.Subscriber1ReceivedMessages++; + return Task.FromResult(0); + } + + Context testContext; + } + } + + public class Subscriber2 : EndpointConfigurationBuilder + { + public Subscriber2() + { + EndpointSetup(c => c.DisableFeature(), + metadata => metadata.RegisterPublisherFor(typeof(Publisher))); + } + + public class EventHandler : IHandleMessages + { + public EventHandler(Context testContext) + { + this.testContext = testContext; + } + + public Task Handle(Event message, IMessageHandlerContext context) + { + testContext.Subscriber2ReceivedMessages++; + return Task.FromResult(0); + } + + Context testContext; + } + } + + public class Event : IEvent + { + } + } +} \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_unsubscribing_to_scaled_out_publisher.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_unsubscribing_to_scaled_out_publisher.cs similarity index 95% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_unsubscribing_to_scaled_out_publisher.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_unsubscribing_to_scaled_out_publisher.cs index 7220f8b55..fe934dc20 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_unsubscribing_to_scaled_out_publisher.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_unsubscribing_to_scaled_out_publisher.cs @@ -58,13 +58,12 @@ public Unsubscriber() // configure the scaled out publisher instances: var publisherName = Conventions.EndpointNamingConvention(typeof(ScaledOutPublisher)); var routing = c.UseTransport(r.GetTransportType()).Routing(); - c.MessageDrivenPubSubRouting().RegisterPublisher(typeof(MyEvent), publisherName); routing.RegisterEndpointInstances(new EndpointInstance(publisherName, "1"), new EndpointInstance(publisherName, "2")); - }); + }, metadata => metadata.RegisterPublisherFor(typeof(ScaledOutPublisher))); } } - class MyEvent : IEvent + public class MyEvent : IEvent { } } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_using_assembly_level_message_mapping_for_pub_sub.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_using_assembly_level_message_mapping_for_pub_sub.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_using_assembly_level_message_mapping_for_pub_sub.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_using_assembly_level_message_mapping_for_pub_sub.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_using_autosubscribe_with_missing_routing_information.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_using_autosubscribe_with_missing_routing_information.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_using_autosubscribe_with_missing_routing_information.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_using_autosubscribe_with_missing_routing_information.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_using_legacy_routing_configuration.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_using_legacy_routing_configuration.cs similarity index 95% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_using_legacy_routing_configuration.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_using_legacy_routing_configuration.cs index 79d433af6..978797b0d 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/MessageDrivenSubscriptions/When_using_legacy_routing_configuration.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/MessageDrivenSubscriptions/When_using_legacy_routing_configuration.cs @@ -39,7 +39,6 @@ public class Publisher : EndpointConfigurationBuilder public Publisher() { EndpointSetup(b => b.OnEndpointSubscribed((s, context) => { context.Subscribed = true; })) - .AddMapping(typeof(Subscriber)) .AddMapping(typeof(Subscriber)); } } @@ -52,8 +51,8 @@ public Subscriber() { c.DisableFeature(); c.LimitMessageProcessingConcurrencyTo(1); - }) - .AddMapping(typeof(Publisher)); + }, + metadata => metadata.RegisterPublisherFor(typeof(Publisher))); } public class MyEventHandler : IHandleMessages diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/NativePublishSubscribe/When_multi_subscribing_to_a_polymorphic_event.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/NativePublishSubscribe/When_multi_subscribing_to_a_polymorphic_event.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/NativePublishSubscribe/When_multi_subscribing_to_a_polymorphic_event.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/NativePublishSubscribe/When_multi_subscribing_to_a_polymorphic_event.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/NativePublishSubscribe/When_publishing_to_scaled_out_subscribers.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/NativePublishSubscribe/When_publishing_to_scaled_out_subscribers.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/NativePublishSubscribe/When_publishing_to_scaled_out_subscribers.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/NativePublishSubscribe/When_publishing_to_scaled_out_subscribers.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/NativePublishSubscribe/When_unsubscribing_from_event.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/NativePublishSubscribe/When_unsubscribing_from_event.cs new file mode 100644 index 000000000..3e7577b6b --- /dev/null +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/NativePublishSubscribe/When_unsubscribing_from_event.cs @@ -0,0 +1,134 @@ +namespace NServiceBus.AcceptanceTests.Routing.NativePublishSubscribe +{ + using System.Threading.Tasks; + using AcceptanceTesting; + using EndpointTemplates; + using Features; + using NUnit.Framework; + using ScenarioDescriptors; + + public class When_unsubscribing_from_event : NServiceBusAcceptanceTest + { + [Test] + public async Task ShouldNoLongerReceiveEvent() + { + await Scenario.Define() + .WithEndpoint(c => c + .When( + ctx => ctx.Subscriber1Subscribed && ctx.Subscriber2Subscribed, + s => s.Publish(new Event())) + .When( + ctx => ctx.Subscriber2Unsubscribed, + async s => + { + await s.Publish(new Event()); + await s.Publish(new Event()); + await s.Publish(new Event()); + + })) + .WithEndpoint(c => c + .When(async (s, ctx) => + { + await s.Subscribe(); + ctx.Subscriber1Subscribed = true; + })) + .WithEndpoint(c => c + .When(async (s, ctx) => + { + await s.Subscribe(); + ctx.Subscriber2Subscribed = true; + }) + .When( + ctx => ctx.Subscriber2ReceivedMessages >= 1, + async (s, ctx) => + { + await s.Unsubscribe(); + ctx.Subscriber2Unsubscribed = true; + })) + .Done(c => c.Subscriber1ReceivedMessages >= 4) + .Repeat(r => r.For()) + .Should(c => + { + Assert.AreEqual(4, c.Subscriber1ReceivedMessages); + Assert.AreEqual(1, c.Subscriber2ReceivedMessages); + Assert.IsTrue(c.Subscriber2Unsubscribed); + }) + .Run(); + } + + public class Context : ScenarioContext + { + public bool Subscriber1Subscribed { get; set; } + public bool Subscriber2Subscribed { get; set; } + public bool Subscriber2Unsubscribed { get; set; } + public int Subscriber1ReceivedMessages { get; set; } + public int Subscriber2ReceivedMessages { get; set; } + } + + public class Publisher : EndpointConfigurationBuilder + { + public Publisher() + { + EndpointSetup(); + } + } + + public class Subscriber1 : EndpointConfigurationBuilder + { + public Subscriber1() + { + EndpointSetup(c => + { + c.DisableFeature(); + }); + } + + public class EventHandler : IHandleMessages + { + Context testContext; + + public EventHandler(Context testContext) + { + this.testContext = testContext; + } + + public Task Handle(Event message, IMessageHandlerContext context) + { + testContext.Subscriber1ReceivedMessages++; + return Task.FromResult(0); + } + } + } + + public class Subscriber2 : EndpointConfigurationBuilder + { + public Subscriber2() + { + EndpointSetup(c => + { + c.DisableFeature(); + }); + } + + public class EventHandler : IHandleMessages + { + Context testContext; + + public EventHandler(Context testContext) + { + this.testContext = testContext; + } + + public Task Handle(Event message, IMessageHandlerContext context) + { + testContext.Subscriber2ReceivedMessages++; + return Task.FromResult(0); + } + } + } + + public class Event : IEvent + { + } + } +} \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/SubscriptionBehavior.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/SubscriptionBehavior.cs similarity index 73% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/SubscriptionBehavior.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/SubscriptionBehavior.cs index e54a6360d..ef573220a 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/SubscriptionBehavior.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/SubscriptionBehavior.cs @@ -4,10 +4,9 @@ using System.Threading.Tasks; using AcceptanceTesting; using NServiceBus.Pipeline; - using ObjectBuilder; using Transport; - class SubscriptionBehavior : IBehavior where TContext : ScenarioContext + class SubscriptionBehavior : IBehavior where TContext : ScenarioContext { public SubscriptionBehavior(Action action, TContext scenarioContext, MessageIntentEnum intentToHandle) { @@ -16,7 +15,7 @@ public SubscriptionBehavior(Action action, TCon this.intentToHandle = intentToHandle; } - public async Task Invoke(IIncomingPhysicalMessageContext context, Func next) + public async Task Invoke(ITransportReceiveContext context, Func next) { await next(context).ConfigureAwait(false); var subscriptionMessageType = GetSubscriptionMessageTypeFrom(context.Message); @@ -51,14 +50,5 @@ static string GetSubscriptionMessageTypeFrom(IncomingMessage msg) Action action; TContext scenarioContext; MessageIntentEnum intentToHandle; - - internal class Registration : RegisterStep - { - public Registration(string id, Func behaviorFactory) - : base(id, typeof(SubscriptionBehavior), "notify subscription events", behaviorFactory) - { - InsertBeforeIfExists("ProcessSubscriptionRequests"); - } - } } } \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/SubscriptionBehaviorExtensions.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/SubscriptionBehaviorExtensions.cs similarity index 74% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/SubscriptionBehaviorExtensions.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/SubscriptionBehaviorExtensions.cs index e184ef5b4..a2b5c7893 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/SubscriptionBehaviorExtensions.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/SubscriptionBehaviorExtensions.cs @@ -7,20 +7,20 @@ static class SubscriptionBehaviorExtensions { public static void OnEndpointSubscribed(this EndpointConfiguration configuration, Action action) where TContext : ScenarioContext { - configuration.Pipeline.Register(new SubscriptionBehavior.Registration("NotifySubscriptionBehavior", builder => + configuration.Pipeline.Register("NotifySubscriptionBehavior", builder => { var context = builder.Build(); return new SubscriptionBehavior(action, context, MessageIntentEnum.Subscribe); - })); + }, "Provides notifications when endpoints subscribe"); } public static void OnEndpointUnsubscribed(this EndpointConfiguration configuration, Action action) where TContext : ScenarioContext { - configuration.Pipeline.Register(new SubscriptionBehavior.Registration("NotifyUnsubscriptionBehavior", builder => + configuration.Pipeline.Register("NotifyUnsubscriptionBehavior", builder => { var context = builder.Build(); return new SubscriptionBehavior(action, context, MessageIntentEnum.Unsubscribe); - })); + }, "Provides notifications when endpoints unsubscribe"); } } } \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/SubscriptionEventArgs.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/SubscriptionEventArgs.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/SubscriptionEventArgs.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/SubscriptionEventArgs.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_base_event_from_2_publishers.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_base_event_from_2_publishers.cs similarity index 93% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_base_event_from_2_publishers.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_base_event_from_2_publishers.cs index aba9185e0..b79cc0f39 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_base_event_from_2_publishers.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_base_event_from_2_publishers.cs @@ -1,6 +1,5 @@ namespace NServiceBus.AcceptanceTests.Routing { - using System; using System.Threading.Tasks; using AcceptanceTesting; using EndpointTemplates; @@ -80,9 +79,12 @@ public class Subscriber1 : EndpointConfigurationBuilder { public Subscriber1() { - EndpointSetup(c => c.DisableFeature()) - .AddMapping(typeof(Publisher1)) - .AddMapping(typeof(Publisher2)); + EndpointSetup(c => c.DisableFeature(), + metadata => + { + metadata.RegisterPublisherFor(typeof(Publisher1)); + metadata.RegisterPublisherFor(typeof(Publisher2)); + }); } public class BaseEventHandler : IHandleMessages @@ -105,17 +107,17 @@ public Task Handle(BaseEvent message, IMessageHandlerContext context) } } - [Serializable] + public class BaseEvent : IEvent { } - [Serializable] + public class DerivedEvent1 : BaseEvent { } - [Serializable] + public class DerivedEvent2 : BaseEvent { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_configure_routes_for_unobtrusive_messages.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_configure_routes_for_unobtrusive_messages.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_configure_routes_for_unobtrusive_messages.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_configure_routes_for_unobtrusive_messages.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_extending_command_routing.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_extending_command_routing.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_extending_command_routing.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_extending_command_routing.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_overriding_local_address.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_overriding_local_address.cs similarity index 84% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_overriding_local_address.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_overriding_local_address.cs index c0f6961b0..d4150783f 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_overriding_local_address.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_overriding_local_address.cs @@ -1,12 +1,10 @@ -namespace ServiceBus.AcceptanceTests.Routing +namespace NServiceBus.AcceptanceTests.Routing { using System.Threading.Tasks; - using NServiceBus; - using NServiceBus.AcceptanceTesting; - using NServiceBus.AcceptanceTests; - using NServiceBus.AcceptanceTests.EndpointTemplates; + using AcceptanceTesting; + using AcceptanceTesting.Customization; + using EndpointTemplates; using NUnit.Framework; - using Conventions = NServiceBus.AcceptanceTesting.Customization.Conventions; public class When_overriding_local_address : NServiceBusAcceptanceTest { @@ -39,9 +37,7 @@ public class Sender : EndpointConfigurationBuilder { public Sender() { - EndpointSetup(c => - { - }); + EndpointSetup(c => { }); } } @@ -54,8 +50,6 @@ public Receiver() public class MessageHandler : IHandleMessages { - Context testContext; - public MessageHandler(Context testContext) { this.testContext = testContext; @@ -66,6 +60,8 @@ public Task Handle(Message message, IMessageHandlerContext context) testContext.ReceivedMessage = true; return Task.FromResult(0); } + + Context testContext; } } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_publishing.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_publishing.cs similarity index 95% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_publishing.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_publishing.cs index cf4aae654..1a6867d9d 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_publishing.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_publishing.cs @@ -137,8 +137,8 @@ public class Subscriber3 : EndpointConfigurationBuilder { public Subscriber3() { - EndpointSetup(c => c.DisableFeature()) - .AddMapping(typeof(Publisher3)); + EndpointSetup(c => c.DisableFeature(), + metadata => metadata.RegisterPublisherFor(typeof(Publisher3))); } public class MyEventHandler : IHandleMessages @@ -157,8 +157,8 @@ public class Subscriber1 : EndpointConfigurationBuilder { public Subscriber1() { - EndpointSetup(c => c.DisableFeature()) - .AddMapping(typeof(Publisher)); + EndpointSetup(c => c.DisableFeature(), + metadata => metadata.RegisterPublisherFor(typeof(Publisher))); } public class MyEventHandler : IHandleMessages @@ -178,8 +178,8 @@ public class Subscriber2 : EndpointConfigurationBuilder { public Subscriber2() { - EndpointSetup(c => c.DisableFeature()) - .AddMapping(typeof(Publisher)); + EndpointSetup(c => c.DisableFeature(), + metadata => metadata.RegisterPublisherFor(typeof(Publisher))); } public class MyEventHandler : IHandleMessages @@ -198,7 +198,7 @@ public interface IFoo : IEvent { } - [Serializable] + public class MyEvent : IEvent { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_publishing_an_event_implementing_two_unrelated_interfaces.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_publishing_an_event_implementing_two_unrelated_interfaces.cs similarity index 83% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_publishing_an_event_implementing_two_unrelated_interfaces.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_publishing_an_event_implementing_two_unrelated_interfaces.cs index b458d9b4a..79fe2bbff 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_publishing_an_event_implementing_two_unrelated_interfaces.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_publishing_an_event_implementing_two_unrelated_interfaces.cs @@ -79,17 +79,20 @@ public class Subscriber : EndpointConfigurationBuilder public Subscriber() { EndpointSetup(c => - { - c.Conventions().DefiningMessagesAs(t => t != typeof(CompositeEvent) && typeof(IMessage).IsAssignableFrom(t) && - typeof(IMessage) != t && - typeof(IEvent) != t && - typeof(ICommand) != t); - - c.Conventions().DefiningEventsAs(t => t != typeof(CompositeEvent) && typeof(IEvent).IsAssignableFrom(t) && typeof(IEvent) != t); - c.DisableFeature(); - }) - .AddMapping(typeof(Publisher)) - .AddMapping(typeof(Publisher)); + { + c.Conventions().DefiningMessagesAs(t => t != typeof(CompositeEvent) && typeof(IMessage).IsAssignableFrom(t) && + typeof(IMessage) != t && + typeof(IEvent) != t && + typeof(ICommand) != t); + + c.Conventions().DefiningEventsAs(t => t != typeof(CompositeEvent) && typeof(IEvent).IsAssignableFrom(t) && typeof(IEvent) != t); + c.DisableFeature(); + }, + metadata => + { + metadata.RegisterPublisherFor(typeof(Publisher)); + metadata.RegisterPublisherFor(typeof(Publisher)); + }); } public class EventAHandler : IHandleMessages diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_publishing_an_interface.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_publishing_an_interface.cs similarity index 91% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_publishing_an_interface.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_publishing_an_interface.cs index f4c02f68f..eca1d6bbb 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_publishing_an_interface.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_publishing_an_interface.cs @@ -35,14 +35,14 @@ await Scenario.Define() .Run(); } - class Context : ScenarioContext + public class Context : ScenarioContext { public bool GotTheEvent { get; set; } public bool Subscribed { get; set; } public Type EventTypePassedToRouting { get; set; } } - class Publisher : EndpointConfigurationBuilder + public class Publisher : EndpointConfigurationBuilder { public Publisher() { @@ -76,12 +76,12 @@ public Task Invoke(IOutgoingLogicalMessageContext context, Func(c => c.DisableFeature()) - .AddMapping(typeof(Publisher)); + EndpointSetup(c => c.DisableFeature(), + metadata => metadata.RegisterPublisherFor(typeof(Publisher))); } public class MyEventHandler : IHandleMessages diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_publishing_an_interface_with_unobtrusive.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_publishing_an_interface_with_unobtrusive.cs similarity index 92% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_publishing_an_interface_with_unobtrusive.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_publishing_an_interface_with_unobtrusive.cs index 0b8f552a1..06a0de839 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_publishing_an_interface_with_unobtrusive.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_publishing_an_interface_with_unobtrusive.cs @@ -35,14 +35,14 @@ await Scenario.Define() .Run(); } - class Context : ScenarioContext + public class Context : ScenarioContext { public bool GotTheEvent { get; set; } public bool Subscribed { get; set; } public Type EventTypePassedToRouting { get; set; } } - class Publisher : EndpointConfigurationBuilder + public class Publisher : EndpointConfigurationBuilder { public Publisher() { @@ -77,7 +77,7 @@ public Task Invoke(IOutgoingLogicalMessageContext context, Func t.Namespace != null && t.Name.EndsWith("Event")); c.DisableFeature(); - }) - .AddMapping(typeof(Publisher)); + }, + metadata => metadata.RegisterPublisherFor(typeof(Publisher))); } public class MyEventHandler : IHandleMessages diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_publishing_using_root_type.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_publishing_using_root_type.cs similarity index 96% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_publishing_using_root_type.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_publishing_using_root_type.cs index 2c9681313..80eb0c203 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_publishing_using_root_type.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_publishing_using_root_type.cs @@ -60,8 +60,7 @@ public class Subscriber1 : EndpointConfigurationBuilder { public Subscriber1() { - EndpointSetup(c => c.DisableFeature()) - .AddMapping(typeof(Publisher)); + EndpointSetup(c => c.DisableFeature(), p => p.RegisterPublisherFor(typeof(Publisher))); } public class MyEventHandler : IHandleMessages @@ -76,7 +75,7 @@ public Task Handle(EventMessage messageThatIsEnlisted, IMessageHandlerContext co } } - [Serializable] + public class EventMessage : IMyEvent { public Guid EventId { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_publishing_with_only_local_messagehandlers.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_publishing_with_only_local_messagehandlers.cs similarity index 90% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_publishing_with_only_local_messagehandlers.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_publishing_with_only_local_messagehandlers.cs index 6274576e9..bff824ee4 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_publishing_with_only_local_messagehandlers.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_publishing_with_only_local_messagehandlers.cs @@ -1,6 +1,5 @@ namespace NServiceBus.AcceptanceTests.Routing { - using System; using System.Threading.Tasks; using AcceptanceTesting; using EndpointTemplates; @@ -47,8 +46,8 @@ public class MessageDrivenPublisher : EndpointConfigurationBuilder { public MessageDrivenPublisher() { - EndpointSetup(b => b.OnEndpointSubscribed((s, context) => { context.LocalEndpointSubscribed = true; })) - .AddMapping(typeof(MessageDrivenPublisher)); //an explicit mapping is needed + EndpointSetup(b => b.OnEndpointSubscribed((s, context) => { context.LocalEndpointSubscribed = true; }), + metadata => metadata.RegisterPublisherFor(typeof(MessageDrivenPublisher))); } class CatchAllHandler : IHandleMessages //not enough for auto subscribe to work @@ -76,8 +75,7 @@ public class CentralizedStoragePublisher : EndpointConfigurationBuilder { public CentralizedStoragePublisher() { - EndpointSetup() - .AddMapping(typeof(CentralizedStoragePublisher)); //an explicit mapping may be needed, depends on the technology underneath; + EndpointSetup(publisherMetadata: metadata => metadata.RegisterPublisherFor(typeof(CentralizedStoragePublisher))); } class CatchAllHandler : IHandleMessages @@ -100,7 +98,7 @@ public Task Handle(EventHandledByLocalEndpoint message, IMessageHandlerContext c } } - [Serializable] + public class EventHandledByLocalEndpoint : IEvent { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_publishing_with_overridden_local_address.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_publishing_with_overridden_local_address.cs similarity index 92% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_publishing_with_overridden_local_address.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_publishing_with_overridden_local_address.cs index 10d933b70..c5f734e18 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_publishing_with_overridden_local_address.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_publishing_with_overridden_local_address.cs @@ -1,6 +1,5 @@ namespace NServiceBus.AcceptanceTests.Routing { - using System; using System.Threading.Tasks; using AcceptanceTesting; using EndpointTemplates; @@ -59,9 +58,8 @@ public Subscriber1() EndpointSetup(builder => { builder.DisableFeature(); - //builder.OverrideLocalAddress("myInputQueue"); Fix in 133 - }) - .AddMapping(typeof(Publisher)); + }, + metadata => metadata.RegisterPublisherFor(typeof(Publisher))); } public class MyEventHandler : IHandleMessages @@ -76,7 +74,7 @@ public Task Handle(MyEvent messageThatIsEnlisted, IMessageHandlerContext context } } - [Serializable] + public class MyEvent : IEvent { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_registering_publishers_unobtrusive_messages_code.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_registering_publishers_unobtrusive_messages_code.cs similarity index 85% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_registering_publishers_unobtrusive_messages_code.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_registering_publishers_unobtrusive_messages_code.cs index d40272565..9503cc3b9 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_registering_publishers_unobtrusive_messages_code.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_registering_publishers_unobtrusive_messages_code.cs @@ -4,7 +4,6 @@ using AcceptanceTesting; using EndpointTemplates; using NUnit.Framework; - using AcceptanceTesting.Customization; using ScenarioDescriptors; public class When_registering_publishers_unobtrusive_messages_code : NServiceBusAcceptanceTest @@ -48,12 +47,9 @@ public class Subscriber : EndpointConfigurationBuilder { public Subscriber() { - EndpointSetup(c => - { - c.Conventions().DefiningEventsAs(t => t == typeof(SomeEvent)); - - c.MessageDrivenPubSubRouting().RegisterPublisher(typeof(SomeEvent).Assembly, Conventions.EndpointNamingConvention(typeof(Publisher))); - }); + EndpointSetup( + c => c.Conventions().DefiningEventsAs(t => t == typeof(SomeEvent)), + metadata => metadata.RegisterPublisherFor(typeof(Publisher))); } public class EventHandler : IHandleMessages diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_registering_publishers_unobtrusive_messages_config.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_registering_publishers_unobtrusive_messages_config.cs similarity index 91% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_registering_publishers_unobtrusive_messages_config.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_registering_publishers_unobtrusive_messages_config.cs index 0ef0e1077..ec0f5be58 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_registering_publishers_unobtrusive_messages_config.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_registering_publishers_unobtrusive_messages_config.cs @@ -47,9 +47,8 @@ public class Subscriber : EndpointConfigurationBuilder { public Subscriber() { - EndpointSetup(c => c - .Conventions().DefiningEventsAs(t => t == typeof(SomeEvent))) - .AddMapping(typeof(Publisher)); + EndpointSetup(c => c.Conventions().DefiningEventsAs(t => t == typeof(SomeEvent)), + metadata => metadata.RegisterPublisherFor(typeof(Publisher))); } public class EventHandler : IHandleMessages diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_replying_to_message.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_replying_to_message.cs similarity index 97% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_replying_to_message.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_replying_to_message.cs index 88ac15f24..44cf364ca 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_replying_to_message.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_replying_to_message.cs @@ -49,7 +49,7 @@ public class SendingEndpoint : EndpointConfigurationBuilder { public SendingEndpoint() { - EndpointSetup().AddMapping(typeof(ReplyingEndpoint)); + EndpointSetup().AddMapping(typeof(ReplyingEndpoint)); } public class ResponseHandler : IHandleMessages diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_replying_to_message_with_interface_and_unobtrusive.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_replying_to_message_with_interface_and_unobtrusive.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_replying_to_message_with_interface_and_unobtrusive.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_replying_to_message_with_interface_and_unobtrusive.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_sending_a_base_command.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_sending_a_base_command.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_sending_a_base_command.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_sending_a_base_command.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_sending_non_message_with_routing_configured_by_assembly.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_sending_non_message_with_routing_configured_by_assembly.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_sending_non_message_with_routing_configured_by_assembly.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_sending_non_message_with_routing_configured_by_assembly.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_sending_non_message_with_routing_configured_by_type.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_sending_non_message_with_routing_configured_by_type.cs similarity index 92% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_sending_non_message_with_routing_configured_by_type.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_sending_non_message_with_routing_configured_by_type.cs index 5de361904..01e87094e 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_sending_non_message_with_routing_configured_by_type.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_sending_non_message_with_routing_configured_by_type.cs @@ -11,7 +11,7 @@ public class When_sending_non_message_with_routing_configured_by_type : NService [Test] public void Should_throw_when_configuring_routing() { - var exception = Assert.ThrowsAsync(async () => await Scenario.Define() + var exception = Assert.ThrowsAsync(async () => await Scenario.Define() .WithEndpoint(c => c .When(b => b.Send(new NonMessage()))) .Done(c => c.EndpointsStarted) diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_sending_non_message_with_routing_configured_via_mappings.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_sending_non_message_with_routing_configured_via_mappings.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_sending_non_message_with_routing_configured_via_mappings.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_sending_non_message_with_routing_configured_via_mappings.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_using_instance_ids.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_using_instance_ids.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/When_using_instance_ids.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/When_using_instance_ids.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/when_replying_to_a_message_sent_to_specific_instance.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/when_replying_to_a_message_sent_to_specific_instance.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Routing/when_replying_to_a_message_sent_to_specific_instance.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Routing/when_replying_to_a_message_sent_to_specific_instance.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/RunDescriptorExtensions.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/RunDescriptorExtensions.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/RunDescriptorExtensions.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/RunDescriptorExtensions.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_a_base_class_mapped_is_handled_by_a_saga.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_a_base_class_mapped_is_handled_by_a_saga.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_a_base_class_mapped_is_handled_by_a_saga.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_a_base_class_mapped_is_handled_by_a_saga.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_a_base_class_message_starts_a_saga.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_a_base_class_message_starts_a_saga.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_a_base_class_message_starts_a_saga.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_a_base_class_message_starts_a_saga.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_a_finder_exists_and_context_information_added.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_adding_state_to_context.cs similarity index 76% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_a_finder_exists_and_context_information_added.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_adding_state_to_context.cs index 6a3039ebc..6e2f96901 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_a_finder_exists_and_context_information_added.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_adding_state_to_context.cs @@ -5,7 +5,6 @@ namespace NServiceBus.AcceptanceTests.Sagas using AcceptanceTesting; using EndpointTemplates; using Extensibility; - using Features; using NServiceBus; using NServiceBus.Pipeline; using NServiceBus.Sagas; @@ -13,13 +12,14 @@ namespace NServiceBus.AcceptanceTests.Sagas using Persistence; [TestFixture] - public class When_a_finder_exists_and_context_information_added : NServiceBusAcceptanceTest + public class When_adding_state_to_context : NServiceBusAcceptanceTest { [Test] - public async Task Should_make_context_information_available() + public async Task Should_make_state_available_to_finder_context() { var context = await Scenario.Define() - .WithEndpoint(b => b.When(session => session.SendLocal(new StartSagaMessage()))) + .WithEndpoint(b => b + .When(session => session.SendLocal(new StartSagaMessage()))) .Done(c => c.FinderUsed) .Run(); @@ -27,20 +27,19 @@ public async Task Should_make_context_information_available() Assert.AreEqual("SomeData", context.ContextBag.Get().SomeData); } - class Context : ScenarioContext + public class Context : ScenarioContext { public bool FinderUsed { get; set; } public ReadOnlyContextBag ContextBag { get; set; } } - class SagaEndpoint : EndpointConfigurationBuilder + public class SagaEndpoint : EndpointConfigurationBuilder { public SagaEndpoint() { EndpointSetup(c => { - c.EnableFeature(); - c.Pipeline.Register(); + c.Pipeline.Register(new BehaviorWhichAddsThingsToTheContext(), "adds some data to the context"); }); } @@ -67,6 +66,7 @@ public Task Handle(StartSagaMessage message, IMessageHandlerContext context) protected override void ConfigureHowToFindSaga(SagaPropertyMapper mapper) { + // custom finder used } public class SagaData07 : ContainSagaData @@ -90,13 +90,6 @@ public class State { public string SomeData { get; set; } } - - public class Registration : RegisterStep - { - public Registration() : base("BehaviorWhichAddsThingsToTheContext", typeof(BehaviorWhichAddsThingsToTheContext), "BehaviorWhichAddsThingsToTheContext") - { - } - } } } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_an_endpoint_replies_to_a_saga.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_an_endpoint_replies_to_a_saga.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_an_endpoint_replies_to_a_saga.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_an_endpoint_replies_to_a_saga.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_auto_correlated_property_is_changed.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_auto_correlated_property_is_changed.cs similarity index 94% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_auto_correlated_property_is_changed.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_auto_correlated_property_is_changed.cs index fce2c2db7..d8f7b525e 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_auto_correlated_property_is_changed.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_auto_correlated_property_is_changed.cs @@ -14,7 +14,7 @@ public class When_auto_correlated_property_is_changed : NServiceBusAcceptanceTes [Test] public void Should_throw() { - var exception = Assert.ThrowsAsync(async () => + var exception = Assert.ThrowsAsync(async () => await Scenario.Define() .WithEndpoint( b => b.When(session => session.SendLocal(new StartSaga @@ -22,8 +22,7 @@ await Scenario.Define() DataId = Guid.NewGuid() }))) .Done(c => c.FailedMessages.Any()) - .Run()) - .ExpectFailedMessages(); + .Run()); Assert.IsTrue(((Context)exception.ScenarioContext).ModifiedCorrelationProperty); Assert.AreEqual(1, exception.FailedMessages.Count); diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_doing_request_response_between_sagas.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_doing_request_response_between_sagas.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_doing_request_response_between_sagas.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_doing_request_response_between_sagas.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_doing_request_response_between_sagas_first_handler_responding.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_doing_request_response_between_sagas_first_handler_responding.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_doing_request_response_between_sagas_first_handler_responding.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_doing_request_response_between_sagas_first_handler_responding.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_doing_request_response_between_sagas_response_from_noninitiating.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_doing_request_response_between_sagas_response_from_noninitiating.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_doing_request_response_between_sagas_response_from_noninitiating.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_doing_request_response_between_sagas_response_from_noninitiating.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_doing_request_response_between_sagas_with_timeout.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_doing_request_response_between_sagas_with_timeout.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_doing_request_response_between_sagas_with_timeout.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_doing_request_response_between_sagas_with_timeout.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_a_finder_exists.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_finder_cant_find_saga_instance.cs similarity index 84% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_a_finder_exists.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_finder_cant_find_saga_instance.cs index fed634a25..94b75893f 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_a_finder_exists.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_finder_cant_find_saga_instance.cs @@ -4,36 +4,37 @@ using AcceptanceTesting; using EndpointTemplates; using Extensibility; - using Features; using NServiceBus; using NServiceBus.Sagas; using NUnit.Framework; using Persistence; [TestFixture] - public class When_a_finder_exists : NServiceBusAcceptanceTest + public class When_finder_cant_find_saga_instance : NServiceBusAcceptanceTest { [Test] - public async Task Should_use_it_to_find_saga() + public async Task Should_start_new_saga() { var context = await Scenario.Define() .WithEndpoint(b => b.When(session => session.SendLocal(new StartSagaMessage()))) - .Done(c => c.FinderUsed) + .Done(c => c.SagaStarted) .Run(); Assert.True(context.FinderUsed); + Assert.True(context.SagaStarted); } public class Context : ScenarioContext { public bool FinderUsed { get; set; } + public bool SagaStarted { get; set; } } public class SagaEndpoint : EndpointConfigurationBuilder { public SagaEndpoint() { - EndpointSetup(c => c.EnableFeature()); + EndpointSetup(); } class CustomFinder : IFindSagas.Using @@ -53,6 +54,7 @@ public class TestSaga06 : Saga, IAmStartedByMessages() - .WithEndpoint(b => b.When(session => session.SendLocal(new StartSagaMessage { Property = "Test" }))) - .Done(c => c.Completed) + .WithEndpoint(b => b + .When(session => session.SendLocal(new StartSagaMessage + { + Property = "Test" + }))) + .Done(c => c.HandledOtherMessage) .Run(); Assert.True(context.FinderUsed); @@ -26,7 +31,7 @@ public async Task Should_find_saga_and_not_correlate() public class Context : ScenarioContext { public bool FinderUsed { get; set; } - public bool Completed { get; set; } + public bool HandledOtherMessage { get; set; } } public class SagaEndpoint : EndpointConfigurationBuilder @@ -46,13 +51,8 @@ public class CustomFinder : IFindSagas.Using FindBy(SomeOtherMessage message, SynchronizedStorageSession storageSession, ReadOnlyContextBag context) { Context.FinderUsed = true; - var sagaInstance = new TestSaga08.SagaData08 - { - Property = "jfbsjdfbsdjh" - }; - //Make sure saga exists in the store. Persisters expect it there when they save saga instance after processing a message. - await SagaPersister.Save(sagaInstance, SagaCorrelationProperty.None, storageSession, new ContextBag()).ConfigureAwait(false); - return sagaInstance; + var sagaData = await SagaPersister.Get(message.SagaId, storageSession, (ContextBag)context).ConfigureAwait(false); + return sagaData; } } @@ -64,12 +64,15 @@ public class TestSaga08 : Saga, public Task Handle(StartSagaMessage message, IMessageHandlerContext context) { - return context.SendLocal(new SomeOtherMessage()); + return context.SendLocal(new SomeOtherMessage + { + SagaId = Data.Id + }); } public Task Handle(SomeOtherMessage message, IMessageHandlerContext context) { - TestContext.Completed = true; + TestContext.HandledOtherMessage = true; return Task.FromResult(0); } @@ -93,7 +96,7 @@ public class StartSagaMessage : IMessage public class SomeOtherMessage : IMessage { - public string Property { get; set; } + public Guid SagaId { get; set; } } } } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_forgetting_to_set_a_corr_property.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_forgetting_to_set_a_corr_property.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_forgetting_to_set_a_corr_property.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_forgetting_to_set_a_corr_property.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_handling_message_with_handler_and_timeout_handler.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_handling_message_with_handler_and_timeout_handler.cs new file mode 100644 index 000000000..280427771 --- /dev/null +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_handling_message_with_handler_and_timeout_handler.cs @@ -0,0 +1,78 @@ +namespace NServiceBus.AcceptanceTests.Sagas +{ + using System; + using System.Threading.Tasks; + using AcceptanceTesting; + using EndpointTemplates; + using Features; + using NUnit.Framework; + + public class When_handling_message_with_handler_and_timeout_handler : NServiceBusAcceptanceTest + { + [Test] + public async Task Should_not_invoke_timeout_handler() + { + var context = await Scenario.Define() + .WithEndpoint(g => g.When(session => session.SendLocal(new StartSagaMessage + { + SomeId = Guid.NewGuid() + }))) + .Done(c => c.HandlerInvoked || c.TimeoutHandlerInvoked) + .Run(); + + Assert.True(context.HandlerInvoked, "Regular handler should be invoked"); + Assert.False(context.TimeoutHandlerInvoked, "Timeout handler should not be invoked"); + } + + public class Context : ScenarioContext + { + public bool TimeoutHandlerInvoked { get; set; } + public bool HandlerInvoked { get; set; } + } + + public class TimeoutSagaEndpoint : EndpointConfigurationBuilder + { + public TimeoutSagaEndpoint() + { + EndpointSetup(config => config.EnableFeature()); + } + + public class HandlerAndTimeoutSaga : Saga, IAmStartedByMessages, + IHandleTimeouts + { + public Context TestContext { get; set; } + + public Task Handle(StartSagaMessage message, IMessageHandlerContext context) + { + TestContext.HandlerInvoked = true; + return Task.FromResult(0); + } + + public Task Timeout(StartSagaMessage message, IMessageHandlerContext context) + { + TestContext.TimeoutHandlerInvoked = true; + return Task.FromResult(0); + } + + protected override void ConfigureHowToFindSaga(SagaPropertyMapper mapper) + { + mapper.ConfigureMapping(m => m.SomeId) + .ToSaga(s => s.SomeId); + } + } + + public class HandlerAndTimeoutSagaData : IContainSagaData + { + public virtual Guid SomeId { get; set; } + public virtual Guid Id { get; set; } + public virtual string Originator { get; set; } + public virtual string OriginalMessageId { get; set; } + } + } + + public class StartSagaMessage : IMessage + { + public Guid SomeId { get; set; } + } + } +} \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_message_has_a_saga_id.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_message_has_a_saga_id.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_message_has_a_saga_id.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_message_has_a_saga_id.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_receiving_that_completes_the_saga.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_receiving_that_completes_the_saga.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_receiving_that_completes_the_saga.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_receiving_that_completes_the_saga.cs index cbc4f1205..38692cece 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_receiving_that_completes_the_saga.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_receiving_that_completes_the_saga.cs @@ -154,19 +154,19 @@ public Task Handle(AnotherMessage message, IMessageHandlerContext context) } } - [Serializable] + public class StartSagaMessage : ICommand { public Guid SomeId { get; set; } } - [Serializable] + public class CompleteSagaMessage : ICommand { public Guid SomeId { get; set; } } - [Serializable] + public class AnotherMessage : ICommand { public Guid SomeId { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_receiving_that_should_start_a_saga.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_receiving_that_should_start_a_saga.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_receiving_that_should_start_a_saga.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_receiving_that_should_start_a_saga.cs index d3941c62c..117cb4419 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_receiving_that_should_start_a_saga.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_receiving_that_should_start_a_saga.cs @@ -1,6 +1,5 @@ namespace NServiceBus.AcceptanceTests.Sagas { - using System; using System.Threading.Tasks; using AcceptanceTesting; using EndpointTemplates; @@ -64,7 +63,7 @@ public Task Handle(StartSagaMessage message, IMessageHandlerContext context) } } - [Serializable] + public class StartSagaMessage : ICommand { public string SomeId { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_receiving_that_should_start_a_saga_with_interception.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_receiving_that_should_start_a_saga_with_interception.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_receiving_that_should_start_a_saga_with_interception.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_receiving_that_should_start_a_saga_with_interception.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_receiving_that_should_start_a_saga_without_interception.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_receiving_that_should_start_a_saga_without_interception.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_receiving_that_should_start_a_saga_without_interception.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_receiving_that_should_start_a_saga_without_interception.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_replies_to_message_published_by_a_saga.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_replies_to_message_published_by_a_saga.cs similarity index 94% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_replies_to_message_published_by_a_saga.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_replies_to_message_published_by_a_saga.cs index ed03d7587..a063eb52f 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_replies_to_message_published_by_a_saga.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_replies_to_message_published_by_a_saga.cs @@ -45,11 +45,7 @@ public class ReplyEndpoint : EndpointConfigurationBuilder { public ReplyEndpoint() { - EndpointSetup(b => - { - b.DisableFeature(); - }) - .AddMapping(typeof(SagaEndpoint)); + EndpointSetup(b => b.DisableFeature(), metadata => metadata.RegisterPublisherFor(typeof(SagaEndpoint))); } class DidSomethingHandler : IHandleMessages diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_a_existing_saga_instance_exists.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_saga_exists_for_start_message.cs similarity index 88% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_a_existing_saga_instance_exists.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_saga_exists_for_start_message.cs index 89428900f..af4b89163 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_a_existing_saga_instance_exists.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_saga_exists_for_start_message.cs @@ -6,16 +6,17 @@ using EndpointTemplates; using NUnit.Framework; - public class When_a_existing_saga_instance_exists : NServiceBusAcceptanceTest + public class When_saga_exists_for_start_message : NServiceBusAcceptanceTest { [Test] public async Task Should_hydrate_and_invoke_the_existing_instance() { var context = await Scenario.Define() - .WithEndpoint(b => b.When(session => session.SendLocal(new StartSagaMessage - { - SomeId = Guid.NewGuid() - }))) + .WithEndpoint(b => b + .When(session => session.SendLocal(new StartSagaMessage + { + SomeId = Guid.NewGuid() + }))) .Done(c => c.SecondMessageReceived) .Run(); @@ -43,8 +44,6 @@ public class TestSaga05 : Saga, IAmStartedByMessages(async () => + var exception = Assert.ThrowsAsync(async () => await Scenario.Define() .WithEndpoint( b => b.When(session => session.SendLocal(new StartSaga @@ -22,8 +22,7 @@ await Scenario.Define() DataId = Guid.NewGuid() }))) .Done(c => c.FailedMessages.Any()) - .Run()) - .ExpectFailedMessages(); + .Run()); Assert.That(exception.FailedMessages, Has.Count.EqualTo(1)); var failedMessage = exception.FailedMessages.Single(); diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_saga_is_mapped_to_complex_expression.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_saga_is_mapped_to_complex_expression.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_saga_is_mapped_to_complex_expression.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_saga_is_mapped_to_complex_expression.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_saga_message_goes_through_delayed_retries.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_saga_message_goes_through_delayed_retries.cs similarity index 89% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_saga_message_goes_through_delayed_retries.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_saga_message_goes_through_delayed_retries.cs index 0c645bde8..bff3f1405 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_saga_message_goes_through_delayed_retries.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_saga_message_goes_through_delayed_retries.cs @@ -15,7 +15,7 @@ public class When_saga_message_goes_through_delayed_retries : NServiceBusAccepta public Task Should_invoke_the_correct_handle_methods_on_the_saga() { return Scenario.Define() - .WithEndpoint(b => b + .WithEndpoint(b => b .When(session => session.SendLocal(new StartSagaMessage { SomeId = Guid.NewGuid() @@ -31,9 +31,9 @@ public class Context : ScenarioContext public int NumberOfTimesInvoked { get; set; } } - public class SagaMessageThroughDelayedRetryEndpoint : EndpointConfigurationBuilder + public class DelayedRetryEndpoint : EndpointConfigurationBuilder { - public SagaMessageThroughDelayedRetryEndpoint() + public DelayedRetryEndpoint() { EndpointSetup(b => { @@ -47,7 +47,7 @@ public SagaMessageThroughDelayedRetryEndpoint() }); } - public class TestSaga09 : Saga, + public class DelayedRetryTestingSaga : Saga, IAmStartedByMessages, IHandleMessages { @@ -77,7 +77,7 @@ public Task Handle(SecondSagaMessage message, IMessageHandlerContext context) return Task.FromResult(0); } - protected override void ConfigureHowToFindSaga(SagaPropertyMapper mapper) + protected override void ConfigureHowToFindSaga(SagaPropertyMapper mapper) { mapper.ConfigureMapping(m => m.SomeId) .ToSaga(s => s.SomeId); @@ -86,7 +86,7 @@ protected override void ConfigureHowToFindSaga(SagaPropertyMapper, + public class ConcurrentlyStartedSaga : Saga, IAmStartedByMessages, IAmStartedByMessages { @@ -99,7 +99,7 @@ void CheckForCompletion(IMessageHandlerContext context) } } - class ConcurrentlyStartedSagaData : ContainSagaData + public class ConcurrentlyStartedSagaData : ContainSagaData { public virtual string OrderId { get; set; } public virtual bool Placed { get; set; } @@ -131,17 +131,17 @@ public Task Handle(SuccessfulProcessing message, IMessageHandlerContext context) } } - class StartMessageOne : ICommand + public class StartMessageOne : ICommand { public string SomeId { get; set; } } - class StartMessageTwo : ICommand + public class StartMessageTwo : ICommand { public string SomeId { get; set; } } - class SuccessfulProcessing : ICommand + public class SuccessfulProcessing : ICommand { public string Type { get; set; } public Guid SagaId { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_sagas_cant_be_found.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_sagas_cant_be_found.cs similarity index 99% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_sagas_cant_be_found.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_sagas_cant_be_found.cs index 988d80069..f7bb7c6fd 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_sagas_cant_be_found.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_sagas_cant_be_found.cs @@ -241,18 +241,18 @@ public Task Handle(object message, IMessageProcessingContext context) } } - [Serializable] + public class StartSaga : ICommand { public Guid Id { get; set; } } - [Serializable] + public class FinishMessage : ICommand { } - [Serializable] + public class MessageToSaga : ICommand { public Guid Id { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_sending_from_a_saga_handle.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_sending_from_a_saga_handle.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_sending_from_a_saga_handle.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_sending_from_a_saga_handle.cs index 1a0782561..802c49bb6 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_sending_from_a_saga_handle.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_sending_from_a_saga_handle.cs @@ -92,13 +92,13 @@ public class TwoSaga1Saga2Data : ContainSagaData } } - [Serializable] + public class StartSaga1 : ICommand { public Guid DataId { get; set; } } - [Serializable] + public class StartSaga2 : ICommand { public Guid DataId { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_sending_from_a_saga_timeout.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_sending_from_a_saga_timeout.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_sending_from_a_saga_timeout.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_sending_from_a_saga_timeout.cs index af8ae6aa4..3c4747c11 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_sending_from_a_saga_timeout.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_sending_from_a_saga_timeout.cs @@ -91,13 +91,13 @@ public class SendFromTimeoutSaga2Data : ContainSagaData } } - [Serializable] + public class StartSaga1 : ICommand { public Guid DataId { get; set; } } - [Serializable] + public class StartSaga2 : ICommand { public Guid DataId { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_started_by_base_event_from_other_saga.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_started_by_base_event_from_other_saga.cs similarity index 97% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_started_by_base_event_from_other_saga.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_started_by_base_event_from_other_saga.cs index f571c7963..00b8fbea3 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_started_by_base_event_from_other_saga.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_started_by_base_event_from_other_saga.cs @@ -62,8 +62,8 @@ public SagaThatIsStartedByABaseEvent() { c.EnableFeature(); c.DisableFeature(); - }) - .AddMapping(typeof(Publisher)); + }, + metdata => metdata.RegisterPublisherFor(typeof(Publisher))); } public class SagaStartedByBaseEvent : Saga, IAmStartedByMessages @@ -90,7 +90,7 @@ public class SagaStartedByBaseEventSagaData : ContainSagaData } } - [Serializable] + public class StartSaga : ICommand { public Guid DataId { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_started_by_event_from_another_saga.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_started_by_event_from_another_saga.cs similarity index 97% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_started_by_event_from_another_saga.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_started_by_event_from_another_saga.cs index 9badea2a1..76d66745c 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_started_by_event_from_another_saga.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_started_by_event_from_another_saga.cs @@ -105,8 +105,8 @@ public SagaThatIsStartedByTheEvent() { c.EnableFeature(); c.DisableFeature(); - }) - .AddMapping(typeof(SagaThatPublishesAnEvent)); + }, + metadata => metadata.RegisterPublisherFor(typeof(SagaThatPublishesAnEvent))); } public class EventFromOtherSaga2 : Saga, @@ -145,7 +145,7 @@ public class Saga2Timeout } } - [Serializable] + public class StartSaga : ICommand { public Guid DataId { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_timeout_hit_not_found_saga.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_timeout_hit_not_found_saga.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_timeout_hit_not_found_saga.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_timeout_hit_not_found_saga.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_two_sagas_subscribe_to_the_same_event.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_two_sagas_subscribe_to_the_same_event.cs similarity index 97% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_two_sagas_subscribe_to_the_same_event.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_two_sagas_subscribe_to_the_same_event.cs index b94352f64..81b475e16 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_two_sagas_subscribe_to_the_same_event.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_two_sagas_subscribe_to_the_same_event.cs @@ -72,9 +72,9 @@ public class SagaEndpoint : EndpointConfigurationBuilder { public SagaEndpoint() { - EndpointSetup(c => c.EnableFeature()) - .AddMapping(typeof(Publisher)) - .AddMapping(typeof(Publisher)); + EndpointSetup(c => c.EnableFeature(), + metadata => metadata.RegisterPublisherFor(typeof(Publisher))) + .AddMapping(typeof(Publisher)); } public class Saga1 : Saga, @@ -150,7 +150,7 @@ public class MySaga2Data : ContainSagaData } } - [Serializable] + public class GroupPendingEvent : IEvent { public Guid DataId { get; set; } @@ -161,7 +161,7 @@ public class OpenGroupCommand : ICommand public Guid DataId { get; set; } } - [Serializable] + public class StartSaga2 : ICommand { public Guid DataId { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_updating_existing_correlation_property.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_updating_existing_correlation_property.cs similarity index 95% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_updating_existing_correlation_property.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_updating_existing_correlation_property.cs index fb5c927a5..a1d2766c1 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_updating_existing_correlation_property.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_updating_existing_correlation_property.cs @@ -13,15 +13,14 @@ public class When_updating_existing_correlation_property : NServiceBusAcceptance [Test] public void Should_blow_up() { - var exception = Assert.ThrowsAsync(async () => + var exception = Assert.ThrowsAsync(async () => await Scenario.Define() .WithEndpoint(b => b.When(session => session.SendLocal(new StartSagaMessage { SomeId = Guid.NewGuid() }))) .Done(c => c.FailedMessages.Any()) - .Run()) - .ExpectFailedMessages(); + .Run()); Assert.IsTrue(((Context)exception.ScenarioContext).ModifiedCorrelationProperty); Assert.AreEqual(1, exception.FailedMessages.Count); diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_using_ReplyToOriginator.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_using_ReplyToOriginator.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_using_ReplyToOriginator.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_using_ReplyToOriginator.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_using_a_received_message_for_timeout.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_using_a_received_message_for_timeout.cs similarity index 87% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_using_a_received_message_for_timeout.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_using_a_received_message_for_timeout.cs index 25c222f78..245674c98 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/When_using_a_received_message_for_timeout.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/When_using_a_received_message_for_timeout.cs @@ -10,24 +10,24 @@ public class When_using_a_received_message_for_timeout : NServiceBusAcceptanceTest { [Test] - public Task Timeout_should_be_received_after_expiration() + public async Task Timeout_should_be_received_after_expiration() { - return Scenario.Define(c => { c.Id = Guid.NewGuid(); }) + var context = await Scenario.Define() .WithEndpoint(g => g.When(session => session.SendLocal(new StartSagaMessage { SomeId = Guid.NewGuid() }))) .Done(c => c.TimeoutReceived) .Run(); + + Assert.True(context.TimeoutReceived); + Assert.AreEqual(1, context.HandlerCalled); } public class Context : ScenarioContext { - public Guid Id { get; set; } - - public bool StartSagaMessageReceived { get; set; } - public bool TimeoutReceived { get; set; } + public int HandlerCalled { get; set; } } public class ReceiveMessageForTimeoutEndpoint : EndpointConfigurationBuilder @@ -43,7 +43,7 @@ public class TestSaga01 : Saga, IAmStartedByMessages mapper) { mapper.ConfigureMapping(m => m.ContextId) - .ToSaga(s => s.Id); + .ToSaga(s => s.ContextId); } public class MultiTimeoutsSaga1Data : ContainSagaData @@ -139,7 +139,7 @@ public Task Handle(object message, IMessageHandlerContext context) } } - [Serializable] + public class StartSaga1 : ICommand { public Guid ContextId { get; set; } @@ -155,4 +155,4 @@ public class Saga2Timeout public Guid ContextId { get; set; } } } -} \ No newline at end of file +} diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/when_reply_from_saga_not_found_handler.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/when_reply_from_saga_not_found_handler.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/when_reply_from_saga_not_found_handler.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/when_reply_from_saga_not_found_handler.cs index c52e91020..cc88cb4b9 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Sagas/when_reply_from_saga_not_found_handler.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Sagas/when_reply_from_saga_not_found_handler.cs @@ -92,19 +92,19 @@ public Task Handle(object message, IMessageProcessingContext context) } } - [Serializable] + public class StartSaga1 : ICommand { public Guid ContextId { get; set; } } - [Serializable] + public class MessageToSaga : ICommand { public Guid ContextId { get; set; } } - [Serializable] + public class Reply : IMessage { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Satellites/When_a_message_is_available.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Satellites/When_a_message_is_available.cs similarity index 95% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Satellites/When_a_message_is_available.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Satellites/When_a_message_is_available.cs index efebe1af3..d0f50f6ad 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Satellites/When_a_message_is_available.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Satellites/When_a_message_is_available.cs @@ -50,7 +50,7 @@ protected override void Setup(FeatureConfigurationContext context) var satelliteLogicalAddress = context.Settings.LogicalAddress().CreateQualifiedAddress("MySatellite"); var satelliteAddress = context.Settings.GetTransportAddress(satelliteLogicalAddress); - context.AddSatelliteReceiver("Test satellite", satelliteAddress, TransportTransactionMode.ReceiveOnly, PushRuntimeSettings.Default, + context.AddSatelliteReceiver("Test satellite", satelliteAddress, PushRuntimeSettings.Default, (c, ec) => RecoverabilityAction.MoveToError(c.Failed.ErrorQueue), (builder, pushContext) => { @@ -67,7 +67,7 @@ protected override void Setup(FeatureConfigurationContext context) } } - class MyMessage : IMessage + public class MyMessage : IMessage { } } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Satellites/When_satellite_txmode_does_not_match_endpoints_txmode.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Satellites/When_satellite_txmode_does_not_match_endpoints_txmode.cs new file mode 100644 index 000000000..40081e16d --- /dev/null +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Satellites/When_satellite_txmode_does_not_match_endpoints_txmode.cs @@ -0,0 +1,70 @@ +namespace NServiceBus.AcceptanceTests.Satellites +{ + using System; + using System.Threading.Tasks; + using AcceptanceTesting; + using EndpointTemplates; + using Features; + using NUnit.Framework; + using Transport; + + public class When_satellite_txmode_does_not_match_endpoints_txmode : NServiceBusAcceptanceTest + { + [Test] + public void Should_throw() + { + var exception = Assert.ThrowsAsync(async () => await Scenario.Define() + .WithEndpoint(b => b.When((session, c) => session.Send(Endpoint.MySatelliteFeature.Address, new MyMessage()))) + .Done(c => c.MessageReceived) + .Run()); + + Assert.That(exception.Message, Does.Contain("AddSatelliteReceiver").And.Contain($"{nameof(TransportTransactionMode.None)}")); + } + + class Context : ScenarioContext + { + public bool MessageReceived { get; set; } + } + + class Endpoint : EndpointConfigurationBuilder + { + public Endpoint() + { + EndpointSetup(); + } + + public class MySatelliteFeature : Feature + { + public MySatelliteFeature() + { + EnableByDefault(); + } + + protected override void Setup(FeatureConfigurationContext context) + { + var satelliteLogicalAddress = context.Settings.LogicalAddress().CreateQualifiedAddress("MySatellite"); + var satelliteAddress = context.Settings.GetTransportAddress(satelliteLogicalAddress); + +#pragma warning disable 612, 618 + context.AddSatelliteReceiver("Test satellite", satelliteAddress, TransportTransactionMode.None, PushRuntimeSettings.Default, + (c, ec) => RecoverabilityAction.MoveToError(c.Failed.ErrorQueue), + (builder, pushContext) => + { + var testContext = builder.Build(); + testContext.MessageReceived = true; + return Task.FromResult(true); + }); +#pragma warning restore 612, 618 + + Address = satelliteAddress; + } + + public static string Address; + } + } + + public class MyMessage : IMessage + { + } + } +} \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ScenarioDescriptors/AllOutboxCapableStorages.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ScenarioDescriptors/AllOutboxCapableStorages.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ScenarioDescriptors/AllOutboxCapableStorages.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ScenarioDescriptors/AllOutboxCapableStorages.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ScenarioDescriptors/AllTransports.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ScenarioDescriptors/AllTransports.cs similarity index 94% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ScenarioDescriptors/AllTransports.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ScenarioDescriptors/AllTransports.cs index b5dd003e8..7f9037e4e 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ScenarioDescriptors/AllTransports.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ScenarioDescriptors/AllTransports.cs @@ -60,14 +60,6 @@ public AllTransportsWithoutNativeDeferral() } } - public class AllTransportsWithoutNativeDeferralAndWithAtomicSendAndReceive : AllTransports - { - public AllTransportsWithoutNativeDeferralAndWithAtomicSendAndReceive() - { - ScenarioFilter.Run(this, Remove); - } - } - public class TypeScanner { static IEnumerable AvailableAssemblies diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ScenarioDescriptors/Builders.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ScenarioDescriptors/Builders.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ScenarioDescriptors/Builders.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ScenarioDescriptors/Builders.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ScenarioDescriptors/EnvironmentHelper.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ScenarioDescriptors/EnvironmentHelper.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ScenarioDescriptors/EnvironmentHelper.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ScenarioDescriptors/EnvironmentHelper.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ScenarioDescriptors/Persistence.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ScenarioDescriptors/Persistence.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ScenarioDescriptors/Persistence.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ScenarioDescriptors/Persistence.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ScenarioDescriptors/Serializers.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ScenarioDescriptors/Serializers.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ScenarioDescriptors/Serializers.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ScenarioDescriptors/Serializers.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ScenarioDescriptors/Transports.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ScenarioDescriptors/Transports.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/ScenarioDescriptors/Transports.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/ScenarioDescriptors/Transports.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Scheduling/When_scheduling_a_recurring_task.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Scheduling/When_scheduling_a_recurring_task.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Scheduling/When_scheduling_a_recurring_task.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Scheduling/When_scheduling_a_recurring_task.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/SelfVerification/When_running_saga_tests.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/SelfVerification/When_running_saga_tests.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/SelfVerification/When_running_saga_tests.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/SelfVerification/When_running_saga_tests.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Serialization/When_configuring_custom_xml_namespace.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Serialization/When_configuring_custom_xml_namespace.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Serialization/When_configuring_custom_xml_namespace.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Serialization/When_configuring_custom_xml_namespace.cs index 459314f74..80c294142 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Serialization/When_configuring_custom_xml_namespace.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Serialization/When_configuring_custom_xml_namespace.cs @@ -76,7 +76,7 @@ public Task MutateIncoming(MutateIncomingTransportMessageContext context) } } - class SimpleMessage : ICommand + public class SimpleMessage : ICommand { } } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Serialization/When_registering_additional_deserializers.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Serialization/When_registering_additional_deserializers.cs similarity index 99% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Serialization/When_registering_additional_deserializers.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Serialization/When_registering_additional_deserializers.cs index a2912773b..4afce3aae 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Serialization/When_registering_additional_deserializers.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Serialization/When_registering_additional_deserializers.cs @@ -77,7 +77,7 @@ public Task Handle(MyRequest request, IMessageHandlerContext context) } [Serializable] - class MyRequest : IMessage + public class MyRequest : IMessage { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Serialization/When_registering_custom_serializer.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Serialization/When_registering_custom_serializer.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Serialization/When_registering_custom_serializer.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Serialization/When_registering_custom_serializer.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Serialization/When_registering_deserializers_with_settings.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Serialization/When_registering_deserializers_with_settings.cs similarity index 97% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Serialization/When_registering_deserializers_with_settings.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Serialization/When_registering_deserializers_with_settings.cs index b3ee8a973..6ffa7cc01 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Serialization/When_registering_deserializers_with_settings.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Serialization/When_registering_deserializers_with_settings.cs @@ -74,11 +74,10 @@ public Task Handle(MyRequest request, IMessageHandlerContext context) } [Serializable] - class MyRequest : IMessage + public class MyRequest : IMessage { } - public class MyCustomSerializer : SerializationDefinition { public override Func Configure(ReadOnlySettings settings) @@ -89,8 +88,8 @@ public override Func Configure(ReadOnlySetti class MyCustomMessageSerializer : IMessageSerializer { - readonly string valueFromSettings; - readonly Context context; + string valueFromSettings; + Context context; public MyCustomMessageSerializer(string valueFromSettings, Context context) { diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Serialization/When_sanitizing_xml_messages.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Serialization/When_sanitizing_xml_messages.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Serialization/When_sanitizing_xml_messages.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Serialization/When_sanitizing_xml_messages.cs index 97c08837e..e3ac79b15 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Serialization/When_sanitizing_xml_messages.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Serialization/When_sanitizing_xml_messages.cs @@ -80,7 +80,7 @@ public Task MutateIncoming(MutateIncomingTransportMessageContext context) } } - class SimpleMessage : ICommand + public class SimpleMessage : ICommand { public string Value { get; set; } } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Serialization/When_serializing_a_message.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Serialization/When_serializing_a_message.cs new file mode 100644 index 000000000..9cdb003b9 --- /dev/null +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Serialization/When_serializing_a_message.cs @@ -0,0 +1,83 @@ +namespace NServiceBus.AcceptanceTests.Serialization +{ + using System; + using System.Threading.Tasks; + using AcceptanceTesting; + using EndpointTemplates; + using NUnit.Framework; + + [TestFixture] + public class When_serializing_a_message : NServiceBusAcceptanceTest + { + [Test] + public async Task DateTime_properties_should_keep_their_original_timezone_information() + { + var expectedDateTime = new DateTime(2010, 10, 13, 12, 32, 42, DateTimeKind.Unspecified); + var expectedDateTimeLocal = new DateTime(2010, 10, 13, 12, 32, 42, DateTimeKind.Local); + var expectedDateTimeUtc = new DateTime(2010, 10, 13, 12, 32, 42, DateTimeKind.Utc); + var expectedDateTimeOffset = new DateTimeOffset(2012, 12, 12, 12, 12, 12, TimeSpan.FromHours(6)); + var expectedDateTimeOffsetLocal = DateTimeOffset.Now; + var expectedDateTimeOffsetUtc = DateTimeOffset.UtcNow; + + var context = await Scenario.Define() + .WithEndpoint(b => b.When( + (session, c) => session.SendLocal(new DateTimeMessage + { + DateTime = expectedDateTime, + DateTimeLocal = expectedDateTimeLocal, + DateTimeUtc = expectedDateTimeUtc, + DateTimeOffset = expectedDateTimeOffset, + DateTimeOffsetLocal = expectedDateTimeOffsetLocal, + DateTimeOffsetUtc = expectedDateTimeOffsetUtc + }))) + .Done(c => c.ReceivedMessage != null) + .Run(); + + Assert.AreEqual(expectedDateTime, context.ReceivedMessage.DateTime); + Assert.AreEqual(expectedDateTimeLocal, context.ReceivedMessage.DateTimeLocal); + Assert.AreEqual(expectedDateTimeUtc, context.ReceivedMessage.DateTimeUtc); + Assert.AreEqual(expectedDateTimeOffset, context.ReceivedMessage.DateTimeOffset); + Assert.AreEqual(expectedDateTimeOffsetLocal, context.ReceivedMessage.DateTimeOffsetLocal); + Assert.AreEqual(expectedDateTimeOffsetUtc, context.ReceivedMessage.DateTimeOffsetUtc); + Assert.AreEqual(expectedDateTimeOffsetLocal, context.ReceivedMessage.DateTimeOffsetLocal); + Assert.AreEqual(expectedDateTimeOffsetLocal.Offset, context.ReceivedMessage.DateTimeOffsetLocal.Offset); + Assert.AreEqual(expectedDateTimeOffsetUtc, context.ReceivedMessage.DateTimeOffsetUtc); + Assert.AreEqual(expectedDateTimeOffsetUtc.Offset, context.ReceivedMessage.DateTimeOffsetUtc.Offset); + } + + class DateTimeReceiver : EndpointConfigurationBuilder + { + public DateTimeReceiver() + { + EndpointSetup(c => { c.UseSerialization(); }); + } + + class DateTimeMessageHandler : IHandleMessages + { + public Context Context { get; set; } + + public Task Handle(DateTimeMessage message, IMessageHandlerContext context) + { + Context.ReceivedMessage = message; + + return Task.FromResult(0); + } + } + } + + public class DateTimeMessage : IMessage + { + public DateTime DateTime { get; set; } + public DateTime DateTimeLocal { get; set; } + public DateTime DateTimeUtc { get; set; } + public DateTimeOffset DateTimeOffset { get; set; } + public DateTimeOffset DateTimeOffsetLocal { get; set; } + public DateTimeOffset DateTimeOffsetUtc { get; set; } + } + + class Context : ScenarioContext + { + public DateTimeMessage ReceivedMessage { get; set; } + } + } +} \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Serialization/When_skip_wrapping_xml.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Serialization/When_skip_wrapping_xml.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Serialization/When_skip_wrapping_xml.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Serialization/When_skip_wrapping_xml.cs index c3caaf781..5b4d5f46e 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Serialization/When_skip_wrapping_xml.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Serialization/When_skip_wrapping_xml.cs @@ -84,7 +84,7 @@ public Task MutateIncoming(MutateIncomingTransportMessageContext context) } } - class MessageWithRawXml : ICommand + public class MessageWithRawXml : ICommand { public XDocument Document { get; set; } } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Serialization/When_wrapping_is_not_skipped.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Serialization/When_wrapping_is_not_skipped.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Serialization/When_wrapping_is_not_skipped.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Serialization/When_wrapping_is_not_skipped.cs index a87d67f85..d04ad997d 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Serialization/When_wrapping_is_not_skipped.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Serialization/When_wrapping_is_not_skipped.cs @@ -86,7 +86,7 @@ public Task MutateIncoming(MutateIncomingTransportMessageContext context) } } - class MessageWithRawXml : ICommand + public class MessageWithRawXml : ICommand { public XDocument Document { get; set; } } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Serialization/When_xml_serializer_used_with_unobtrusive_mode.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Serialization/When_xml_serializer_used_with_unobtrusive_mode.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Serialization/When_xml_serializer_used_with_unobtrusive_mode.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Serialization/When_xml_serializer_used_with_unobtrusive_mode.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Timeout/CyclingOutageTimeoutPersister.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Timeout/CyclingOutageTimeoutPersister.cs similarity index 93% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Timeout/CyclingOutageTimeoutPersister.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Timeout/CyclingOutageTimeoutPersister.cs index ee376a59c..1a18b5c1d 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Timeout/CyclingOutageTimeoutPersister.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Timeout/CyclingOutageTimeoutPersister.cs @@ -71,16 +71,16 @@ public Task GetNextChunk(DateTime startSlice) } } - var chunk = new TimeoutsChunk(timeoutsDue.ToArray(), DateTime.Now.AddSeconds(5)); + var chunk = new TimeoutsChunk(timeoutsDue.ToArray(), DateTime.UtcNow.AddSeconds(1)); return Task.FromResult(chunk); } void ThrowExceptionUntilWaitTimeReached() { - if (NextChangeTime <= DateTime.Now) + if (NextChangeTime <= DateTime.UtcNow) { - NextChangeTime = DateTime.Now.AddSeconds(secondsToWait); + NextChangeTime = DateTime.UtcNow.AddSeconds(secondsToWait); isAvailable = !isAvailable; } @@ -93,7 +93,7 @@ void ThrowExceptionUntilWaitTimeReached() public IEnumerable> GetNextChunk(DateTime startSlice, out DateTime nextTimeToRunQuery) { ThrowExceptionUntilWaitTimeReached(); - nextTimeToRunQuery = DateTime.Now.AddSeconds(2); + nextTimeToRunQuery = DateTime.UtcNow.AddSeconds(1); return Enumerable.Empty>().ToList(); } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Timeout/When_timeout_storage_is_unavailable_temporarily.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Timeout/When_timeout_storage_is_unavailable_temporarily.cs similarity index 79% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Timeout/When_timeout_storage_is_unavailable_temporarily.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Timeout/When_timeout_storage_is_unavailable_temporarily.cs index dd41125f9..17e476f8f 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Timeout/When_timeout_storage_is_unavailable_temporarily.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Timeout/When_timeout_storage_is_unavailable_temporarily.cs @@ -3,6 +3,7 @@ using System; using System.Threading.Tasks; using AcceptanceTesting; + using Configuration.AdvanceExtensibility; using EndpointTemplates; using Features; using NUnit.Framework; @@ -14,7 +15,7 @@ class When_timeout_storage_is_unavailable_temporarily : NServiceBusAcceptanceTes public Task Endpoint_should_start() { return Scenario.Define() - .WithEndpoint() + .WithEndpoint() .Done(c => c.EndpointsStarted) .Repeat(r => r.For()) .Should(c => Assert.IsTrue(c.EndpointsStarted)) @@ -24,11 +25,11 @@ public Task Endpoint_should_start() [Test] public async Task Endpoint_should_not_shutdown() { - var stopTime = DateTime.Now.AddSeconds(45); + var stopTime = DateTime.UtcNow.AddSeconds(6); var testContext = - await Scenario.Define(c => { c.SecondsToWait = 10; }) - .WithEndpoint(b => + await Scenario.Define(c => { c.SecondsToWait = 3; }) + .WithEndpoint(b => { b.CustomConfig((busConfig, context) => { @@ -39,7 +40,7 @@ public async Task Endpoint_should_not_shutdown() }); }); }) - .Done(c => c.FatalErrorOccurred || stopTime <= DateTime.Now) + .Done(c => c.FatalErrorOccurred || stopTime <= DateTime.UtcNow) .Run(); Assert.IsFalse(testContext.FatalErrorOccurred, "Circuit breaker was triggered too soon."); @@ -51,16 +52,19 @@ public class TimeoutTestContext : ScenarioContext public bool FatalErrorOccurred { get; set; } } - [Serializable] public class MyMessage : IMessage { } - public class EndpointWithFlakyTimeoutPersister : EndpointConfigurationBuilder + public class Endpoint : EndpointConfigurationBuilder { - public EndpointWithFlakyTimeoutPersister() + public Endpoint() { - EndpointSetup(config => { config.EnableFeature(); }); + EndpointSetup(config => + { + config.GetSettings().Set("TimeToWaitBeforeTriggeringCriticalErrorForTimeoutPersisterReceiver", TimeSpan.FromSeconds(7)); + config.EnableFeature(); + }); } public TestContext TestContext { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Tx/FakePromotableResourceManager.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Tx/FakePromotableResourceManager.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Tx/FakePromotableResourceManager.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Tx/FakePromotableResourceManager.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Tx/ImmediateDispatch/When_requesting_immediate_dispatch_using_scope_suppress.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Tx/ImmediateDispatch/When_requesting_immediate_dispatch_using_scope_suppress.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Tx/ImmediateDispatch/When_requesting_immediate_dispatch_using_scope_suppress.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Tx/ImmediateDispatch/When_requesting_immediate_dispatch_using_scope_suppress.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Tx/ImmediateDispatch/When_requesting_immediate_dispatch_with_at_least_once.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Tx/ImmediateDispatch/When_requesting_immediate_dispatch_with_at_least_once.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Tx/ImmediateDispatch/When_requesting_immediate_dispatch_with_at_least_once.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Tx/ImmediateDispatch/When_requesting_immediate_dispatch_with_at_least_once.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Tx/ImmediateDispatch/When_requesting_immediate_dispatch_with_at_most_once.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Tx/ImmediateDispatch/When_requesting_immediate_dispatch_with_at_most_once.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Tx/ImmediateDispatch/When_requesting_immediate_dispatch_with_at_most_once.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Tx/ImmediateDispatch/When_requesting_immediate_dispatch_with_at_most_once.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Tx/ImmediateDispatch/When_requesting_immediate_dispatch_with_exactly_once.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Tx/ImmediateDispatch/When_requesting_immediate_dispatch_with_exactly_once.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Tx/ImmediateDispatch/When_requesting_immediate_dispatch_with_exactly_once.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Tx/ImmediateDispatch/When_requesting_immediate_dispatch_with_exactly_once.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Tx/Issue_2481.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Tx/Issue_2481.cs similarity index 97% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Tx/Issue_2481.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Tx/Issue_2481.cs index bbd4336df..891bcdd56 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Tx/Issue_2481.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Tx/Issue_2481.cs @@ -1,6 +1,5 @@ namespace NServiceBus.AcceptanceTests.Tx { - using System; using System.Threading.Tasks; using System.Transactions; using AcceptanceTesting; @@ -52,7 +51,7 @@ public Task Handle(MyMessage messageThatIsEnlisted, IMessageHandlerContext conte } } - [Serializable] + public class MyMessage : ICommand { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Tx/When_receiving_with_dtc_enabled.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Tx/When_receiving_with_dtc_enabled.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Tx/When_receiving_with_dtc_enabled.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Tx/When_receiving_with_dtc_enabled.cs index bbd76af3e..a5c7dd832 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Tx/When_receiving_with_dtc_enabled.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Tx/When_receiving_with_dtc_enabled.cs @@ -1,6 +1,5 @@ namespace NServiceBus.AcceptanceTests.Tx { - using System; using System.Threading.Tasks; using System.Transactions; using AcceptanceTesting; @@ -73,7 +72,7 @@ public Task Handle(MyMessage messageThatIsEnlisted, IMessageHandlerContext conte } } - [Serializable] + public class MyMessage : ICommand { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Tx/When_receiving_with_native_multi_queue_transaction.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Tx/When_receiving_with_native_multi_queue_transaction.cs similarity index 97% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Tx/When_receiving_with_native_multi_queue_transaction.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Tx/When_receiving_with_native_multi_queue_transaction.cs index c5d752b4a..5f752ff31 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Tx/When_receiving_with_native_multi_queue_transaction.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Tx/When_receiving_with_native_multi_queue_transaction.cs @@ -1,6 +1,5 @@ namespace NServiceBus.AcceptanceTests.Tx { - using System; using System.Threading.Tasks; using AcceptanceTesting; using EndpointTemplates; @@ -76,12 +75,12 @@ public Task Handle(MessageHandledEvent message, IMessageHandlerContext context) } } - [Serializable] + public class MyMessage : ICommand { } - [Serializable] + public class MessageHandledEvent : IMessage { public bool HasFailed { get; set; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Tx/When_receiving_with_the_default_settings.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Tx/When_receiving_with_the_default_settings.cs similarity index 97% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Tx/When_receiving_with_the_default_settings.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Tx/When_receiving_with_the_default_settings.cs index bdbb95b79..bb86360d3 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Tx/When_receiving_with_the_default_settings.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Tx/When_receiving_with_the_default_settings.cs @@ -1,6 +1,5 @@ namespace NServiceBus.AcceptanceTests.Tx { - using System; using System.Threading.Tasks; using System.Transactions; using AcceptanceTesting; @@ -47,7 +46,7 @@ public Task Handle(MyMessage messageThatIsEnlisted, IMessageHandlerContext conte } } - [Serializable] + public class MyMessage : ICommand { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Tx/When_sending_within_an_ambient_transaction.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Tx/When_sending_within_an_ambient_transaction.cs similarity index 98% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Tx/When_sending_within_an_ambient_transaction.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Tx/When_sending_within_an_ambient_transaction.cs index 57278ed7e..a61b900d9 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Tx/When_sending_within_an_ambient_transaction.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Tx/When_sending_within_an_ambient_transaction.cs @@ -1,6 +1,5 @@ namespace NServiceBus.AcceptanceTests.Tx { - using System; using System.Threading.Tasks; using System.Transactions; using AcceptanceTesting; @@ -114,13 +113,13 @@ public Task Handle(MessageThatIsNotEnlisted messageThatIsNotEnlisted, IMessageHa } } - [Serializable] + public class MessageThatIsEnlisted : ICommand { public int SequenceNumber { get; set; } } - [Serializable] + public class MessageThatIsNotEnlisted : ICommand { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/UnicastRoutingExtensions.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/UnicastRoutingExtensions.cs similarity index 100% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/UnicastRoutingExtensions.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/UnicastRoutingExtensions.cs diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Versioning/When_multiple_versions_of_a_message_is_published.cs b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Versioning/When_multiple_versions_of_a_message_is_published.cs similarity index 93% rename from src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Versioning/When_multiple_versions_of_a_message_is_published.cs rename to src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Versioning/When_multiple_versions_of_a_message_is_published.cs index 748d0532a..d5f537026 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.0.0/Versioning/When_multiple_versions_of_a_message_is_published.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.1.1/Versioning/When_multiple_versions_of_a_message_is_published.cs @@ -79,9 +79,9 @@ public class V1Subscriber : EndpointConfigurationBuilder { public V1Subscriber() { - EndpointSetup(b => b.DisableFeature()) - .ExcludeType() - .AddMapping(typeof(V2Publisher)); + EndpointSetup(b => b.DisableFeature(), + metadata => metadata.RegisterPublisherFor(typeof(V2Publisher))) + .ExcludeType(); } class V1Handler : IHandleMessages @@ -100,8 +100,8 @@ public class V2Subscriber : EndpointConfigurationBuilder { public V2Subscriber() { - EndpointSetup(b => b.DisableFeature()) - .AddMapping(typeof(V2Publisher)); + EndpointSetup(b => b.DisableFeature(), + metadata => metadata.RegisterPublisherFor(typeof(V2Publisher))); } class V2Handler : IHandleMessages diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/Configuration/When_using_v2_configuration_app_config_for_schema_override.cs b/src/NServiceBus.SqlServer.AcceptanceTests/Configuration/When_using_v2_configuration_app_config_for_schema_override.cs index f8ff3ac91..5dc99778e 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/Configuration/When_using_v2_configuration_app_config_for_schema_override.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/Configuration/When_using_v2_configuration_app_config_for_schema_override.cs @@ -29,31 +29,14 @@ public Task Should_fail_on_startup() using (AppConfig.Change(appConfigPath)) { - var configurationExceptionThrown = false; - - Assert.ThrowsAsync(Is.AssignableTo(), async () => + var exception = Assert.ThrowsAsync(Is.AssignableTo(), async () => { - try - { - await Scenario.Define() - .WithEndpoint() - .Run(); - } - catch (AggregateException exception) - { - exception.Handle(ie => - { - if (ie.InnerException != null && ie.InnerException.Message.Contains(expectedErrorMessage)) - { - configurationExceptionThrown = true; - } - - return false; - }); - } + await Scenario.Define() + .WithEndpoint() + .Run(); }, "Endpoint startup should throw and exception"); - Assert.IsTrue(configurationExceptionThrown, "Endpoint should fail on startup due to unsupported v2 configuration."); + Assert.That(exception.Message, Contains.Substring(expectedErrorMessage), "Endpoint should fail on startup due to unsupported v2 configuration."); return Task.FromResult(0); } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/ConfigureEndpointSqlServerTransport.cs b/src/NServiceBus.SqlServer.AcceptanceTests/ConfigureEndpointSqlServerTransport.cs index b988bd543..137df3987 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/ConfigureEndpointSqlServerTransport.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/ConfigureEndpointSqlServerTransport.cs @@ -19,11 +19,25 @@ public class ConfigureScenariosForSqlServerTransport : IConfigureSupportedScenar public class ConfigureEndpointSqlServerTransport : IConfigureEndpointTestExecution { - public Task Configure(string endpointName, EndpointConfiguration configuration, RunSettings settings) + public Task Configure(string endpointName, EndpointConfiguration configuration, RunSettings settings, PublisherMetadata publisherMetadata) { queueBindings = configuration.GetSettings().Get(); connectionString = settings.Get("Transport.ConnectionString"); - configuration.UseTransport().ConnectionString(connectionString); + + var transportConfig = configuration.UseTransport(); + + transportConfig.ConnectionString(connectionString); + + var routingConfig = transportConfig.Routing(); + + foreach (var publisher in publisherMetadata.Publishers) + { + foreach (var eventType in publisher.Events) + { + routingConfig.RegisterPublisher(eventType, publisher.PublisherName); + } + } + return Task.FromResult(0); } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/LegacyMultiInstance/When_using_legacy_multiinstance.cs b/src/NServiceBus.SqlServer.AcceptanceTests/LegacyMultiInstance/When_using_legacy_multiinstance.cs index 9942133a8..d1cba7f29 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/LegacyMultiInstance/When_using_legacy_multiinstance.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/LegacyMultiInstance/When_using_legacy_multiinstance.cs @@ -82,11 +82,11 @@ public Task Handle(Message message, IMessageHandlerContext context) } } - protected class Message : ICommand + public class Message : ICommand { } - protected class Reply : IMessage + public class Reply : IMessage { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/MultiSchema/When_custom_schema_configured_for_error_queue.cs b/src/NServiceBus.SqlServer.AcceptanceTests/MultiSchema/When_custom_schema_configured_for_error_queue.cs index 682810f35..83457449a 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/MultiSchema/When_custom_schema_configured_for_error_queue.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/MultiSchema/When_custom_schema_configured_for_error_queue.cs @@ -81,7 +81,7 @@ public Task Handle(Message message, IMessageHandlerContext context) } } - class Message : ICommand { } + public class Message : ICommand { } const string ErrorSpySchema = "receiver"; } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/MultiSchema/When_custom_schema_configured_for_publisher.cs b/src/NServiceBus.SqlServer.AcceptanceTests/MultiSchema/When_custom_schema_configured_for_publisher.cs new file mode 100644 index 000000000..4ca0d8f9c --- /dev/null +++ b/src/NServiceBus.SqlServer.AcceptanceTests/MultiSchema/When_custom_schema_configured_for_publisher.cs @@ -0,0 +1,77 @@ +namespace NServiceBus.SqlServer.AcceptanceTests.MultiSchema +{ + using System.Threading.Tasks; + using AcceptanceTesting; + using AcceptanceTesting.Customization; + using NServiceBus.AcceptanceTests; + using NServiceBus.AcceptanceTests.EndpointTemplates; + using NServiceBus.AcceptanceTests.Routing; + using NUnit.Framework; + using Transport.SQLServer; + + public class When_custom_schema_configured_for_publisher : NServiceBusAcceptanceTest + { + [Test] + public async Task Should_receive_event() + { + await Scenario.Define() + .WithEndpoint(b => b.When(c => c.Subscribed, session => session.Publish(new Event()))) + .WithEndpoint() + .Done(c => c.EventReceived) + .Run(); + } + + class Context : ScenarioContext + { + public bool Subscribed { get; set; } + public bool EventReceived { get; set; } + } + + class Publisher : EndpointConfigurationBuilder + { + public Publisher() + { + EndpointSetup(b => + { + b.UseTransport() + .DefaultSchema("sender"); + + b.OnEndpointSubscribed((args, context) => { context.Subscribed = true; }); + }); + } + } + + class Subscriber : EndpointConfigurationBuilder + { + public Subscriber() + { + EndpointSetup(b => + { + var publisherEndpoint = Conventions.EndpointNamingConvention(typeof(Publisher)); + + b.UseTransport() + .DefaultSchema("receiver") + .UseSchemaForEndpoint(publisherEndpoint, "sender") + .Routing().RegisterPublisher( + eventType: typeof(Event), + publisherEndpoint: publisherEndpoint); + }); + } + + class EventHandler : IHandleMessages + { + public Context Context { get; set; } + + public Task Handle(Event message, IMessageHandlerContext context) + { + Context.EventReceived = true; + return Task.FromResult(0); + } + } + } + + public class Event : IEvent + { + } + } +} \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/NServiceBus.SqlServer.AcceptanceTests.csproj b/src/NServiceBus.SqlServer.AcceptanceTests/NServiceBus.SqlServer.AcceptanceTests.csproj index 9638a8279..1d170fbb0 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/NServiceBus.SqlServer.AcceptanceTests.csproj +++ b/src/NServiceBus.SqlServer.AcceptanceTests/NServiceBus.SqlServer.AcceptanceTests.csproj @@ -44,11 +44,11 @@ - ..\packages\NServiceBus.AcceptanceTesting.6.0.0\lib\net452\NServiceBus.AcceptanceTesting.dll + ..\packages\NServiceBus.AcceptanceTesting.6.1.1\lib\net452\NServiceBus.AcceptanceTesting.dll True - ..\packages\NServiceBus.6.0.0\lib\net452\NServiceBus.Core.dll + ..\packages\NServiceBus.6.1.1\lib\net452\NServiceBus.Core.dll True @@ -72,256 +72,257 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/TimeToBeReceived/When_queue_contains_expired_messages.cs b/src/NServiceBus.SqlServer.AcceptanceTests/TimeToBeReceived/When_queue_contains_expired_messages.cs index eceb420b8..999ba8d34 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/TimeToBeReceived/When_queue_contains_expired_messages.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/TimeToBeReceived/When_queue_contains_expired_messages.cs @@ -83,11 +83,11 @@ public Task Handle(Message message, IMessageHandlerContext context) } [TimeToBeReceived("00:00:00.001")] - class ExpiredMessage : IMessage + public class ExpiredMessage : IMessage { } - class Message : IMessage + public class Message : IMessage { } } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/TransactionScope/When_customizing_scope_isolation_level.cs b/src/NServiceBus.SqlServer.AcceptanceTests/TransactionScope/When_customizing_scope_isolation_level.cs index 11441afa9..b80c84579 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/TransactionScope/When_customizing_scope_isolation_level.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/TransactionScope/When_customizing_scope_isolation_level.cs @@ -22,7 +22,7 @@ public async Task Should_honor_configured_level() Assert.AreEqual(IsolationLevel.RepeatableRead, context.IsolationLevel, "Ambient transaction should have configured isolation level"); } - class MyMessage : IMessage + public class MyMessage : IMessage { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/TransactionScope/When_using_scope_timeout_greater_than_machine_max.cs b/src/NServiceBus.SqlServer.AcceptanceTests/TransactionScope/When_using_scope_timeout_greater_than_machine_max.cs index 96a0afe4f..30828d03b 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/TransactionScope/When_using_scope_timeout_greater_than_machine_max.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/TransactionScope/When_using_scope_timeout_greater_than_machine_max.cs @@ -1,6 +1,7 @@ namespace NServiceBus.SqlServer.AcceptanceTests.TransactionScope { using System; + using System.Configuration; using AcceptanceTesting; using NServiceBus.AcceptanceTests; using NServiceBus.AcceptanceTests.EndpointTemplates; @@ -12,14 +13,14 @@ public class When_using_scope_timeout_greater_than_machine_max : NServiceBusAcce [Test] public void Should_throw() { - var exception = Assert.ThrowsAsync(async () => + var exception = Assert.ThrowsAsync(async () => { await Scenario.Define() .WithEndpoint() .Run(); }); - Assert.That(exception.InnerException.InnerException.Message.Contains("Timeout requested is longer than the maximum value for this machine")); + Assert.That(exception.Message, Contains.Substring("Timeout requested is longer than the maximum value for this machine")); } class Context : ScenarioContext diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/When_ReplyTo_address_does_not_exist.cs b/src/NServiceBus.SqlServer.AcceptanceTests/When_ReplyTo_address_does_not_exist.cs index 12adadec5..d32900177 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/When_ReplyTo_address_does_not_exist.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/When_ReplyTo_address_does_not_exist.cs @@ -1,6 +1,5 @@ namespace NServiceBus.SqlServer.AcceptanceTests { - using System; using System.Linq; using System.Threading.Tasks; using AcceptanceTesting; @@ -14,13 +13,12 @@ public class When_ReplyTo_address_does_not_exist : NServiceBusAcceptanceTest [Test] public void Should_throw() { - var exception = Assert.ThrowsAsync(async () => + var exception = Assert.ThrowsAsync(async () => await Scenario.Define() .WithEndpoint(b => b.When(session => session.SendLocal(new StartCommand()))) .WithEndpoint() .Done(c => c.FailedMessages.Any()) - .Run()) - .ExpectFailedMessages(); + .Run()); Assert.That(exception.FailedMessages, Has.Count.EqualTo(1)); @@ -75,15 +73,15 @@ public Task Handle(AttackCommand message, IMessageHandlerContext context) } } - class StartCommand : ICommand + public class StartCommand : ICommand { } - class AttackCommand : ICommand + public class AttackCommand : ICommand { } - class AttackResponse : IMessage + public class AttackResponse : IMessage { } } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/When_the_message_contains_a_legacy_callback_header.cs b/src/NServiceBus.SqlServer.AcceptanceTests/When_the_message_contains_a_legacy_callback_header.cs index d6b7e810f..3c7652232 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/When_the_message_contains_a_legacy_callback_header.cs +++ b/src/NServiceBus.SqlServer.AcceptanceTests/When_the_message_contains_a_legacy_callback_header.cs @@ -29,11 +29,11 @@ public async Task It_should_reply_to_an_address_sent_in_that_header() Assert.IsTrue(context.RepliedToCorrectQueue); } - class Request : IMessage + public class Request : IMessage { } - class Reply : IMessage + public class Reply : IMessage { } diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/packages.config b/src/NServiceBus.SqlServer.AcceptanceTests/packages.config index b2aa8d60a..cf9f3d67f 100644 --- a/src/NServiceBus.SqlServer.AcceptanceTests/packages.config +++ b/src/NServiceBus.SqlServer.AcceptanceTests/packages.config @@ -1,8 +1,8 @@  - - - + + + \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.IntegrationTests/NServiceBus.SqlServer.IntegrationTests.csproj b/src/NServiceBus.SqlServer.IntegrationTests/NServiceBus.SqlServer.IntegrationTests.csproj index 4c84e8015..6e500a1bf 100644 --- a/src/NServiceBus.SqlServer.IntegrationTests/NServiceBus.SqlServer.IntegrationTests.csproj +++ b/src/NServiceBus.SqlServer.IntegrationTests/NServiceBus.SqlServer.IntegrationTests.csproj @@ -49,7 +49,7 @@ True - ..\packages\NServiceBus.6.0.0\lib\net452\NServiceBus.Core.dll + ..\packages\NServiceBus.6.1.1\lib\net452\NServiceBus.Core.dll True diff --git a/src/NServiceBus.SqlServer.IntegrationTests/packages.config b/src/NServiceBus.SqlServer.IntegrationTests/packages.config index a70dadaba..17cfdcbe1 100644 --- a/src/NServiceBus.SqlServer.IntegrationTests/packages.config +++ b/src/NServiceBus.SqlServer.IntegrationTests/packages.config @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/When_scope_dispose_throws.cs b/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/When_scope_dispose_throws.cs deleted file mode 100644 index 23736b4bd..000000000 --- a/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/When_scope_dispose_throws.cs +++ /dev/null @@ -1,69 +0,0 @@ -namespace NServiceBus.TransportTests -{ - using System; - using System.Threading.Tasks; - using System.Transactions; - using NUnit.Framework; - using Transport; - - public class When_scope_dispose_throws : NServiceBusTransportTest - { - [Test] - public async Task Should_call_on_error() - { - var onErrorCalled = new TaskCompletionSource(); - - OnTestTimeout(() => onErrorCalled.SetResult(null)); - - await StartPump(context => - { - // handler enlists a failing transaction enlistment to the DTC transaction which will fail when commiting the transaction. - Transaction.Current.EnlistDurable(EnlistmentWhichFailesDuringPrepare.Id, new EnlistmentWhichFailesDuringPrepare(), EnlistmentOptions.None); - - return Task.FromResult(0); - }, - context => - { - onErrorCalled.SetResult(context); - return Task.FromResult(ErrorHandleResult.Handled); - } - ,TransportTransactionMode.TransactionScope); - - await SendMessage(InputQueueName); - - var errorContext = await onErrorCalled.Task; - - Assert.IsInstanceOf(errorContext.Exception); - - // since some transports doesn't have native retry counters we can't expect the attempts to be fully consistent since if - // dispose throws the message might be picked up before the counter is incremented - Assert.LessOrEqual(1, errorContext.ImmediateProcessingFailures); - } - } - - class EnlistmentWhichFailesDuringPrepare : IEnlistmentNotification - { - public static readonly Guid Id = Guid.NewGuid(); - - public void Prepare(PreparingEnlistment preparingEnlistment) - { - // fail during prepare, this will cause scope.Dispose to throw - preparingEnlistment.ForceRollback(); - } - - public void Commit(Enlistment enlistment) - { - enlistment.Done(); - } - - public void Rollback(Enlistment enlistment) - { - enlistment.Done(); - } - - public void InDoubt(Enlistment enlistment) - { - enlistment.Done(); - } - } -} \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/IConfigureTransportInfrastructure.cs b/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/IConfigureTransportInfrastructure.cs similarity index 100% rename from src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/IConfigureTransportInfrastructure.cs rename to src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/IConfigureTransportInfrastructure.cs diff --git a/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/NServiceBusTransportTest.cs b/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/NServiceBusTransportTest.cs similarity index 99% rename from src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/NServiceBusTransportTest.cs rename to src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/NServiceBusTransportTest.cs index df8275b86..7e1ff12a8 100644 --- a/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/NServiceBusTransportTest.cs +++ b/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/NServiceBusTransportTest.cs @@ -71,9 +71,9 @@ protected async Task StartPump(Func onMessage, Func(queueBindings); - + transportSettings.Set(new EndpointInstances()); - + Configurer = CreateConfigurer(); var configuration = Configurer.Configure(transportSettings, transactionMode); diff --git a/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/TransportConfigurationResult.cs b/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/TransportConfigurationResult.cs similarity index 100% rename from src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/TransportConfigurationResult.cs rename to src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/TransportConfigurationResult.cs diff --git a/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/TypeScanner.cs b/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/TypeScanner.cs similarity index 100% rename from src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/TypeScanner.cs rename to src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/TypeScanner.cs diff --git a/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/When_failure_happens_after_send.cs b/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_failure_happens_after_send.cs similarity index 100% rename from src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/When_failure_happens_after_send.cs rename to src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_failure_happens_after_send.cs diff --git a/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/When_message_is_available.cs b/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_message_is_available.cs similarity index 100% rename from src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/When_message_is_available.cs rename to src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_message_is_available.cs diff --git a/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/When_on_error_throws.cs b/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_on_error_throws.cs similarity index 79% rename from src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/When_on_error_throws.cs rename to src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_on_error_throws.cs index dfee02831..64758707c 100644 --- a/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/When_on_error_throws.cs +++ b/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_on_error_throws.cs @@ -14,6 +14,7 @@ public class When_on_error_throws : NServiceBusTransportTest public async Task Should_reinvoke_on_error_with_original_exception(TransportTransactionMode transactionMode) { var onErrorCalled = new TaskCompletionSource(); + Exception criticalError = null; OnTestTimeout(() => onErrorCalled.SetCanceled()); @@ -36,13 +37,17 @@ await StartPump( onErrorCalled.SetResult(context); return Task.FromResult(ErrorHandleResult.Handled); - }, transactionMode); + }, + transactionMode, + (s, exception) => criticalError = exception); await SendMessage(InputQueueName); var errorContext = await onErrorCalled.Task; - Assert.AreEqual(errorContext.Exception.Message, "Simulated exception"); + Assert.AreEqual("Simulated exception", errorContext.Exception.Message); + Assert.AreEqual(2, errorContext.ImmediateProcessingFailures); + Assert.IsNotNull(criticalError); } } } \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/When_on_message_throws.cs b/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_on_message_throws.cs similarity index 100% rename from src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/When_on_message_throws.cs rename to src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_on_message_throws.cs diff --git a/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/When_on_message_throws_after_delayed_retry.cs b/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_on_message_throws_after_delayed_retry.cs similarity index 100% rename from src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/When_on_message_throws_after_delayed_retry.cs rename to src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_on_message_throws_after_delayed_retry.cs diff --git a/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/When_on_message_throws_after_immediate_retry.cs b/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_on_message_throws_after_immediate_retry.cs similarity index 100% rename from src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/When_on_message_throws_after_immediate_retry.cs rename to src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_on_message_throws_after_immediate_retry.cs diff --git a/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/When_requesting_immediate_retry.cs b/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_requesting_immediate_retry.cs similarity index 100% rename from src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/When_requesting_immediate_retry.cs rename to src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_requesting_immediate_retry.cs diff --git a/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_scope_complete_throws.cs b/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_scope_complete_throws.cs new file mode 100644 index 000000000..246ef04d2 --- /dev/null +++ b/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_scope_complete_throws.cs @@ -0,0 +1,70 @@ +namespace NServiceBus.TransportTests +{ + using System; + using System.Threading.Tasks; + using System.Transactions; + using NUnit.Framework; + using Transport; + + public class When_scope_complete_throws : NServiceBusTransportTest + { + //[TestCase(TransportTransactionMode.None)] -- not relevant + //[TestCase(TransportTransactionMode.ReceiveOnly)] -- unable to hook where required to throw after a message has been successfully processed but before transaction is successfully commited + //[TestCase(TransportTransactionMode.SendsAtomicWithReceive)] -- unable to hook where required to throw after a message has been successfully processed but before transaction is successfully commited + [TestCase(TransportTransactionMode.TransactionScope)] + public async Task Should_call_on_error(TransportTransactionMode transactionMode) + { + var onErrorCalled = new TaskCompletionSource(); + OnTestTimeout(() => onErrorCalled.SetResult(null)); + + await StartPump( + context => + { + // handler enlists a failing transaction enlistment to the DTC transaction which will fail when commiting the transaction. + Transaction.Current.EnlistDurable(EnlistmentWhichFailsDuringPrepare.Id, new EnlistmentWhichFailsDuringPrepare(), EnlistmentOptions.None); + return Task.FromResult(0); + }, + context => + { + onErrorCalled.SetResult(context); + return Task.FromResult(ErrorHandleResult.Handled); + }, transactionMode); + + await SendMessage(InputQueueName); + + var errorContext = await onErrorCalled.Task; + + Assert.IsInstanceOf(errorContext.Exception); + + // since some transports doesn't have native retry counters we can't expect the attempts to be fully consistent since if + // dispose throws the message might be picked up before the counter is incremented + Assert.LessOrEqual(1, errorContext.ImmediateProcessingFailures); + } + + class EnlistmentWhichFailsDuringPrepare : IEnlistmentNotification + { + public static readonly Guid Id = Guid.NewGuid(); + + public void Prepare(PreparingEnlistment preparingEnlistment) + { + // fail during prepare, this will cause scope.Complete to throw + preparingEnlistment.ForceRollback(); + } + + public void Commit(Enlistment enlistment) + { + enlistment.Done(); + } + + public void Rollback(Enlistment enlistment) + { + enlistment.Done(); + } + + public void InDoubt(Enlistment enlistment) + { + enlistment.Done(); + } + } + } +} \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_scope_throws_after_successful_message_processing.cs b/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_scope_throws_after_successful_message_processing.cs new file mode 100644 index 000000000..d18cdb1a6 --- /dev/null +++ b/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_scope_throws_after_successful_message_processing.cs @@ -0,0 +1,73 @@ +namespace NServiceBus.TransportTests +{ + using System; + using System.Threading.Tasks; + using System.Transactions; + using NUnit.Framework; + using Transport; + + public class When_scope_throws_after_successful_message_processing : NServiceBusTransportTest + { + //[TestCase(TransportTransactionMode.None)] -- not relevant + //[TestCase(TransportTransactionMode.ReceiveOnly)] -- unable to hook where required to throw after a message has been successfully processed but before transaction is successfully commited + //[TestCase(TransportTransactionMode.SendsAtomicWithReceive)] -- unable to hook where required to throw after a message has been successfully processed but before transaction is successfully commited + [TestCase(TransportTransactionMode.TransactionScope)] + public async Task Throwing_during_Transaction_Prepare_should_properly_increment_immediate_processing_failures(TransportTransactionMode transactionMode) + { + var onErrorCalled = new TaskCompletionSource(); + + OnTestTimeout(() => onErrorCalled.SetCanceled()); + + await StartPump( + context => + { + Transaction.Current.EnlistDurable(EnlistmentWhichFailsDuringPrepare.Id, new EnlistmentWhichFailsDuringPrepare(), EnlistmentOptions.None); + return Task.FromResult(0); + }, + context => + { + //perform an immediate retry to make sure the transport increments the counter properly + if (context.ImmediateProcessingFailures < 2) + { + return Task.FromResult(ErrorHandleResult.RetryRequired); + } + onErrorCalled.SetResult(context); + + return Task.FromResult(ErrorHandleResult.Handled); + }, transactionMode); + + await SendMessage(InputQueueName); + + var errorContext = await onErrorCalled.Task; + + Assert.IsInstanceOf(errorContext.Exception); + Assert.LessOrEqual(2, errorContext.ImmediateProcessingFailures); + } + } + + class EnlistmentWhichFailsDuringPrepare : IEnlistmentNotification + { + public static readonly Guid Id = Guid.NewGuid(); + + public void Prepare(PreparingEnlistment preparingEnlistment) + { + // fail during prepare, this will cause scope.Complete to throw + preparingEnlistment.ForceRollback(); + } + + public void Commit(Enlistment enlistment) + { + enlistment.Done(); + } + + public void Rollback(Enlistment enlistment) + { + enlistment.Done(); + } + + public void InDoubt(Enlistment enlistment) + { + enlistment.Done(); + } + } +} \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/When_sending_from_on_error.cs b/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_sending_from_on_error.cs similarity index 100% rename from src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/When_sending_from_on_error.cs rename to src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_sending_from_on_error.cs diff --git a/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_transaction_level_TransactionScope.cs b/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_transaction_level_TransactionScope.cs new file mode 100644 index 000000000..16a803794 --- /dev/null +++ b/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_transaction_level_TransactionScope.cs @@ -0,0 +1,36 @@ +namespace NServiceBus.TransportTests +{ + using System; + using System.Threading.Tasks; + using System.Transactions; + using NUnit.Framework; + using Transport; + + public class When_transaction_level_TransactionScope : NServiceBusTransportTest + { + [Test] + public async Task Should_have_active_transaction() + { + var messageHandled = new TaskCompletionSource>(); + + await StartPump( + context => + { + var currentTransaction = Transaction.Current; + var contextTransaction = context.TransportTransaction.Get(); + messageHandled.SetResult(new Tuple(currentTransaction, contextTransaction)); + + return Task.FromResult(0); + }, + errorContext => Task.FromResult(ErrorHandleResult.Handled), + TransportTransactionMode.TransactionScope); + await SendMessage(InputQueueName); + + var transactions = await messageHandled.Task; + + Assert.That(transactions.Item1, Is.Not.Null); + Assert.That(transactions.Item2, Is.Not.Null); + Assert.AreSame(transactions.Item1, transactions.Item2); + } + } +} \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/When_user_aborts_processing.cs b/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_user_aborts_processing.cs similarity index 100% rename from src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/When_user_aborts_processing.cs rename to src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_user_aborts_processing.cs diff --git a/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/When_using_non_durable_delivery.cs b/src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_using_non_durable_delivery.cs similarity index 100% rename from src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.0.0/When_using_non_durable_delivery.cs rename to src/NServiceBus.SqlServer.TransportTests/App_Packages/NSB.TransportTests.6.1.2/When_using_non_durable_delivery.cs diff --git a/src/NServiceBus.SqlServer.TransportTests/NServiceBus.SqlServer.TransportTests.csproj b/src/NServiceBus.SqlServer.TransportTests/NServiceBus.SqlServer.TransportTests.csproj index 5c1ccfa54..9a53bbe2b 100644 --- a/src/NServiceBus.SqlServer.TransportTests/NServiceBus.SqlServer.TransportTests.csproj +++ b/src/NServiceBus.SqlServer.TransportTests/NServiceBus.SqlServer.TransportTests.csproj @@ -32,7 +32,7 @@ - ..\packages\NServiceBus.6.0.0\lib\net452\NServiceBus.Core.dll + ..\packages\NServiceBus.6.1.2\lib\net452\NServiceBus.Core.dll True @@ -60,21 +60,23 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/src/NServiceBus.SqlServer.TransportTests/packages.config b/src/NServiceBus.SqlServer.TransportTests/packages.config index 751e72efe..94066bbee 100644 --- a/src/NServiceBus.SqlServer.TransportTests/packages.config +++ b/src/NServiceBus.SqlServer.TransportTests/packages.config @@ -1,6 +1,6 @@  - - + + \ No newline at end of file diff --git a/src/NServiceBus.SqlServer.UnitTests/NServiceBus.SqlServer.UnitTests.csproj b/src/NServiceBus.SqlServer.UnitTests/NServiceBus.SqlServer.UnitTests.csproj index 9c3ea133a..6ec16dcb3 100644 --- a/src/NServiceBus.SqlServer.UnitTests/NServiceBus.SqlServer.UnitTests.csproj +++ b/src/NServiceBus.SqlServer.UnitTests/NServiceBus.SqlServer.UnitTests.csproj @@ -69,7 +69,7 @@ True - ..\packages\NServiceBus.6.0.0\lib\net452\NServiceBus.Core.dll + ..\packages\NServiceBus.6.1.1\lib\net452\NServiceBus.Core.dll True diff --git a/src/NServiceBus.SqlServer.UnitTests/packages.config b/src/NServiceBus.SqlServer.UnitTests/packages.config index 8d759ac59..1834995e8 100644 --- a/src/NServiceBus.SqlServer.UnitTests/packages.config +++ b/src/NServiceBus.SqlServer.UnitTests/packages.config @@ -4,6 +4,6 @@ - + \ No newline at end of file diff --git a/src/NServiceBus.SqlServer/Receiving/ReceiveWithNativeTransaction.cs b/src/NServiceBus.SqlServer/Receiving/ReceiveWithNativeTransaction.cs index b2960ac67..65e0923b6 100644 --- a/src/NServiceBus.SqlServer/Receiving/ReceiveWithNativeTransaction.cs +++ b/src/NServiceBus.SqlServer/Receiving/ReceiveWithNativeTransaction.cs @@ -37,15 +37,16 @@ public override async Task ReceiveMessage(CancellationTokenSource receiveCancell return; } - if (await TryProcess(message, PrepareTransportTransaction(connection, transaction)).ConfigureAwait(false)) - { - transaction.Commit(); - } - else + if (!await TryProcess(message, PrepareTransportTransaction(connection, transaction)).ConfigureAwait(false)) { transaction.Rollback(); + return; } + + transaction.Commit(); } + + failureInfoStorage.ClearFailureInfoForMessage(message.TransportId); } catch (Exception exception) { @@ -102,17 +103,20 @@ async Task TryProcess(Message message, TransportTransaction transportTrans if (errorHandlingResult == ErrorHandleResult.Handled) { - failureInfoStorage.ClearFailureInfoForMessage(message.TransportId); return true; } } - var messageProcessed = await TryProcessingMessage(message, transportTransaction).ConfigureAwait(false); - if (messageProcessed) + try { - failureInfoStorage.ClearFailureInfoForMessage(message.TransportId); + var messageProcessed = await TryProcessingMessage(message, transportTransaction).ConfigureAwait(false); + return messageProcessed; + } + catch (Exception exception) + { + failureInfoStorage.RecordFailureInfoForMessage(message.TransportId, exception); + return false; } - return messageProcessed; } IsolationLevel isolationLevel; diff --git a/src/NServiceBus.SqlServer/Receiving/ReceiveWithTransactionScope.cs b/src/NServiceBus.SqlServer/Receiving/ReceiveWithTransactionScope.cs index 22e34c147..0c06d4f94 100644 --- a/src/NServiceBus.SqlServer/Receiving/ReceiveWithTransactionScope.cs +++ b/src/NServiceBus.SqlServer/Receiving/ReceiveWithTransactionScope.cs @@ -36,11 +36,15 @@ public override async Task ReceiveMessage(CancellationTokenSource receiveCancell connection.Close(); - if (await TryProcess(message, PrepareTransportTransaction()).ConfigureAwait(false)) + if (!await TryProcess(message, PrepareTransportTransaction()).ConfigureAwait(false)) { - scope.Complete(); + return; } + + scope.Complete(); } + + failureInfoStorage.ClearFailureInfoForMessage(message.TransportId); } catch (Exception exception) { @@ -91,17 +95,20 @@ async Task TryProcess(Message message, TransportTransaction transportTrans if (errorHandlingResult == ErrorHandleResult.Handled) { - failureInfoStorage.ClearFailureInfoForMessage(message.TransportId); return true; } } - var messageProcessed = await TryProcessingMessage(message, transportTransaction).ConfigureAwait(false); - if (messageProcessed) + try { - failureInfoStorage.ClearFailureInfoForMessage(message.TransportId); + var messageProcessed = await TryProcessingMessage(message, transportTransaction).ConfigureAwait(false); + return messageProcessed; + } + catch (Exception exception) + { + failureInfoStorage.RecordFailureInfoForMessage(message.TransportId, exception); + return false; } - return messageProcessed; } TransactionOptions transactionOptions;