예제 #1
0
        public void Post_Throws_WhenMessageNull()
        {
            var entity = new QueueEntity("s");

            Should.Throw <ArgumentNullException>(() => entity.Post(null))
            .ParamName.ShouldBe("message");
        }
예제 #2
0
        public void Post_Throws_WhenObjectDisposed()
        {
            var entity = new QueueEntity("s");

            entity.Dispose();

            Should.Throw <ObjectDisposedException>(() => entity.Post(new Amqp.Message()));
        }
예제 #3
0
        public void Post_CreatesEndEnqueuesDelivery()
        {
            var message = new Amqp.Message();
            var entity  = new QueueEntity("s");

            IDelivery delivery = entity.Post(message);

            entity.ShouldSatisfyAllConditions(
                () => delivery.Message.ShouldBeSameAs(message),
                () => ((IEntity)entity).DeliveryQueue.Dequeue(CancellationToken.None).ShouldBeSameAs(message)
                );
        }
예제 #4
0
        public void Dispose_CanBeCalledMultipleTimes()
        {
            var entity = new QueueEntity("s");

            entity.Post(new Amqp.Message());

            Should.NotThrow(() =>
            {
                entity.Dispose();
                entity.Dispose();
                entity.Dispose();
            });
        }