diff --git a/CoinbasePro.Specs/JsonFixtures/Websocket/WebSocketTypeResponseFixture.cs b/CoinbasePro.Specs/JsonFixtures/Websocket/WebSocketTypeResponseFixture.cs index 5900db57..8a648a13 100644 --- a/CoinbasePro.Specs/JsonFixtures/Websocket/WebSocketTypeResponseFixture.cs +++ b/CoinbasePro.Specs/JsonFixtures/Websocket/WebSocketTypeResponseFixture.cs @@ -100,20 +100,21 @@ public static string CreateLevel2Response() }"; } - public static string CreateReceivedResponse() + public static string CreateReceivedResponse(string clientOid) { - return @" -{ + return $@" +{{ ""type"": ""received"", ""time"": ""2014-11-07T08:19:27.028459Z"", ""product_id"": ""BTC-USD"", + ""client_oid"": ""{clientOid}"", ""sequence"": 10, ""order_id"": ""d50ec984-77a8-460a-b958-66f114b0de9b"", ""size"": ""1.34"", ""price"": ""502.1"", ""side"": ""buy"", ""order_type"": ""limit"" -}"; +}}"; } public static string CreateOpenResponse() diff --git a/CoinbasePro.Specs/WebSocket/WebSocketSpecs.cs b/CoinbasePro.Specs/WebSocket/WebSocketSpecs.cs index c6a25620..dba2bad1 100644 --- a/CoinbasePro.Specs/WebSocket/WebSocketSpecs.cs +++ b/CoinbasePro.Specs/WebSocket/WebSocketSpecs.cs @@ -257,16 +257,33 @@ class when_response_type_is_heartbeat class when_response_type_is_received { - Because of = () => + class with_client_oid { - Subject.Start(product_type_inputs, no_channel_type_inputs); + Because of = () => + { + Subject.Start(product_type_inputs, no_channel_type_inputs); - websocket_feed.Raise(e => e.MessageReceived += null, new MessageReceivedEventArgs(WebSocketTypeResponseFixture.CreateReceivedResponse())); - }; + websocket_feed.Raise(e => e.MessageReceived += null, new MessageReceivedEventArgs(WebSocketTypeResponseFixture.CreateReceivedResponse("d0c5340b-6d6c-49d9-b567-48c4bfca13d2"))); + }; - It should_have_invoked_received_response = () => - The(). - WasToldTo(p => p.Invoke(Param.IsAny>>(), Param.IsAny(), Param.IsAny>())); + It should_have_invoked_received_response = () => + The(). + WasToldTo(p => p.Invoke(Param.IsAny>>(), Param.IsAny(), Param.IsAny>())); + } + + class with_blank_client_oid + { + Because of = () => + { + Subject.Start(product_type_inputs, no_channel_type_inputs); + + websocket_feed.Raise(e => e.MessageReceived += null, new MessageReceivedEventArgs(WebSocketTypeResponseFixture.CreateReceivedResponse(string.Empty))); + }; + + It should_have_invoked_received_response = () => + The(). + WasToldTo(p => p.Invoke(Param.IsAny>>(), Param.IsAny(), Param.IsAny>())); + } } class when_response_type_is_open diff --git a/CoinbasePro/WebSocket/Models/Response/Received.cs b/CoinbasePro/WebSocket/Models/Response/Received.cs index 8a2dac55..9f93fd0e 100644 --- a/CoinbasePro/WebSocket/Models/Response/Received.cs +++ b/CoinbasePro/WebSocket/Models/Response/Received.cs @@ -16,7 +16,7 @@ public class Received : BaseMessage public OrderSide Side { get; set; } - public Guid ClientOid { get; set; } + public Guid? ClientOid { get; set; } public ProductType ProductId { get; set; }