コード例 #1
0
        public void TestConstructor()
        {
            var tcc = new TorznabCapabilitiesCategories();

            Assert.IsEmpty(tcc.GetTorznabCategories());
            Assert.IsEmpty(tcc.GetTrackerCategories());
        }
コード例 #2
0
        public void TestConcat()
        {
            var lhs = new TorznabCapabilitiesCategories();
            var rhs = CreateTestDataset();

            lhs.Concat(rhs);
            Assert.AreEqual(5, lhs.GetTorznabCategories().Count); // removed custom cats
            Assert.AreEqual(0, lhs.GetTrackerCategories().Count); // removed tracker mapping
        }
コード例 #3
0
        public void TestConcat()
        {
            var lhs = new TorznabCapabilitiesCategories();
            var rhs = CreateTestDataset();

            lhs.Concat(rhs);
            var expected = new List <TorznabCategory>
            {
                TorznabCatType.Movies.CopyWithoutSubCategories(),
                TorznabCatType.Books.CopyWithoutSubCategories(),
                TorznabCatType.Console.CopyWithoutSubCategories()
            };

            expected[0].SubCategories.Add(TorznabCatType.MoviesSD.CopyWithoutSubCategories());
            expected[1].SubCategories.Add(TorznabCatType.BooksComics.CopyWithoutSubCategories());
            expected[2].SubCategories.Add(TorznabCatType.ConsoleXBox.CopyWithoutSubCategories());
            expected[2].SubCategories.Add(TorznabCatType.ConsoleWii.CopyWithoutSubCategories());
            TestCategories.CompareCategoryTrees(expected, lhs.GetTorznabCategoryTree()); // removed custom cats
            Assert.AreEqual(0, lhs.GetTrackerCategories().Count);                        // removed tracker mapping

            lhs = CreateTestDataset();
            rhs = CreateTestDataset();
            lhs.Concat(rhs);
            expected = new List <TorznabCategory>
            {
                TorznabCatType.Movies.CopyWithoutSubCategories(),
                    TorznabCatType.Books.CopyWithoutSubCategories(),
                    TorznabCatType.Console.CopyWithoutSubCategories(),
                new TorznabCategory(100044, "Console/Xbox_c"),
                new TorznabCategory(137107, "Console/Wii_c"),
                new TorznabCategory(100040, "Console/Xbox_c2")
            };
            expected[0].SubCategories.Add(TorznabCatType.MoviesSD.CopyWithoutSubCategories());
            expected[1].SubCategories.Add(TorznabCatType.BooksComics.CopyWithoutSubCategories());
            expected[2].SubCategories.Add(TorznabCatType.ConsoleXBox.CopyWithoutSubCategories());
            expected[2].SubCategories.Add(TorznabCatType.ConsoleWii.CopyWithoutSubCategories());
            TestCategories.CompareCategoryTrees(expected, lhs.GetTorznabCategoryTree()); // check there are not duplicates
        }