void TestFilterTreeNoLinkedIds(IFilterTree tree)
        {
            IFilter item0Filter = tree.BuildFilter();

            Assert.AreEqual(item0Filter.ToString(),
                            "MediaItem.Title EQ Item0 And (ROLE = '00000000-aaaa-aaaa-aaaa-111111111111' AND LINKED_ROLE = '22222222-aaaa-aaaa-aaaa-111111111111' AND LINKED_ID IN (MediaItem.Title EQ Item1 And (ROLE = '22222222-aaaa-aaaa-aaaa-111111111111' AND LINKED_ROLE = '44444444-aaaa-aaaa-aaaa-111111111111' AND LINKED_ID IN (MediaItem.Title EQ Item2)) And (ROLE = '22222222-aaaa-aaaa-aaaa-111111111111' AND LINKED_ROLE = '66666666-aaaa-aaaa-aaaa-111111111111' AND LINKED_ID IN (MediaItem.Title EQ Item3))))");

            IFilter item1Filter = tree.BuildFilter(new FilterTreePath(item1Role));

            Assert.AreEqual(item1Filter.ToString(),
                            "MediaItem.Title EQ Item1 And (ROLE = '22222222-aaaa-aaaa-aaaa-111111111111' AND LINKED_ROLE = '44444444-aaaa-aaaa-aaaa-111111111111' AND LINKED_ID IN (MediaItem.Title EQ Item2)) And (ROLE = '22222222-aaaa-aaaa-aaaa-111111111111' AND LINKED_ROLE = '66666666-aaaa-aaaa-aaaa-111111111111' AND LINKED_ID IN (MediaItem.Title EQ Item3)) And (ROLE = '22222222-aaaa-aaaa-aaaa-111111111111' AND LINKED_ROLE = '00000000-aaaa-aaaa-aaaa-111111111111' AND LINKED_ID IN (MediaItem.Title EQ Item0))");

            IFilter item2Filter = tree.BuildFilter(new FilterTreePath(item1Role, item2Role));

            Assert.AreEqual(item2Filter.ToString(),
                            "MediaItem.Title EQ Item2 And (ROLE = '44444444-aaaa-aaaa-aaaa-111111111111' AND LINKED_ROLE = '22222222-aaaa-aaaa-aaaa-111111111111' AND LINKED_ID IN (MediaItem.Title EQ Item1 And (ROLE = '22222222-aaaa-aaaa-aaaa-111111111111' AND LINKED_ROLE = '66666666-aaaa-aaaa-aaaa-111111111111' AND LINKED_ID IN (MediaItem.Title EQ Item3)) And (ROLE = '22222222-aaaa-aaaa-aaaa-111111111111' AND LINKED_ROLE = '00000000-aaaa-aaaa-aaaa-111111111111' AND LINKED_ID IN (MediaItem.Title EQ Item0))))");
        }
        void TestFilterTreeWithLinkedIds(IFilterTree tree)
        {
            IFilter item0Filter = tree.BuildFilter();

            Assert.AreEqual(item0Filter.ToString(),
                            "MediaItem.Title EQ Item0 And (LINKED_ID = '11111111-aaaa-aaaa-aaaa-111111111111' AND ROLE = '00000000-aaaa-aaaa-aaaa-111111111111' AND LINKED_ROLE = '22222222-aaaa-aaaa-aaaa-111111111111')");

            IFilter item1Filter = tree.BuildFilter(new FilterTreePath(item1Role));

            Assert.AreEqual(item1Filter.ToString(),
                            "MEDIA_ITEM_ID = '11111111-aaaa-aaaa-aaaa-111111111111'");

            IFilter item2Filter = tree.BuildFilter(new FilterTreePath(item1Role, item2Role));

            Assert.AreEqual(item2Filter.ToString(),
                            "MediaItem.Title EQ Item2 And (LINKED_ID = '11111111-aaaa-aaaa-aaaa-111111111111' AND ROLE = '44444444-aaaa-aaaa-aaaa-111111111111' AND LINKED_ROLE = '22222222-aaaa-aaaa-aaaa-111111111111')");
        }
Beispiel #3
0
 public MediaLibraryQueryViewSpecification(string viewDisplayName, IFilterTree filterTree,
                                           IEnumerable <Guid> necessaryMIATypeIDs, IEnumerable <Guid> optionalMIATypeIDs, bool onlyOnline) :
     base(viewDisplayName, necessaryMIATypeIDs, optionalMIATypeIDs)
 {
     _filterTree = filterTree ?? new SimpleFilterTree();
     _query      = new MediaItemQuery(necessaryMIATypeIDs, optionalMIATypeIDs, _filterTree.BuildFilter());
     _onlyOnline = onlyOnline;
 }