public void NumberOfSearchResultsLimited()
        {
            var context = new MoviesDBContext();
              Enumerable.Range(1, 10).ToList().ForEach(x => context.CreateMovie(new Movie { Title = "Movie " + x }));

              var result = context.Search("Movie",3);

              Assert.AreEqual(3, result.Count);
        }
        public void SearchReturnsPartialMatches()
        {
            var movie = new Movie { Title = "The Other Movie" };
              var context = new MoviesDBContext();
              context.CreateMovie(movie);

              var results = context.Search("Other");

              Assert.AreEqual(1, results.Count);
              Assert.AreEqual(movie.Title, results[0].Title);
        }
        public void SearchIsCaseInsensitive()
        {
            var movie = new Movie { Title = "The Movie" };
              var context = new MoviesDBContext();
              context.CreateMovie(movie);

              var results = context.Search("tHe mOVIE");

              Assert.AreEqual(1, results.Count);
              Assert.AreEqual(movie.Title, results[0].Title);
        }
        public void CreatingAMovieStoresIt()
        {
            var mockDbSet = new Mock<IDbSet<Movie>>();
              var context = new MoviesDBContext(mockDbSet.Object);
              var movie = new Movie{Title = "The Movie"};

              context.CreateMovie(movie);

              mockDbSet.Verify(set => set.Add(movie), Times.Once());
        }