コード例 #1
0
ファイル: PayloadObject.cs プロジェクト: larsenjo/odata.net
 public PayloadObject(CommonPayload parent)
 {
     Payload = parent;
     PayloadObjects = new List<PayloadObject>();
     PayloadProperties = new List<PayloadProperty>();
     NamedStreams = new List<PayloadNamedStream>();
     SyndicationItemProperties = new Dictionary<AtomSyndicationItemProperty, string>();
     CustomEpmMappedProperties = new Dictionary<string, string>();
 }
コード例 #2
0
ファイル: PayloadVerifier.cs プロジェクト: larsenjo/odata.net
 protected static bool TryGetSingleObjectFromPayload(CommonPayload payload, out PayloadObject payloadObject)
 {
     List<PayloadObject> list = payload.Resources as List<PayloadObject>;
     if (list == null || list.Count != 1)
     {
         payloadObject = null;
         return false;
     }
     payloadObject = list[0];
     return true;
 }
コード例 #3
0
ファイル: RequestUtil.cs プロジェクト: AlineGuan/odata.net
 public static void GetAndVerifyStatusCode(Workspace w, string uri, HttpStatusCode expectedStatusCode, out CommonPayload responsePayload)
 {
     AstoriaResponse response;
     GetAndVerifyStatusCode(w, uri, expectedStatusCode, out response);
     responsePayload = response.CommonPayload;
 }
コード例 #4
0
        private static void VerifyLinksPayload(Workspace w, CommonPayload payload, LinqQueryBuilder linqBuilder)
        {
            ArrayList expectedEntities = CommonPayload.CreateList(linqBuilder.QueryResult);
            if (payload == null)
                AstoriaTestLog.AreEqual(expectedEntities.Count, 0, "Unexpected null $ref payload");
            else
            {
                KeyExpressions expectedKeys = new KeyExpressions();
                foreach (object o in expectedEntities)
                {
                    KeyExpression keyExp = w.CreateKeyExpressionFromProviderObject(o);
                    expectedKeys.Add(keyExp);
                }

                List<string> linksFound = new List<string>();

                if (payload.Resources == null)
                {
                    linksFound.Add(payload.Value);
                }
                else
                {
                    foreach (PayloadObject o in (payload.Resources as List<PayloadObject>))
                    {
                        if(o.PayloadProperties.Any(p => p.Name == "uri"))
                            linksFound.Add((o["uri"] as PayloadSimpleProperty).Value);
                    }
                }

                AstoriaTestLog.AreEqual(expectedKeys.Count, linksFound.Count, "Number of expected entities does not match number of links found");

                foreach (string link in linksFound)
                {
                    KeyExpression match = null;
                    foreach (KeyExpression expectedKey in expectedKeys)
                    {
                        if (compareKeyURI(link, expectedKey))
                        {
                            match = expectedKey;
                            break;
                        }
                    }

                    if (match != null)
                    {
                        expectedKeys.Remove(match);
                    }
                    else
                    {
                        AstoriaTestLog.WriteLineIgnore("Unexpected URI: '" + link + "'");
                        AstoriaTestLog.FailAndThrow("Unexpected URI found in $ref payload");
                    }
                }
            }
        }