Ejemplo n.º 1
0
        private static async Task SendMessage(Envelope envelope, JsonMessageSerializer serializer)
        {
            var messageBus = new ServiceBusMessageBus(_connectionStringBuilder, serializer);
            await messageBus.Send(new ScheduledEnvelope(envelope, DateTime.UtcNow.AddMinutes(-1.0)), default);

            await messageBus.Close();
        }
        public async Task Close_releases_message_sender_resources()
        {
            var sut = new ServiceBusMessageBus(_connectionStringBuilder, new JsonMessageSerializer());

            await sut.Close();

            var         scheduled = new ScheduledEnvelope(new Envelope(new object()), DateTime.UtcNow);
            Func <Task> action    = () => sut.Send(scheduled, CancellationToken.None);

            action.Should().Throw <Exception>();
        }