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);
 }
Ejemplo n.º 2
0
        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>
        }
 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>
 }
Ejemplo n.º 5
0
        // GET: Movie
        public ActionResult Index()
        {
            var model = MovieCharacter.GetList();

            return(View(model));
        }