public void Use_Japanese_Url()
        {
            // Override the default API.
            Api = BrightcoveApiFactory.CreateApi(ApiKey, BrightcoveRegion.Japan);

            // The token doesn't work with the Japanese version of the API, and so it should throw an Invalid Token error; nonetheless, we want to check to see if the URL was properly constructed.
            try
            {
                var videos = Api.SearchVideos(new List <FieldValuePair>(),
                                              new List <FieldValuePair>(),
                                              new List <FieldValuePair>());
            }
            catch (BrightcoveApiException ex)
            {
                // Check to see whether the code references the Brightcove invalid token code (as of December 2012).
                if (ex.Error.Code != 210)
                {
                    throw;
                }
            }

            String url         = ((BrightcoveApiConnector)Api.Connector).RequestUrl;
            String expectedUrl = String.Format("http://api.brightcove.co.jp/services/library?command=search_videos&token={0}&sort_by=CREATION_DATE%3aASC&exact=false&page_size=100&page_number=0&get_item_count=true", HttpUtility.UrlEncode(ApiKey));

            Assert.AreEqual(expectedUrl, url);
        }
        public void FindAllVideos()
        {
            Api = BrightcoveApiFactory.CreateApi(ApiKey);
            // Perform the API call
            BrightcoveItemCollection <BrightcoveVideo> videos = Api.SearchVideos(new List <FieldValuePair>(),
                                                                                 new List <FieldValuePair>(),
                                                                                 new List <FieldValuePair>());

            int k = 0;

            while (k <= Math.Floor((decimal)videos.TotalCount / (decimal)videos.PageSize))
            {
                if (k != 0)
                {
                    videos = Api.SearchVideos(new List <FieldValuePair>(),
                                              new List <FieldValuePair>(),
                                              new List <FieldValuePair>(),
                                              videos.PageSize,
                                              k);
                }

                AllVideos.AddRange(videos);

                k++;
            }
        }
 public void SetUp()
 {
     _api = BrightcoveApiFactory.CreateApi(ApiKeys.ReadToken, ApiKeys.WriteToken);
 }
 public void TestFixtureSetUp()
 {
     Api = BrightcoveApiFactory.CreateApi(ApiKeys.ReadToken, ApiKeys.WriteToken);
     // Find a random audio track.
     AudioTrack = Api.FindAllAudioTracks(1, 0).FirstOrDefault();
 }
 public void Create_Brightcove_Api()
 {
     // Instantiate an API object by using the provided factory
     Api = BrightcoveApiFactory.CreateApi(ApiKey);
 }