public void GetTickers()
        {
            // Arrange
            const string query    = "GOOG";
            const bool   isSearch = false;
            var          paging   = new PagingOptions(10, 1);

            // Act
            var dataSource = _dataProvider.GetTickers(query, isSearch, paging);

            // Assert
            Assert.True(dataSource.Success);
            Assert.True(dataSource.Data.Tickers.Any());
        }
        public object Get(GetTickers request)
        {
            var response = new GetTickersResponse();

            try
            {
                if (string.IsNullOrEmpty(request.DataSource) && string.IsNullOrEmpty(request.Query))
                {
                    throw new ServiceResponseException("Unknown request. Missing parameters.");
                }
                if (request.PerPage <= 0)
                {
                    throw new ArgumentNullException("request", "Invalid [PerPage] field");
                }
                if (request.PageNumber < 0)
                {
                    throw new ArgumentNullException("request", "Invalid [PageNumber] field");
                }

                var cached = _cachingManager.GetTickers(request.ToJson());
                if (cached != null)
                {
                    return(cached);
                }
                else
                {
                    var result = !string.IsNullOrEmpty(request.Query) ?
                                 _dataProvider.GetTickers(request.Query, true, new PagingOptions(request.PerPage, request.PageNumber)) :
                                 _dataProvider.GetTickers(request.DataSource, false, new PagingOptions(request.PerPage, request.PageNumber));

                    if (result != null)
                    {
                        if (result.Success)
                        {
                            response.Success = true;
                            response.Data    = result.Data;
                            _cachingManager.Save(request.ToJson(), response);
                        }
                        else
                        {
                            response.ResponseStatus = new ResponseStatus(string.Empty, result.ErrorMessage);
                        }
                    }
                    else
                    {
                        response.ResponseStatus = new ResponseStatus(string.Empty, "Result is empty");
                    }
                }
            }
            catch (Exception ex)
            {
                var status = new ResponseStatus();
                status.Message    = ex.Message;
                status.ErrorCode  = ex.Source;
                status.StackTrace = ex.StackTrace;

                response.ResponseStatus = status;
            }

            return(response);
        }