Exemplo n.º 1
0
        public async Task ShouldCreateAnewMovieAndDeleteIt(Guid movieId)
        {
            var repo = new MoviesMemoryRepository(TimeSpan.FromSeconds(10));
            await repo.Add(new Movie()
            {
                id = movieId
            });

            await repo.RemoveAll(new List <Guid>() { movieId });

            Assert.False(await repo.Any(s => s.id == movieId));
        }
Exemplo n.º 2
0
        public async Task ShouldCreateNewMovie(Guid movieId)
        {
            var repo = new MoviesMemoryRepository(TimeSpan.FromSeconds(10));
            await repo.Add(new Movie()
            {
                id = movieId
            });

            Assert.True(await repo.Any(s => s.id == movieId));

            //clean up
            await repo.RemoveAll(new List <Guid>() { movieId });
        }
Exemplo n.º 3
0
        public async Task ShouldCreateANewMovieAndUpdateIt(Guid movieId)
        {
            var original    = "Unchanged";
            var afterUpdate = "Changed";
            var repo        = new MoviesMemoryRepository(TimeSpan.FromSeconds(10));
            await repo.Add(new Movie()
            {
                body = original, id = movieId
            });

            await repo.Update(new Movie()
            {
                body = afterUpdate, id = movieId
            });



            Assert.False(await repo.Any(s => s.id == movieId && s.body == original));
            Assert.True(await repo.Any(s => s.id == movieId && s.body == afterUpdate));

            //clean up
            await repo.RemoveAll(new List <Guid>() { movieId });
        }