public void SimpleModificationTest()
        {
            var auth = new DelegateAuthenticator((request) => request.Timeout = 1234);
            HttpWebRequest result = new HttpRequestFactory().Create(new Uri("http://example.com/"), "GET");
            auth.ApplyAuthenticationToRequest(result);

            // Verify the results.
            Assert.AreEqual("http://example.com/", result.RequestUri.ToString());
            Assert.AreEqual("GET", result.Method);
            Assert.AreEqual(1234, result.Timeout);
        }
Example #2
0
        protected override void ExecuteTask()
        {
            Properties["google.api.field.separator"] = FieldSeparator.ToString();
            Properties["google.api.api.separator"] = ApiSeparator.ToString();
            Properties["google.api.suggested.regex"] = SuggestedRegex;

            var auth = new DelegateAuthenticator(request => request.Headers["X-User-IP"] = "0.0.0.0");
            var discovery = new DiscoveryService(auth);

            DirectoryList apis = discovery.Apis.List().Fetch();
            string[] apiStrings = new string[apis.Items.Count];
            int apiNumber = 0;
            foreach (DirectoryList.ItemsData item in apis.Items)
            {
                apiStrings[apiNumber] = string.Format(ApiFormatString,
                    GetName(item), GetVersion(item),
                    GetClassName(item), GetNamespace(item),
                    GetTitle(item), GetDescription(item), GetDocumentationLink(item),
                    GetIcon32Url(item));
                Project.Log(Level.Info, "Adding Service " + apiStrings[apiNumber]);
                apiNumber++;
            }
            Properties[Property] = string.Join(ApiSeparator.ToString(), apiStrings);
        }