public void SendTest() { var content = @"{ ""id"": 2157474, ""order_type"": ""limit"", ""quantity"": ""0.01"", ""disc_quantity"": ""0.0"", ""iceberg_total_quantity"": ""0.0"", ""side"": ""sell"", ""filled_quantity"": ""0.0"", ""price"": ""500.0"", ""created_at"": 1462123639, ""updated_at"": 1462123639, ""status"": ""live"", ""leverage_level"": 1, ""source_exchange"": ""QUOINE"", ""product_id"": 1, ""product_code"": ""CASH"" ""order_fee"": ""0.0"" }"; SetupRestMock <SendReply>(content); var configStore = new JsonConfigStore("config.json", new List <IConfigValidator>()); var ba = new BrokerAdapter(new RestClient(), configStore); var order = new Order { Broker = Broker.Hpx }; ba.Send(order); Assert.AreEqual("2157474", order.BrokerOrderId); Assert.AreEqual(OrderStatus.New, order.Status); Assert.IsTrue((order.SentTime - DateTime.Now).Seconds < 10); Assert.IsTrue((order.LastUpdated - DateTime.Now).Seconds < 10); }
public void SendTest() { var content = @"{ ""id"": 2157474, ""order_type"": ""limit"", ""quantity"": ""0.01"", ""disc_quantity"": ""0.0"", ""iceberg_total_quantity"": ""0.0"", ""side"": ""sell"", ""filled_quantity"": ""0.0"", ""price"": ""500.0"", ""created_at"": 1462123639, ""updated_at"": 1462123639, ""status"": ""live"", ""leverage_level"": 1, ""source_exchange"": ""QUOINE"", ""product_id"": 1, ""product_code"": ""CASH"", ""funding_currency"": ""JPY"", ""currency_pair_code"": ""BTCJPY"", ""order_fee"": ""0.0"" }"; SetupRestMock <SendReply>(content); var ba = new BrokerAdapter(_restClient.Object, _configStore.Object); var order = new Order { Broker = Broker.Quoine }; ba.Send(order); Assert.AreEqual("2157474", order.BrokerOrderId); Assert.AreEqual(OrderStatus.New, order.Status); Assert.IsTrue((order.SentTime - DateTime.Now).Seconds < 10); Assert.IsTrue((order.LastUpdated - DateTime.Now).Seconds < 10); }