public void Sort_Videos_By_DisplayName_Desc_Creation_Date_Asc_With_All_Any_None_Parameters() { // Perform the API call BrightcoveItemCollection <BrightcoveVideo> videos = Api.SearchVideos ( AllFieldValues, AnyFieldValues, NoneFieldValues, 100, 0, false, new SortedFieldDictionary(SortBy.DisplayName, SortOrder.Descending, SortBy.CreationDate, SortOrder.Ascending) ); List <BrightcoveVideo> expectedVideos = AllVideos .Where(x => videos.Select(y => y.Id).Contains(x.Id)) .OrderByDescending(x => x.Name.Replace("-", "").Replace("_", "")) // Brightcove search doesn't seem to take dashes and underscores into consideration when ordering; perhaps all special characters? .ThenBy(x => x.CreationDate) .ToList(); bool hasCorrectIndexes = expectedVideos .Select((x, i) => new { Id = x.Id, Index = i }) .All(x => x.Index == videos.IndexOf(videos.Single(y => y.Id == x.Id))); Assert.AreEqual(expectedVideos.Count, videos.Count); Assert.IsTrue(hasCorrectIndexes); }
public void Sort_Videos_By_Creation_Date_Desc_With_All_Any_None_Parameters() { // Perform the API call BrightcoveItemCollection <BrightcoveVideo> videos = Api.SearchVideos ( AllFieldValues, AnyFieldValues, NoneFieldValues, 100, 0, false, SortBy.CreationDate, SortOrder.Descending ); // Assume data is searched correctly based on the parameters, but check to see if the dates are in fact sorted correctly. List <BrightcoveVideo> expectedVideos = AllVideos .Where(x => videos.Select(y => y.Id).Contains(x.Id)) .OrderByDescending(x => x.CreationDate) .ToList(); bool hasCorrectIndexes = expectedVideos .Select((x, i) => new { Id = x.Id, Index = i }) .All(x => x.Index == videos.IndexOf(videos.Single(y => y.Id == x.Id))); Assert.AreEqual(expectedVideos.Count, videos.Count); Assert.IsTrue(hasCorrectIndexes); }
public void UpdateAudioTrackInformation_ReferenceId_Test() { BrightcoveItemCollection <BrightcoveAudioTrack> audioTracks = Api.FindAllAudioTracks(); BrightcoveAudioTrack audioTrack = audioTracks.Single(x => x.LongDescription.Contains("arbor")); // arbor for pearl hARBOR // Change the reference Id audioTrack.ReferenceId = "FDR-Pearl-Harbor"; BrightcoveAudioTrack result = Api.UpdateAudioTrack(audioTrack); Assert.AreEqual(audioTrack.ReferenceId, result.ReferenceId); }
public void UpdateAudioTrackInformation_Tags_Test() { BrightcoveItemCollection <BrightcoveAudioTrack> audioTracks = Api.FindAllAudioTracks(); BrightcoveAudioTrack audioTrack = audioTracks.Single(x => x.LongDescription.Contains("arbor")); // arbor for pearl hARBOR // Make sure the tag property changes. string[] tags = audioTrack.Tags.Any() ? new string[] { } : new[] { "War", "world-war-two", "Japan", "president" }; audioTrack.Tags = tags; BrightcoveAudioTrack result = Api.UpdateAudioTrack(audioTrack); Assert.IsTrue(tags.OrderBy(x => x).SequenceEqual(result.Tags.OrderBy(x => x))); }
public void Sort_Videos_By_None_Desc_Creation_Date_Asc_With_All_Any_None_Parameters() { // Perform the API call BrightcoveItemCollection <BrightcoveVideo> videos = Api.SearchVideos(new List <FieldValuePair> { new FieldValuePair(null, "sea") }, new List <FieldValuePair> { new FieldValuePair(null, "lion"), new FieldValuePair(null, "clown"), new FieldValuePair(null, "crab"), new FieldValuePair(null, "turtle"), new FieldValuePair(null, "seagulls") }, new List <FieldValuePair> { new FieldValuePair(null, "fish") }, 100, 0, false, new SortedFieldDictionary(SortBy.None, SortOrder.Descending, SortBy.CreationDate, SortOrder.Ascending)); List <BrightcoveVideo> expectedVideos = AllVideos .Where(x => videos.Select(y => y.Id).Contains(x.Id)) .OrderBy(x => x.CreationDate) .ToList(); bool hasCorrectIndexes = expectedVideos .Select((x, i) => new { Id = x.Id, Index = i }) .All(x => x.Index == videos.IndexOf(videos.Single(y => y.Id == x.Id))); Assert.AreEqual(expectedVideos.Count, videos.Count); Assert.IsTrue(hasCorrectIndexes); }