public void PatchesNonErrorMessagesToWrappedImplementation(BrokerageMessageType type) { var wrapped = new Mock <IBrokerageMessageHandler>(); wrapped.Setup(bmh => bmh.Handle(It.IsAny <BrokerageMessageEvent>())).Verifiable(); var downgrader = new DowngradeErrorCodeToWarningBrokerageMessageHandler(wrapped.Object, new[] { "code" }); var message = new BrokerageMessageEvent(type, "code", "message"); downgrader.Handle(message); wrapped.Verify(bmh => bmh.Handle(message), Times.Once); }
public void ErrorTest() { string actual = null; // subscribe to invalid symbol const string expected = "[\"BTC-LTC\"]"; _wss.Setup(w => w.Send(It.IsAny <string>())).Callback <string>(c => actual = c); _unit.Subscribe(new[] { Symbol.Create("BTCLTC", SecurityType.Crypto, Market.GDAX) }); StringAssert.Contains(expected, actual); BrokerageMessageType messageType = 0; _unit.Message += (sender, e) => { messageType = e.Type; }; const string json = "{\"type\":\"error\",\"message\":\"Failed to subscribe\",\"reason\":\"Invalid product ID provided\"}"; _unit.OnMessage(_unit, GDAXTestsHelpers.GetArgs(json)); Assert.AreEqual(BrokerageMessageType.Warning, messageType); }
/// <summary> /// Initializes a new instance of the BrokerageMessageEvent class /// </summary> /// <param name="type">The type of brokerage message</param> /// <param name="code">The brokerage specific code</param> /// <param name="message">The message text received from the brokerage</param> public BrokerageMessageEvent(BrokerageMessageType type, string code, string message) { Type = type; Code = code; Message = message; }
/// <summary> /// Initializes a new instance of the BrokerageMessageEvent class /// </summary> /// <param name="type">The type of brokerage message</param> /// <param name="code">The brokerage specific code</param> /// <param name="message">The message text received from the brokerage</param> public BrokerageMessageEvent(BrokerageMessageType type, int code, string message) { Type = type; Code = code.ToString(); Message = message; }
/// <summary> /// Initializes a new instance of the BrokerageMessageEvent class /// </summary> /// <param name="type">The type of brokerage message</param> /// <param name="code">The brokerage specific code</param> /// <param name="message">The message text received from the brokerage</param> public BrokerageMessageEvent(BrokerageMessageType type, int code, string message) { Type = type; Code = code; Message = message; }
/// <summary> /// Initializes a new instance of the BrokerageMessageEvent class /// </summary> /// <param name="type">The type of brokerage message</param> /// <param name="code">The brokerage specific code</param> /// <param name="message">The message text received from the brokerage</param> public BrokerageMessageEvent(BrokerageMessageType type, int code, string message) { Type = type; Code = code.ToStringInvariant(); Message = message; }