コード例 #1
0
        public void ReturnCorrectList_WhenRetryIsSelected(string inputParameters,
                                                          string selectorResult, string readFromSelector)
        {
            // Arrange
            var parameters  = inputParameters.Split('|').ToList();
            var name        = parameters[0];
            var description = parameters[2];
            var year        = int.Parse(parameters[3]);
            var duration    = int.Parse(parameters[4]);

            var movieMock         = new Mock <Movie>();
            var selectorMock      = new Mock <IItemSelector>();
            var movieServicesMock = new Mock <IMovieServices>();

            selectorMock
            .Setup(s => s.DisplayItems(It.IsAny <List <string> >()))
            .Returns(selectorResult);

            selectorMock
            .Setup(s => s.ReadAtPosition(It.IsAny <int>(), It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <int>()))
            .Returns(readFromSelector);

            movieServicesMock
            .Setup(ms => ms.UpdateMovie(name, description, year, duration));

            // Act
            var sut    = new UpdateMovie(selectorMock.Object, movieServicesMock.Object);
            var result = sut.Execute(parameters);

            // Assert
            CollectionAssert.AreEqual(parameters, result.ToList());
        }
コード例 #2
0
        public void EnsureUpdateMethod_IsCalled(string inputParameters,
                                                string selectorResult, string readFromSelector, string expected)
        {
            // Arrange
            var parameters  = inputParameters.Split('|').ToList();
            var name        = parameters[0];
            var description = parameters[2];
            var year        = int.Parse(parameters[3]);
            var duration    = int.Parse(parameters[4]);

            var movieMock         = new Mock <Movie>();
            var selectorMock      = new Mock <IItemSelector>();
            var movieServicesMock = new Mock <IMovieServices>();

            selectorMock
            .Setup(s => s.DisplayItems(It.IsAny <List <string> >()))
            .Returns(selectorResult);
            selectorMock
            .Setup(s => s.ReadAtPosition(It.IsAny <int>(), It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <int>()))
            .Returns(readFromSelector);

            // Act
            var sut    = new UpdateMovie(selectorMock.Object, movieServicesMock.Object);
            var result = sut.Execute(parameters);

            // Assert
            movieServicesMock.Verify(ms => ms.UpdateMovie(It.IsAny <string>(), It.IsAny <string>(),
                                                          It.IsAny <int>(), It.IsAny <int>()), Times.Once);
        }
コード例 #3
0
        private void UpdateMovieExecute()
        {
            UpdateMovie update = new UpdateMovie(Movie);

            update.ShowDialog();
            Movies = _dALMovie.AllMovies();
        }
コード例 #4
0
ファイル: MainWindow.xaml.cs プロジェクト: mort79f8/WpfDapper
        private void UpdateMovieButton_Click(object sender, RoutedEventArgs e)
        {
            Movie = (Movie)MovieList.SelectedItem;
            UpdateMovie updateMovie = new UpdateMovie(Movie);

            updateMovie.Owner = this;
            updateMovie.Show();
        }
コード例 #5
0
        public ActionResult <MovieRead> Put([FromBody] UpdateMovie update)
        {
            var newMovie = _mapper.Map <Movie>(update);

            _repository.Replace(newMovie);
            _repository.SaveChanges();
            return(NoContent());
        }
コード例 #6
0
 public UpdateMovieViewModel(UpdateMovie genreWin, Movie selectedMovie)
 {
     window       = genreWin;
     _movie       = selectedMovie;
     _movieActors = selectedMovie.Actors.ToList();
     _movieGenres = selectedMovie.Genres.ToList();
     _showsMovie  = selectedMovie.ShowsMovies.ToList();
 }
コード例 #7
0
        public async Task UpdateMovie(UpdateMovie command)
        {
            var director = _directorRepository.GetAsync(command.DirectorId);
            var movie    = await _movieRepository.GetMovie(command.Id);

            movie.Title           = command.Title;
            movie.DurationMinutes = command.DurationMinutes;


            movie.SetDirector(await director);
            await _movieRepository.UpdateMovie(movie);
        }
コード例 #8
0
        public ActionResult Patch(int id, [FromBody] JsonPatchDocument <UpdateMovie> patchDocument)
        {
            Movie       oldMovie = _repository.getById(id);
            UpdateMovie movie    = _mapper.Map <UpdateMovie>(oldMovie);

            patchDocument.ApplyTo(movie);
            Movie newValues = _mapper.Map <Movie>(movie);

            _repository.Replace(newValues);
            _repository.SaveChanges();

            return(NoContent());
        }
コード例 #9
0
        public bool UpdateMovie(UpdateMovie request)
        {
            if (request != null)
            {
                var movie = _db.Movies.Where(a => a.MovieId == request.Id).FirstOrDefault();
                if (movie != null)
                {
                    movie.MovieName = string.IsNullOrEmpty(request.Name) ? movie.MovieName : request.Name;
                    //grade.Section = string.IsNullOrEmpty(request.Section) ? grade.Section : request.Section;

                    /*if (request.Name != null)
                     * {
                     *  movie.MovieName = request.Name;
                     * }*/

                    _db.SaveChanges();

                    return(true);
                }
                return(false);
            }
            return(false);
        }
コード例 #10
0
        public async Task <IActionResult> Update([FromBody] UpdateMovie command)
        {
            await DispatchAsync(command);

            return(NoContent());
        }
コード例 #11
0
 public IMovieModel Any(UpdateMovie request)
 {
     return(workflow.Update(request));
 }
コード例 #12
0
 public IActionResult UpdateGrade(UpdateMovie data)
 {
     return(Ok(repository.UpdateMovie(data)));
 }
コード例 #13
0
ファイル: MovieController.cs プロジェクト: smolsoon/CinemaApp
        //[Authorize]
        public async Task <IActionResult> Put(Guid movieId, [FromBody] UpdateMovie command)
        {
            await _movieService.UpdateAsync(movieId, command.Title, command.Description);

            return(NoContent());
        }