Ejemplo n.º 1
0
        public void ExecuteFullTest()
        {
            var operation = new UnbindExchangeOperation()
                            .SetSourceExchangeName("foo")
                            .SetDestinationExchangeName("bar")
                            .SetRoutingKey("#");

            var server            = new RabbitServer();
            var connectionFactory = new FakeConnectionFactory(server);

            using (var connection = connectionFactory.CreateConnection())
            {
                using (var model = connection.CreateModel())
                {
                    model.ExchangeDeclare("foo", ExchangeType.Topic, true);
                    model.QueueDeclare("bar", true);
                }

                operation.Execute(connection, string.Empty);
            }

            Assert.AreEqual(1, server.Queues.Count);
            Assert.AreEqual(1, server.Exchanges.Count);
            //Exchange-to-exchange bindings not supported in fakes...
        }
Ejemplo n.º 2
0
        public UnbindExchangeOperation UnbindExchange(string sourceExchangeName, string destinationExchangeName, string routingKey)
        {
            var unbindExchangeOperation = new UnbindExchangeOperation()
                                          .SetSourceExchangeName(sourceExchangeName)
                                          .SetDestinationExchangeName(destinationExchangeName)
                                          .SetRoutingKey(routingKey);

            Operations.Add(unbindExchangeOperation);

            return(unbindExchangeOperation);
        }
Ejemplo n.º 3
0
        public void PropertySettersMinimalTest()
        {
            var operation = new UnbindExchangeOperation()
                            .SetSourceExchangeName("bar")
                            .SetDestinationExchangeName("foo")
                            .SetRoutingKey("#");

            Assert.AreEqual("bar", operation.SourceExchangeName);
            Assert.AreEqual("foo", operation.DestinationExchangeName);
            Assert.AreEqual("#", operation.RoutingKey);
            Assert.AreEqual(0, operation.Arguments.Count);
        }
Ejemplo n.º 4
0
        public void PropertySettersFullTest()
        {
            var operation = new UnbindExchangeOperation()
                            .SetSourceExchangeName("bar")
                            .SetDestinationExchangeName("foo")
                            .SetRoutingKey("#")
                            .AddArgument("foo", "foo-bar");

            Assert.AreEqual("bar", operation.SourceExchangeName);
            Assert.AreEqual("foo", operation.DestinationExchangeName);
            Assert.AreEqual("#", operation.RoutingKey);
            Assert.AreEqual(1, operation.Arguments.Count);
            Assert.IsTrue(operation.Arguments.ContainsKey("foo"));
            Assert.AreEqual("foo-bar", operation.Arguments["foo"]);
        }