Ejemplo n.º 1
0
        public void The_MovieTitled_event_should_update_a_movie()
        {
            const string title       = "Some movie";
            var          movieId     = Guid.NewGuid();
            var          movieTitled = new MovieTitled(movieId, title);

            var repo = new DummyMovieProjectionRepository();

            repo.List[movieId] = new MovieProjection {
                Id = movieId
            };

            var handler = new MovieProjectionHandlers(repo);

            handler.Handle(movieTitled);

            repo.List.Count.Should().Be(1);
            repo.List.Values.ShouldBeEquivalentTo(new[]
            {
                new MovieProjection
                {
                    Id    = movieId,
                    Title = title
                }
            });
        }
Ejemplo n.º 2
0
        public void Handle(MovieTitled movieTitled)
        {
            var movie = _repository.GetById(movieTitled.MovieId)
                        ?? new MovieProjection
            {
                Id = movieTitled.MovieId
            };

            movie.Title = movieTitled.Title;
            _repository.Store(movie);
        }