示例#1
0
        public void TestCallEntryExtractedFromXml()
        {
            AdWordsUser user = new AdWordsUser();
            AdWordsSoapHeaderInspector inspector = new AdWordsSoapHeaderInspector()
            {
                User = user
            };
            XmlDocument xDoc      = XmlUtilities.CreateDocument(SoapMessages_v201708.UpdateCampaign);
            XmlElement  xResponse = (XmlElement)xDoc.SelectSingleNode("/Example/SOAP/Response");

            xDoc.LoadXml(xResponse.InnerText);
            this.response =
                Message.CreateMessage(new XmlNodeReader(xDoc), Int32.MaxValue, TestMessageVersion);

            inspector.AfterReceiveReply(ref this.response, null);

            // API no longer returns operation count.
            Assert.AreEqual(user.GetTotalOperationCount(), 0);
            Assert.AreEqual(user.GetOperationCountForLastCall(), 0);

            ApiCallEntry[] callEntries = user.GetCallDetails();
            Assert.AreEqual(callEntries.Length, 1);
            ApiCallEntry callEntry = user.GetCallDetails()[0];

            Assert.AreEqual(0, callEntry.OperationCount);
            Assert.AreEqual("mutate", callEntry.Method);
            Assert.AreEqual("CampaignService", callEntry.Service);
        }