Exemple #1
0
        public async Task DeleteMovieShouldThrowWithIncorrectId()
        {
            var repository = new EfDeletableEntityRepository <Movie>(new ApplicationDbContext(this.options.Options));
            var service    = new MoviesService(repository);

            await service.AddAsync(this.movie);

            Assert.Throws <ArgumentNullException>(() => service.DeleteAsync(2).GetAwaiter().GetResult());
        }
Exemple #2
0
        public async Task DeleteMovieShouldWorkCorrectly()
        {
            var repository = new EfDeletableEntityRepository <Movie>(new ApplicationDbContext(this.options.Options));
            var service    = new MoviesService(repository);

            await service.AddAsync(this.movie);

            await service.DeleteAsync(1);

            var movie = await repository.GetByIdWithDeletedAsync(1);

            Assert.True(movie.IsDeleted);
        }