public async Task enqueue_locally()
        {
            var item = new ItemCreated
            {
                Name = "Shoe",
                Id   = Guid.NewGuid()
            };

            var waiter = theTracker.WaitFor <ItemCreated>();

            await theReceiver.Messaging.Enqueue(item);

            waiter.Wait(5.Seconds());

            waiter.IsCompleted.ShouldBeTrue();

            using (var session = theReceiver.Get <IDocumentStore>().QuerySession())
            {
                var item2 = session.Load <ItemCreated>(item.Id);
                if (item2 == null)
                {
                    Thread.Sleep(500);
                    item2 = session.Load <ItemCreated>(item.Id);
                }


                item2.Name.ShouldBe("Shoe");

                session.AllIncomingEnvelopes().Any().ShouldBeFalse();
            }
        }
示例#2
0
 public static void Handle(ItemCreated created, IDocumentSession session, MessageTracker tracker,
                           Envelope envelope)
 {
     session.Store(created);
     tracker.Record(created, envelope);
 }