Example #1
0
        public void FormUploadTokenConstructorTest()
        {
            Stream          stream = null; // TODO: Initialize to an appropriate value
            FormUploadToken target = new FormUploadToken(stream);

            Assert.Fail("TODO: Implement code to verify target");
        }
Example #2
0
        public void FormUploadTokenConstructorTest1()
        {
            string          url    = "http://www.google.com";
            string          token  = "token";
            FormUploadToken target = new FormUploadToken(url, token);

            Assert.AreEqual(target.Token, token, "token better be the same");
            Assert.AreEqual(target.Url, url, "Url better be the same");
        }
Example #3
0
        public void TokenTest()
        {
            Stream          stream   = null;                        // TODO: Initialize to an appropriate value
            FormUploadToken target   = new FormUploadToken(stream); // TODO: Initialize to an appropriate value
            string          expected = "secret text string";        // TODO: Initialize to an appropriate value
            string          actual;

            target.Token = expected;
            actual       = target.Token;
            Assert.AreEqual(expected, actual);
            Assert.Fail("Verify the correctness of this test method.");
        }
    protected void SubmitVideo_ServerClick(object sender, EventArgs e)
    {
        if (String.IsNullOrEmpty(this.Title.Text) == false &&
            String.IsNullOrEmpty(this.Description.Text) == false &&
            String.IsNullOrEmpty(this.Category.SelectedValue) == false &&
            String.IsNullOrEmpty(this.Keyword.Text) == false)
        {
            GAuthSubRequestFactory authFactory = new GAuthSubRequestFactory(ServiceNames.YouTube, "TesterApp");

            YouTubeService service = new YouTubeService(authFactory.ApplicationName,
                                                        "ytapi-FrankMantek-TestaccountforGD-sjgv537n-0",
                                                        "AI39si4v3E6oIYiI60ndCNDqnPP5lCqO28DSvvDPnQt-Mqia5uPz2e4E-gMSBVwHXwyn_LF1tWox4LyM-0YQd2o4i_3GcXxa2Q"
                                                        );

            authFactory.Token      = HttpContext.Current.Session["token"] as string;
            service.RequestFactory = authFactory;

            try
            {
                YouTubeEntry entry = new YouTubeEntry();

                entry.Media             = new Google.GData.YouTube.MediaGroup();
                entry.Media.Description = new MediaDescription(this.Description.Text);
                entry.Media.Title       = new MediaTitle(this.Title.Text);
                entry.Media.Keywords    = new MediaKeywords(this.Keyword.Text);

                // entry.Media.Categories
                MediaCategory category = new MediaCategory(this.Category.SelectedValue);
                category.Attributes["scheme"] = YouTubeService.DefaultCategory;

                entry.Media.Categories.Add(category);
                FormUploadToken token = service.FormUpload(entry);
                HttpContext.Current.Session["form_upload_url"]   = token.Url;
                HttpContext.Current.Session["form_upload_token"] = token.Token;
                string page = "http://" + Request.ServerVariables["SERVER_NAME"];
                if (Request.ServerVariables["SERVER_PORT"] != "80")
                {
                    page += ":" + Request.ServerVariables["SERVER_PORT"];
                }
                page += Request.ServerVariables["URL"];

                HttpContext.Current.Session["form_upload_redirect"] = page;
                Response.Redirect("UploadVideo.aspx");
            }
            catch (GDataRequestException gdre)
            {
                HttpWebResponse response = (HttpWebResponse)gdre.Response;
            }
        }
    }