示例#1
0
        public void GetList(string project, string app, string resource, string format, int start, int limit, string sortOrder, string sortBy, string indexStyle)
        {
            try
            {
                // get list of contents is not allowed in this service
                if (string.IsNullOrEmpty(format) || !(format.ToLower() == "dto" || format.ToLower() == "rdf" ||
                                                      format.ToLower().Contains("xml") || format.ToLower().Contains("json")))
                {
                    format = "json";
                }

                NameValueCollection parameters = WebOperationContext.Current.IncomingRequest.UriTemplateMatch.QueryParameters;

                bool fullIndex = false;
                if (indexStyle != null && indexStyle.ToUpper() == "FULL")
                {
                    fullIndex = true;
                }

                XDocument xDocument = _adapterProvider.GetList(project, app, resource, ref format, start, limit, sortOrder, sortBy, fullIndex, parameters);
                _adapterProvider.FormatOutgoingMessage(xDocument.Root, format);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#2
0
        public void GetIndex()
        {
            XDocument benchmark = null;

            string format = "p7xml";

            XDocument xDocument =
                _adapterProvider.GetList(
                    _settings["ProjectName"], _settings["ApplicationName"],
                    _settings["GraphName"],
                    ref format,
                    0, 0, null, null,
                    false,
                    null
                    );

            string path = String.Format(
                "{0}GetXmlIndex.xml",
                _settings["AppDataPath"]
                );

            if (_settings["TestMode"].ToLower() != "usefiles")
            {
                xDocument.Save(path);
                Assert.AreNotEqual(null, xDocument);
            }
            else
            {
                benchmark = XDocument.Load(path);
                Assert.AreEqual(benchmark.ToString(), xDocument.ToString());
            }
        }