Beispiel #1
0
        public void Should_Parse_OrderDeleteMessage_Culture_Independent(string cultureName)
        {
            // Arrange
            TestHelper.SetThreadCulture(cultureName);
            var orderDeleteMessageString = "5,@ESM19,12345678,,A,20:31:04.876740,2019-04-23,";

            // Act
            var orderDeleteMessageParsed = OrderDeleteMessage.Parse(orderDeleteMessageString);

            TimeSpan.TryParseExact("20:31:04.876740", OrderDeleteMessage.UpdateMessageTimeFormat, CultureInfo.InvariantCulture, TimeSpanStyles.None, out var orderTime);
            DateTime.TryParseExact("2019-04-23", OrderDeleteMessage.UpdateMessageDateFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out var orderDate);
            var orderDeleteMessage = new OrderDeleteMessage(Level2MessageType.OrderDelete, "@ESM19", 12345678, Level2Side.Sell, orderTime, orderDate);

            // Assert
            Assert.AreEqual(orderDeleteMessageParsed, orderDeleteMessage);
        }
Beispiel #2
0
        public void Should_Receive_OrderDeleteMessages()
        {
            // Arrange
            var message = TestHelper.GetMessageBytes("5,@ESM19,12345678,,A,20:31:04.876740,2019-04-23,\r\n");
            TimeSpan.TryParseExact("20:31:04.876740", OrderDeleteMessage.UpdateMessageTimeFormat, CultureInfo.InvariantCulture, TimeSpanStyles.None, out var orderTime);
            DateTime.TryParseExact("2019-04-23", OrderDeleteMessage.UpdateMessageDateFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out var orderDate);
            var expectedMessage = new OrderDeleteMessage(Level2MessageType.OrderDelete, "@ESM19", 12345678, Level2Side.Sell, orderTime, orderDate);

            OrderDeleteMessage receivedMessage = null;
            _level2MessageHandler.OrderDelete += msg =>
            {
                receivedMessage = msg;
            };

            // Act
            _level2MessageHandler.ProcessMessages(message, message.Length);

            // Assert
            Assert.AreEqual(receivedMessage, expectedMessage);
        }
Beispiel #3
0
        private void ProcessOrderDeleteMessage(string msg)
        {
            var orderDeleteMessage = OrderDeleteMessage.Parse(msg);

            OrderDelete?.Invoke(orderDeleteMessage);
        }