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()); }
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); }
private void UpdateMovieExecute() { UpdateMovie update = new UpdateMovie(Movie); update.ShowDialog(); Movies = _dALMovie.AllMovies(); }
private void UpdateMovieButton_Click(object sender, RoutedEventArgs e) { Movie = (Movie)MovieList.SelectedItem; UpdateMovie updateMovie = new UpdateMovie(Movie); updateMovie.Owner = this; updateMovie.Show(); }
public ActionResult <MovieRead> Put([FromBody] UpdateMovie update) { var newMovie = _mapper.Map <Movie>(update); _repository.Replace(newMovie); _repository.SaveChanges(); return(NoContent()); }
public UpdateMovieViewModel(UpdateMovie genreWin, Movie selectedMovie) { window = genreWin; _movie = selectedMovie; _movieActors = selectedMovie.Actors.ToList(); _movieGenres = selectedMovie.Genres.ToList(); _showsMovie = selectedMovie.ShowsMovies.ToList(); }
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); }
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()); }
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); }
public async Task <IActionResult> Update([FromBody] UpdateMovie command) { await DispatchAsync(command); return(NoContent()); }
public IMovieModel Any(UpdateMovie request) { return(workflow.Update(request)); }
public IActionResult UpdateGrade(UpdateMovie data) { return(Ok(repository.UpdateMovie(data))); }
//[Authorize] public async Task <IActionResult> Put(Guid movieId, [FromBody] UpdateMovie command) { await _movieService.UpdateAsync(movieId, command.Title, command.Description); return(NoContent()); }