Ejemplo n.º 1
0
        public void Constructor_InitializesInstance(string name, string sub)
        {
            var entity = new TopicEntity(name, new[] { sub });

            entity.ShouldSatisfyAllConditions(
                () => entity.Name.ShouldBe(name),
                () => entity.Subscriptions.ShouldHaveSingleItem(),
                () => entity.Subscriptions.TryGetValue(sub, out _).ShouldBeTrue()
                );
        }
Ejemplo n.º 2
0
        public void Post_PostsClonesToSubscriptions()
        {
            var message = new Amqp.Message();
            var entity  = new TopicEntity("nm", new[] { "xyz", "007" });

            entity.Post(message);

            entity.ShouldSatisfyAllConditions(
                () => ((IEntity)entity.Subscriptions["xYz"])
                .DeliveryQueue
                .Dequeue(CancellationToken.None)
                .ShouldNotBeSameAs(message),
                () => ((IEntity)entity.Subscriptions["007"])
                .DeliveryQueue
                .Dequeue(CancellationToken.None)
                .ShouldNotBeSameAs(message)
                );
        }