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 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);
        }