public void Verify_Add_Should_AddTheEntityToTheContext() { // Arrange Mock<IDbSet<MovieCharacter>> mockSetMovieCharacters; var mockContext = MovieCharactersMockingSetup.DoMockingSetupForContext(false, out mockSetMovieCharacters); var repository = new MovieCharactersRepository(mockContext.Object); var movieCharacters = new MovieCharacter { Active = true, CustomKey = "SALVATORE-RAA", }; // Act repository.Add(movieCharacters); // Assert mockSetMovieCharacters.Verify(x => x.Add(movieCharacters), Times.Once); }
public void Verify_Add_Should_AddTheEntityToTheContext() { // Arrange Mock <IDbSet <MovieCharacter> > mockSetMovieCharacters; var mockContext = MovieCharactersMockingSetup.DoMockingSetupForContext(false, out mockSetMovieCharacters); var repository = new MovieCharactersRepository(mockContext.Object); var movieCharacters = new MovieCharacter { Active = true, CustomKey = "SALVATORE-RAA", }; // Act repository.Add(movieCharacters); // Assert mockSetMovieCharacters.Verify(x => x.Add(movieCharacters), Times.Once); }
public void Verify_MapToEntity_WithExistingEntity_AssignsMovieCharacterProperties() { // Arrange var mapper = new MovieCharacterMapper(); var model = MovieCharactersMockingSetup.DoMockingSetupForMovieCharacterModel(); // Act IMovieCharacter existingEntity = new MovieCharacter { Id = 1 }; mapper.MapToEntity(model.Object, ref existingEntity); // Assert // <None> // Related Objects Assert.Equal(model.Object.MovieId, existingEntity.MovieId); Assert.Equal(model.Object.CharacterId, existingEntity.CharacterId); // Associated Objects // <None> }
// GET: Movie public ActionResult Index() { var model = MovieCharacter.GetList(); return(View(model)); }