コード例 #1
0
        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);
        }
コード例 #2
0
 public IActionResult DeleteMovie(int id)
 {
     if (_movies.DeleteMovie(id) == Result.NotFound)
     {
         return(NotFound());
     }
     else
     {
         return(Ok());
     }
 }
コード例 #3
0
        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);
        }
コード例 #4
0
 public void DeleteMovieLessThanZero()
 {
     service.DeleteMovie(0);
     mock.VerifyAll();
 }