Beispiel #1
0
            public async Task SetUp()
            {
                await ClearAllDataFiles();

                var retryPolicy = new RetryPolicy(1, DateTimeUtility.PositiveOneHourTimeSpan);

                _bus = new DurableMessageBus(retryPolicy);

                _commands = new DurableCommandSubscribers();
                _events   = new DurableEventSubscribers();
                _bus.RegisterSubscriptionFor <TestDurableCommand>(_commands.Handle);
                _bus.RegisterSubscriptionFor <TestDurableEvent>(_events.Handle);
            }
Beispiel #2
0
            private async Task SendUnacknowledgedCommandAndEventTwiceThenDisposeDurableBus()
            {
                _doubleValue = string.Format("{0}{0}", SingleValue);
                _tripleValue = string.Format("{0}{0}{0}", SingleValue);

                _retryPolicy = new RetryPolicy(10, DateTimeUtility.PositiveOneHourTimeSpan);
                _bus         = new DurableMessageBus(_retryPolicy);

                _commands = new DurableCommandSubscribers();
                _events   = new DurableEventSubscribers();

                _bus.RegisterSubscriptionFor <TestDurableCommand>(_commands.Handle);
                _bus.RegisterSubscriptionFor <TestDurableEvent>(_events.Handle);

                await _bus.SendDurable(new TestDurableCommand(SingleValue));

                await _bus.PublishDurable(new TestDurableEvent(SingleValue));

                Assume.That(_commands.ProcessedMessagePayload, Is.EqualTo(SingleValue),
                            "Command Subscriber not registered for command as expected.");
                Assume.That(_events.ProcessedMessagePayload, Is.EqualTo(SingleValue),
                            "Event Subscriber not registered for event as expected.");

                await _bus.Start();

                Assume.That(_commands.ProcessedMessagePayload, Is.EqualTo(_doubleValue),
                            "Command Subscriber not registered for command as expected.");
                Assume.That(_events.ProcessedMessagePayload, Is.EqualTo(_doubleValue),
                            "Event Subscriber not registered for event as expected.");

                await _bus.Stop();

                _bus = null;

                Assume.That(_bus, Is.Null);
            }