Ejemplo n.º 1
0
        public void Should_be_able_to_create_an_exchange()
        {
            var vhost = new Vhost {Name = "/"};

            var exchangeInfo = new ExchangeInfo(testExchange, "direct");
            var exchange = managementClient.CreateExchange(exchangeInfo, vhost);
            exchange.Name.ShouldEqual(testExchange);
        }
 public void Should_be_able_to_get_name()
 {
     const string expectedName = "the_name";
     var exchangeInfo = new ExchangeInfo(expectedName, "direct");
     exchangeInfo.GetName().ShouldEqual(expectedName);
 }
 public void Should_be_able_to_create_an_exchange_with_plus_char_in_the_name()
 {
     var vhost = managementClient.GetVhost(vhostName);
     var exhangeInfo = new ExchangeInfo(testExchangetestQueueWithPlusChar, "direct");
     var queue = managementClient.CreateExchange(exhangeInfo, vhost);
     queue.Name.ShouldEqual(testExchangetestQueueWithPlusChar);
 }
        public void Should_create_exchange_to_exchange_binding()
        {
            const string sourceExchangeName = "management_api_test_source_exchange";
            const string destinationExchangeName = "management_api_test_destination_exchange";

            var vhost = managementClient.GetVhost(vhostName);
            var sourceExchangeInfo = new ExchangeInfo(sourceExchangeName, "direct");
            var destinationExchangeInfo = new ExchangeInfo(destinationExchangeName, "direct");

            var sourceExchange = managementClient.CreateExchange(sourceExchangeInfo, vhost);
            var destinationExchange = managementClient.CreateExchange(destinationExchangeInfo, vhost);

            managementClient.CreateBinding(sourceExchange, destinationExchange, new BindingInfo("#"));

            var binding = managementClient.GetBindingsWithSource(sourceExchange).First();

            managementClient.DeleteExchange(sourceExchange);
            managementClient.DeleteExchange(destinationExchange);

            Assert.AreEqual("exchange", binding.DestinationType);
            Assert.AreEqual(destinationExchangeName, binding.Destination);
            Assert.AreEqual("#", binding.RoutingKey);
        }
 private Exchange CreateExchange(string exchangeName)
 {
     var vhost = new Vhost {Name = vhostName};
     var exchangeInfo = new ExchangeInfo(exchangeName, "direct");
     var exchange = managementClient.CreateExchange(exchangeInfo, vhost);
     return exchange;
 }