Beispiel #1
0
        public async Task send_and_await_still_works()
        {
            var bus = theSender.Get <IMessageContext>();

            var item = new ItemCreated
            {
                Name = "Hat",
                Id   = Guid.NewGuid()
            };

            using (var conn = new SqlConnection(ConnectionSource.ConnectionString))
            {
                await conn.OpenAsync();

                var tx = conn.BeginTransaction();
                await bus.EnlistInTransaction(tx);

                await bus.SendAndWait(item);
            }



            var item2 = await loadItem(item.Id);

            item2.Name.ShouldBe("Hat");


            var deleted = thePersistor.AllIncomingEnvelopes().Any();

            if (!deleted)
            {
                Thread.Sleep(500);
                thePersistor.AllIncomingEnvelopes().Any().ShouldBeFalse();
            }
        }
        public async Task mark_complete_deletes_the_envelope()
        {
            await theCallback.MarkComplete();

            theRetries.IncomingDeleted.WaitOne(500);

            var persisted = thePersistor.AllIncomingEnvelopes().FirstOrDefault(x => x.Id == theEnvelope.Id);


            persisted.ShouldBeNull();
        }
Beispiel #3
0
        protected async Task <IReadOnlyList <Envelope> > afterReceivingTheEnvelopes()
        {
            var status = await theListener.Received(theUri, theEnvelopes.ToArray());

            status.ShouldBe(ReceivedStatus.Successful);

            return(thePersistor.AllIncomingEnvelopes());
        }
Beispiel #4
0
        public async Task increment_the_attempt_count_of_incoming_envelope()
        {
            var envelope = ObjectMother.Envelope();

            envelope.Status = TransportConstants.Incoming;

            await thePersistor.StoreIncoming(envelope);

            var prop = ReflectionHelper.GetProperty <Envelope>(x => x.Attempts);

            prop.SetValue(envelope, 3);

            await thePersistor.IncrementIncomingEnvelopeAttempts(envelope);

            var stored = thePersistor.AllIncomingEnvelopes().Single();

            stored.Attempts.ShouldBe(3);
        }