public async Task DeleteEntityTest()
        {
            var fakeRepositoryMock = new Mock <IMoviesContext>();

            fakeRepositoryMock.Setup(x => x.GetMoviesList()).ReturnsAsync(vars);


            var movieService = new MoviesService(fakeRepositoryMock.Object);

            await movieService.DeleteMovie(2);
        }
Ejemplo n.º 2
0
 public IActionResult DeleteMovie(int id)
 {
     if (_movies.DeleteMovie(id) == Result.NotFound)
     {
         return(NotFound());
     }
     else
     {
         return(Ok());
     }
 }
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            try
            {
                moviesService.DeleteMovie(Int32.Parse(textBoxID.Text));
                MessageBox.Show("Movie deleted from database");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Cannot deleted this movie because it is in used by other entities");
            }

            ClearInput();
            moviesService.GetMovies(dataGridViewMovies);
        }
Ejemplo n.º 4
0
 public void DeleteMovieLessThanZero()
 {
     service.DeleteMovie(0);
     mock.VerifyAll();
 }