Пример #1
0
            public async Task MessageIsNotSendToSubscriberOnStart()
            {
                const string singleValue = "0";

                //we need a retry policy with at least one retry
                //  so that we'd expect the call to Start() to attempt a retry
                var retryPolicy = new RetryPolicy(1, DateTimeUtility.PositiveOneHourTimeSpan);

                var bus      = new DurableMessageBus(retryPolicy);
                var commands = new CommandSubscribers();

                bus.RegisterSubscriptionFor <TestDurableCommand>(commands.Handle);

                await bus.SendDurable(new TestDurableCommand(singleValue));

                Assume.That(commands.ProcessedMessagePayload, Is.EqualTo(singleValue), "Command Subscriber didn't receive the expected message.");

                bus.UnRegisterAllSubscriptionsFor <TestDurableCommand>();

                await bus.Start();

                Assert.That(commands.ProcessedMessagePayload, Is.EqualTo(singleValue), "Bus did not properly ignore queued command.");
            }