Esempio n. 1
0
        public void Verify_Get_ByKey_Should_ReturnTheCorrectCharacterMovie()
        {
            // Arrange
            Mock <IDbSet <CharacterMovie> > mockSetCharacterMovies;
            var mockContext = CharacterMoviesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterMovies);
            var repository  = new CharacterMoviesRepository(mockContext.Object);
            // Act
            var characterMovies = repository.Get("KING-STEPHEN");

            // Assert
            Assert.Equal("/TEST/KING-STEPHEN", characterMovies.ApiDetailUrl);
        }
 public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity()
 {
     // Arrange
     Mock<IDbSet<CharacterMovie>> mockSetCharacterMovies;
     var mockContext = CharacterMoviesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterMovies);
     var repository = new CharacterMoviesRepository(mockContext.Object);
     var characterMovies = repository.Get(1);
     // Act
     repository.Deactivate(characterMovies);
     // Assert
     Assert.Equal(false, characterMovies.Active);
 }
Esempio n. 3
0
        public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity()
        {
            // Arrange
            Mock <IDbSet <CharacterMovie> > mockSetCharacterMovies;
            var mockContext     = CharacterMoviesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterMovies);
            var repository      = new CharacterMoviesRepository(mockContext.Object);
            var characterMovies = repository.Get(1);

            // Act
            repository.Deactivate(characterMovies);
            // Assert
            Assert.Equal(false, characterMovies.Active);
        }
Esempio n. 4
0
        public void Verify_Remove_Should_RemoveTheEntityFromTheContext()
        {
            // Arrange
            Mock <IDbSet <CharacterMovie> > mockSetCharacterMovies;
            var mockContext     = CharacterMoviesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterMovies);
            var repository      = new CharacterMoviesRepository(mockContext.Object);
            var characterMovies = repository.Get(1);

            // Act
            repository.Remove(characterMovies);
            // Assert
            mockSetCharacterMovies.Verify(x => x.Remove((CharacterMovie)characterMovies), Times.Once);
        }
Esempio n. 5
0
        public void Verify_Update_Should_SetTheEntityStateToModified()
        {
            // Arrange
            Mock <IDbSet <CharacterMovie> > mockSetCharacterMovies;
            var mockContext     = CharacterMoviesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterMovies);
            var repository      = new CharacterMoviesRepository(mockContext.Object);
            var characterMovies = repository.Get(1);

            characterMovies.ApiDetailUrl = "/TEST";
            // Act
            repository.Update(characterMovies);
            // Assert
            mockContext.Verify(x => x.SetModified(It.IsAny <object>()), Times.Once);
        }
 public void Verify_Get_ByID_Should_ReturnTheCorrectCharacterMovie()
 {
     // Arrange
     Mock<IDbSet<CharacterMovie>> mockSetCharacterMovies;
     var mockContext = CharacterMoviesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterMovies);
     var repository = new CharacterMoviesRepository(mockContext.Object);
     // Act
     var characterMovies = repository.Get(1);
     // Assert
                 Assert.Equal("/TEST/KING-STEPHEN", characterMovies.ApiDetailUrl);
 }
 public void Verify_Update_Should_SetTheEntityStateToModified()
 {
     // Arrange
     Mock<IDbSet<CharacterMovie>> mockSetCharacterMovies;
     var mockContext = CharacterMoviesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterMovies);
     var repository = new CharacterMoviesRepository(mockContext.Object);
     var characterMovies = repository.Get(1);
     characterMovies.ApiDetailUrl = "/TEST";
     // Act
     repository.Update(characterMovies);
     // Assert
     mockContext.Verify(x => x.SetModified(It.IsAny<object>()), Times.Once);
 }
 public void Verify_Remove_Should_RemoveTheEntityFromTheContext()
 {
     // Arrange
     Mock<IDbSet<CharacterMovie>> mockSetCharacterMovies;
     var mockContext = CharacterMoviesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterMovies);
     var repository = new CharacterMoviesRepository(mockContext.Object);
     var characterMovies = repository.Get(1);
     // Act
     repository.Remove(characterMovies);
     // Assert
     mockSetCharacterMovies.Verify(x => x.Remove((CharacterMovie)characterMovies), Times.Once);
 }