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)); }
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)); }
public void Should_be_able_to_get_name() { const string expectedName = "the_name"; var exchangeInfo = new ExchangeInfo(expectedName, "direct"); exchangeInfo.GetName().ShouldEqual(expectedName); }