public void Throws() { Assert.Throws <ArgumentNullException>("symbol", () => _client.Subscribe((string)null)); Assert.Throws <ArgumentNullException>("symbol", () => _client.Subscribe(string.Empty)); Assert.Throws <ArgumentNullException>("symbol", () => _client.Unsubscribe((string)null)); Assert.Throws <ArgumentNullException>("symbol", () => _client.Unsubscribe(string.Empty)); }
/// <summary> /// /// </summary> /// <param name="client"></param> /// <param name="callback"></param> /// <param name="symbols"></param> public static IAggregateTradeClient Unsubscribe(this IAggregateTradeClient client, Action <AggregateTradeEventArgs> callback, params string[] symbols) { Throw.IfNull(client, nameof(client)); Throw.IfNull(symbols, nameof(symbols)); if (callback == null && !symbols.Any()) { throw new ArgumentException($"{nameof(Unsubscribe)}: At least one symbol is required.", nameof(symbols)); } foreach (var symbol in symbols) { client.Unsubscribe(symbol, callback); } return(client); }
/// <summary> /// /// </summary> /// <param name="client"></param> /// <param name="symbol"></param> public static IAggregateTradeClient Unsubscribe(this IAggregateTradeClient client, string symbol) => client.Unsubscribe(symbol, null);