コード例 #1
0
        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));
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="client"></param>
        /// <param name="callback"></param>
        /// <param name="symbols"></param>
        public static ITradeClient Unsubscribe(this ITradeClient client, Action <TradeEventArgs> 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);
        }
コード例 #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="client"></param>
 /// <param name="symbol"></param>
 public static ITradeClient Unsubscribe(this ITradeClient client, string symbol)
 => client.Unsubscribe(symbol, null);