Пример #1
0
        public IncidentPaginationData Get()
        {
            // cheating hack
            string _uri = System.Web.HttpUtility.UrlDecode(Request.RequestUri.Query);

            if (string.IsNullOrEmpty(_uri) || _uri.Length == 1)
            {
                IncidentPaginationData _return = new IncidentPaginationData();
                _return.message = "Invalid pagination options.";
                return(_return);
            }
            if (_uri.Substring(0, 1) == "?")
            {
                _uri = _uri.Substring(1);
            }
            IncidentAccess         _access    = new IncidentAccess(_incidentEntities);
            IncidentPaginationData _incidents = _access.ListByPagination(_uri);

            return(_incidents);
        }
        public void WebSrv_NI_Incident_ListByPagination01_Test()
        {
            IncidentAccess         _sut        = new IncidentAccess(_niEntities);
            string                 _pagination = "{\"first\":0,\"rows\":3,\"sortOrder\":1,\"filters\":{\"ServerId\":{\"value\":1,\"matchMode\":\"equals\"},\"Mailed\":{\"value\":false,\"matchMode\":\"equals\"},\"Closed\":{\"value\":false,\"matchMode\":\"equals\"},\"Special\":{\"value\":false,\"matchMode\":\"equals\"}},\"globalFilter\":null}";
            IncidentPaginationData _data       = _sut.ListByPagination(_pagination);

            System.Diagnostics.Debug.WriteLine(string.Format("Tot Rec:{0}, Msg:{1}",
                                                             _data.totalRecords, _data.message));
            List <IncidentData> _rows = _data.incidents;

            foreach (var _row in _rows)
            {
                System.Diagnostics.Debug.WriteLine(_row.ToString());
            }
            Assert.IsTrue(_rows.Count == 3);
            IncidentData _row0 = _rows[0];

            Assert.AreEqual(_row0.ServerId, 1);
            Assert.AreEqual(_row0.Mailed, false);
        }