public RequestResponse RefreshTableByAccountRequest(RefreshTableByAccountRequest request)
        {
            this.Validator.Validate(request);

            var fxReq = this.FxRequestFactory.createRefreshTableRequestByAccount(ConvertersInternal.GetTableType(request.Table),
                                                                                 request.AccountID);

            this.FxSession.sendRequest(fxReq);

            return(Helpers.GetRequestResponse(fxReq));
        }
        public void Validate(RefreshTableByAccountRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }

            if (request.Table == TableType.Unknown || request.Table == TableType.Summary)
            {
                throw new ArgumentOutOfRangeException("Table");
            }

            if (string.IsNullOrEmpty(request.AccountID))
            {
                throw new ArgumentNullException("AccountID");
            }
        }
        public void ValidateRefreshTableByAccountRequest()
        {
            // Null.
            {
                var v = new RequestProviderValidator();
                RefreshTableByAccountRequest r = null;

                AssertEx.Throws <ArgumentNullException>(() =>
                {
                    v.Validate(r);
                });
            }

            // Invalid tables.
            {
                foreach (var opt in new[] { TableType.Unknown, TableType.Summary })
                {
                    var v = new RequestProviderValidator();
                    RefreshTableByAccountRequest r = new RefreshTableByAccountRequest();
                    r.Table = opt;

                    AssertEx.Throws <ArgumentOutOfRangeException>(() =>
                    {
                        v.Validate(r);
                    });
                }
            }

            // AccountID null.
            {
                var v = new RequestProviderValidator();
                RefreshTableByAccountRequest r = new RefreshTableByAccountRequest();
                r.Table     = TableType.Orders;
                r.AccountID = null;

                AssertEx.Throws <ArgumentNullException>(() =>
                {
                    v.Validate(r);
                });
            }

            // AccountID empty.
            {
                var v = new RequestProviderValidator();
                RefreshTableByAccountRequest r = new RefreshTableByAccountRequest();
                r.Table     = TableType.Orders;
                r.AccountID = "";

                AssertEx.Throws <ArgumentNullException>(() =>
                {
                    v.Validate(r);
                });
            }

            // Valid.
            {
                foreach (var opt in new[] { TableType.Accounts, TableType.ClosedTrades, TableType.Messages,
                                            TableType.Offers, TableType.Trades, TableType.Orders })
                {
                    var v = new RequestProviderValidator();
                    RefreshTableByAccountRequest r = new RefreshTableByAccountRequest();
                    r.Table     = opt;
                    r.AccountID = "TEST";

                    v.Validate(r);
                }
            }
        }
Beispiel #4
0
 public RequestResponse RefreshTableByAccountRequest(RefreshTableByAccountRequest request)
 {
     throw new NotImplementedException();
 }