Example #1
0
        public void TestThatGetFilesWithTagsReturnsCorrectResults()
        {
            Search.database = ObjectMother.PopulatedDatabase();

            List <String> result;
            List <String> expected = new List <String>();

            result = Search.getFilesWithTags("video");
            expected.Add(ObjectMother.animeFile);
            expected.Add(ObjectMother.videoFile);
            expected.Sort();
            result.Sort();
            Assert.AreEqual(expected, result);

            result   = Search.getFilesWithTags("mkv");
            expected = new List <String>();
            expected.Add(ObjectMother.animeFile);
            expected.Sort();
            result.Sort();
            Assert.AreEqual(expected, result);

            result   = Search.getFilesWithTags("avi");
            expected = new List <String>();
            expected.Add(ObjectMother.videoFile);
            expected.Sort();
            result.Sort();
            Assert.AreEqual(expected, result);

            result   = Search.getFilesWithTags("audio");
            expected = new List <String>();
            expected.Add(ObjectMother.musicFile);
            expected.Add(ObjectMother.soundFile);
            expected.Sort();
            result.Sort();
            Assert.AreEqual(expected, result);

            result   = Search.getFilesWithTags("mp3");
            expected = new List <String>();
            expected.Add(ObjectMother.musicFile);
            expected.Sort();
            result.Sort();
            Assert.AreEqual(expected, result);

            result   = Search.getFilesWithTags("audio", "mp3");
            expected = new List <String>();
            expected.Add(ObjectMother.musicFile);
            expected.Sort();
            result.Sort();
            Assert.AreEqual(expected, result);

            result   = Search.getFilesWithTags("audio", "mp3", "wav");
            expected = new List <String>();
            expected.Sort();
            result.Sort();
            Assert.AreEqual(expected, result);

            result   = Search.getFilesWithTags();
            expected = new List <String>();
            expected.Sort();
            result.Sort();
            Assert.AreEqual(expected, result);
        }