public void ShouldAddMovie()
 {
     var movie = new Movie {Title = Some.Title};
     _repo.Add(movie);
     var gottenMovie = _repo.Get<Movie>(movie.Id);
     Assert.That(gottenMovie.IsNew(), Is.False);
     Assert.That(gottenMovie.Title, Is.EqualTo(Some.Title));
 }
 private MovieViewModel ModelFor(Movie movie)
 {
     var categories = _categoryLogic.GetCategories();
     return new MovieViewModel(movie)
     {
         AvailableCategories = from c in categories select c.Name
     };
 }
 public void ShouldDeleteMovie()
 {
     var movie = new Movie { Title = Some.Title };
     _repo.Add(movie);
     var id = movie.Id;
     _repo.Delete(movie);
     var gottenMovie = _repo.Get<Movie>(id);
     Assert.That(gottenMovie, Is.Null);
 }
Beispiel #4
0
 public long Save(Movie movie)
 {
     using (var work = _unitOfWork.Begin())
     {
         if (movie.IsNew())
         {
             CreateNew(movie);
         }
         else
         {
             Update(movie);
         }
         work.Complete();
         return movie.Id;
     }
 }
 public MovieViewModel(Movie movie)
 {
     Movie = movie;
 }
Beispiel #6
0
 private void Update(Movie movie)
 {
     var existing = _repo.Get<Movie>(movie.Id);
     existing.Title = movie.Title;
 }
Beispiel #7
0
 private void CreateNew(Movie movie)
 {
     _repo.Add(movie);
 }