Пример #1
0
        public async Task <Exchange> CreateExchangeAsync(ExchangeInfo exchangeInfo, Vhost vhost,
                                                         CancellationToken cancellationToken = default(CancellationToken))
        {
            Ensure.ArgumentNotNull(vhost, nameof(exchangeInfo));
            Ensure.ArgumentNotNull(vhost, nameof(vhost));

            await PutAsync($"exchanges/{SanitiseVhostName(vhost.Name)}/{SanitiseName(exchangeInfo.GetName())}",
                           exchangeInfo, cancellationToken).ConfigureAwait(false);

            return(await GetExchangeAsync(SanitiseName(exchangeInfo.GetName()), vhost,
                                          cancellationToken : cancellationToken).ConfigureAwait(false));
        }
Пример #2
0
        public Exchange CreateExchange(ExchangeInfo exchangeInfo, Vhost vhost)
        {
            if (exchangeInfo == null)
            {
                throw new ArgumentNullException("exchangeInfo");
            }
            if (vhost == null)
            {
                throw new ArgumentNullException("vhost");
            }

            Put(string.Format("exchanges/{0}/{1}", SanitiseVhostName(vhost.Name), exchangeInfo.GetName()), exchangeInfo);

            return(GetExchange(exchangeInfo.GetName(), vhost));
        }
Пример #3
0
        public void Should_be_able_to_get_name()
        {
            const string expectedName = "the_name";
            var          exchangeInfo = new ExchangeInfo(expectedName, "direct");

            exchangeInfo.GetName().ShouldEqual(expectedName);
        }