Exemplo n.º 1
0
        public void Exists_Should_ReturnTrueWhenExistAndFalseWhenDoesNot()
        {
            var db = new TFContext(DatabaseSimulator());
            var genreServiceMock = new Mock <IGenreServices>();
            var movieService     = new MovieServices(db, genreServiceMock.Object);

            var movie = new Movie()
            {
                Id    = 1,
                Title = "The Movie"
            };
            bool doesNotExist = movieService.Exists(1);

            db.Movies.Add(movie);
            db.SaveChanges();
            bool exist = movieService.Exists(1);

            Assert.IsFalse(doesNotExist);
            Assert.IsTrue(exist);
        }