Beispiel #1
0
        public void Verify_Get_ByKey_Should_ReturnTheCorrectMovieCharacter()
        {
            // Arrange
            Mock <IDbSet <MovieCharacter> > mockSetMovieCharacters;
            var mockContext = MovieCharactersMockingSetup.DoMockingSetupForContext(true, out mockSetMovieCharacters);
            var repository  = new MovieCharactersRepository(mockContext.Object);
            // Act
            var movieCharacters = repository.Get("KING-STEPHEN");

            // Assert
            Assert.Equal("/TEST/KING-STEPHEN", movieCharacters.ApiDetailUrl);
        }
 public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity()
 {
     // Arrange
     Mock<IDbSet<MovieCharacter>> mockSetMovieCharacters;
     var mockContext = MovieCharactersMockingSetup.DoMockingSetupForContext(true, out mockSetMovieCharacters);
     var repository = new MovieCharactersRepository(mockContext.Object);
     var movieCharacters = repository.Get(1);
     // Act
     repository.Deactivate(movieCharacters);
     // Assert
     Assert.Equal(false, movieCharacters.Active);
 }
Beispiel #3
0
        public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity()
        {
            // Arrange
            Mock <IDbSet <MovieCharacter> > mockSetMovieCharacters;
            var mockContext     = MovieCharactersMockingSetup.DoMockingSetupForContext(true, out mockSetMovieCharacters);
            var repository      = new MovieCharactersRepository(mockContext.Object);
            var movieCharacters = repository.Get(1);

            // Act
            repository.Deactivate(movieCharacters);
            // Assert
            Assert.Equal(false, movieCharacters.Active);
        }
Beispiel #4
0
        public void Verify_Remove_Should_RemoveTheEntityFromTheContext()
        {
            // Arrange
            Mock <IDbSet <MovieCharacter> > mockSetMovieCharacters;
            var mockContext     = MovieCharactersMockingSetup.DoMockingSetupForContext(true, out mockSetMovieCharacters);
            var repository      = new MovieCharactersRepository(mockContext.Object);
            var movieCharacters = repository.Get(1);

            // Act
            repository.Remove(movieCharacters);
            // Assert
            mockSetMovieCharacters.Verify(x => x.Remove((MovieCharacter)movieCharacters), Times.Once);
        }
Beispiel #5
0
        public void Verify_Update_Should_SetTheEntityStateToModified()
        {
            // Arrange
            Mock <IDbSet <MovieCharacter> > mockSetMovieCharacters;
            var mockContext     = MovieCharactersMockingSetup.DoMockingSetupForContext(true, out mockSetMovieCharacters);
            var repository      = new MovieCharactersRepository(mockContext.Object);
            var movieCharacters = repository.Get(1);

            movieCharacters.ApiDetailUrl = "/TEST";
            // Act
            repository.Update(movieCharacters);
            // Assert
            mockContext.Verify(x => x.SetModified(It.IsAny <object>()), Times.Once);
        }
 public void Verify_Get_ByID_Should_ReturnTheCorrectMovieCharacter()
 {
     // Arrange
     Mock<IDbSet<MovieCharacter>> mockSetMovieCharacters;
     var mockContext = MovieCharactersMockingSetup.DoMockingSetupForContext(true, out mockSetMovieCharacters);
     var repository = new MovieCharactersRepository(mockContext.Object);
     // Act
     var movieCharacters = repository.Get(1);
     // Assert
                 Assert.Equal("/TEST/KING-STEPHEN", movieCharacters.ApiDetailUrl);
 }
 public void Verify_Update_Should_SetTheEntityStateToModified()
 {
     // Arrange
     Mock<IDbSet<MovieCharacter>> mockSetMovieCharacters;
     var mockContext = MovieCharactersMockingSetup.DoMockingSetupForContext(true, out mockSetMovieCharacters);
     var repository = new MovieCharactersRepository(mockContext.Object);
     var movieCharacters = repository.Get(1);
     movieCharacters.ApiDetailUrl = "/TEST";
     // Act
     repository.Update(movieCharacters);
     // Assert
     mockContext.Verify(x => x.SetModified(It.IsAny<object>()), Times.Once);
 }
 public void Verify_Remove_Should_RemoveTheEntityFromTheContext()
 {
     // Arrange
     Mock<IDbSet<MovieCharacter>> mockSetMovieCharacters;
     var mockContext = MovieCharactersMockingSetup.DoMockingSetupForContext(true, out mockSetMovieCharacters);
     var repository = new MovieCharactersRepository(mockContext.Object);
     var movieCharacters = repository.Get(1);
     // Act
     repository.Remove(movieCharacters);
     // Assert
     mockSetMovieCharacters.Verify(x => x.Remove((MovieCharacter)movieCharacters), Times.Once);
 }