public void SearchWithNoResultsTest()
        {
            // Arrange:
            var mediaList = PopulateMedia();

            var mockRepo = new MockSubtitleRepository(mediaList);
            var controller = new BrowseController(mockRepo);

            // Act:
            var result = controller.Search("Hobbit");

            // Assert:
            var viewResult = (ViewResult)result;
            Assert.AreEqual("Error", viewResult.ViewName);
        }
        public void SearchWithResultTest()
        {
            // Arrange:
            var mediaList = PopulateMedia();

            var mockRepo = new MockSubtitleRepository(mediaList);
            var controller = new BrowseController(mockRepo);

            // Act:
            var result = controller.Search("Catch");

            // Assert:
            var viewResult = (ViewResult)result;

            List<Media> media = (viewResult.Model as IEnumerable<Media>).ToList();
            Assert.IsTrue(media.Count() == 1);
            Assert.IsTrue(media[0].Name == "Catch me if you can");
        }
        public void SearchWithTwoResults()
        {
            // Arrange:
            var mediaList = PopulateMedia();

            var mockRepo = new MockSubtitleRepository(mediaList);
            var controller = new BrowseController(mockRepo);

            // Act:
            var result = controller.Search("The"); // virkar ekki, þótt þetta virki á síðunni sjálfri :/
            // var result = controller.Search("Catch me if you can"); // Þetta virkar hinsvegar

            // Assert:
            var viewResult = (ViewResult)result;

            List<Media> media = (viewResult.Model as IEnumerable<Media>).ToList();
            media.Sort((x, y) => string.Compare(x.Name, y.Name));
            Assert.IsTrue(media.Count() == 2);
            Assert.IsTrue(media[0].Name == "The Matrix");
            Assert.IsTrue(media[1].Name == "The Notebook");
        }