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); }
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); }
public void DeleteMovieLessThanZero() { service.DeleteMovie(0); mock.VerifyAll(); }