Esempio n. 1
0
        public void Verify_Get_ByKey_Should_ReturnTheCorrectConceptMovie()
        {
            // Arrange
            Mock <IDbSet <ConceptMovie> > mockSetConceptMovies;
            var mockContext = ConceptMoviesMockingSetup.DoMockingSetupForContext(true, out mockSetConceptMovies);
            var repository  = new ConceptMoviesRepository(mockContext.Object);
            // Act
            var conceptMovies = repository.Get("KING-STEPHEN");

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

            // Act
            repository.Deactivate(conceptMovies);
            // Assert
            Assert.Equal(false, conceptMovies.Active);
        }
Esempio n. 4
0
        public void Verify_Remove_Should_RemoveTheEntityFromTheContext()
        {
            // Arrange
            Mock <IDbSet <ConceptMovie> > mockSetConceptMovies;
            var mockContext   = ConceptMoviesMockingSetup.DoMockingSetupForContext(true, out mockSetConceptMovies);
            var repository    = new ConceptMoviesRepository(mockContext.Object);
            var conceptMovies = repository.Get(1);

            // Act
            repository.Remove(conceptMovies);
            // Assert
            mockSetConceptMovies.Verify(x => x.Remove((ConceptMovie)conceptMovies), Times.Once);
        }
Esempio n. 5
0
        public void Verify_Update_Should_SetTheEntityStateToModified()
        {
            // Arrange
            Mock <IDbSet <ConceptMovie> > mockSetConceptMovies;
            var mockContext   = ConceptMoviesMockingSetup.DoMockingSetupForContext(true, out mockSetConceptMovies);
            var repository    = new ConceptMoviesRepository(mockContext.Object);
            var conceptMovies = repository.Get(1);

            conceptMovies.ApiDetailUrl = "/TEST";
            // Act
            repository.Update(conceptMovies);
            // Assert
            mockContext.Verify(x => x.SetModified(It.IsAny <object>()), Times.Once);
        }
 public void Verify_Get_ByID_Should_ReturnTheCorrectConceptMovie()
 {
     // Arrange
     Mock<IDbSet<ConceptMovie>> mockSetConceptMovies;
     var mockContext = ConceptMoviesMockingSetup.DoMockingSetupForContext(true, out mockSetConceptMovies);
     var repository = new ConceptMoviesRepository(mockContext.Object);
     // Act
     var conceptMovies = repository.Get(1);
     // Assert
                 Assert.Equal("/TEST/KING-STEPHEN", conceptMovies.ApiDetailUrl);
 }
 public void Verify_Update_Should_SetTheEntityStateToModified()
 {
     // Arrange
     Mock<IDbSet<ConceptMovie>> mockSetConceptMovies;
     var mockContext = ConceptMoviesMockingSetup.DoMockingSetupForContext(true, out mockSetConceptMovies);
     var repository = new ConceptMoviesRepository(mockContext.Object);
     var conceptMovies = repository.Get(1);
     conceptMovies.ApiDetailUrl = "/TEST";
     // Act
     repository.Update(conceptMovies);
     // Assert
     mockContext.Verify(x => x.SetModified(It.IsAny<object>()), Times.Once);
 }
 public void Verify_Remove_Should_RemoveTheEntityFromTheContext()
 {
     // Arrange
     Mock<IDbSet<ConceptMovie>> mockSetConceptMovies;
     var mockContext = ConceptMoviesMockingSetup.DoMockingSetupForContext(true, out mockSetConceptMovies);
     var repository = new ConceptMoviesRepository(mockContext.Object);
     var conceptMovies = repository.Get(1);
     // Act
     repository.Remove(conceptMovies);
     // Assert
     mockSetConceptMovies.Verify(x => x.Remove((ConceptMovie)conceptMovies), Times.Once);
 }