Beispiel #1
0
        public void Verify_Get_ByKey_Should_ReturnTheCorrectMovieStudio()
        {
            // Arrange
            Mock <IDbSet <MovieStudio> > mockSetMovieStudios;
            var mockContext = MovieStudiosMockingSetup.DoMockingSetupForContext(true, out mockSetMovieStudios);
            var repository  = new MovieStudiosRepository(mockContext.Object);
            // Act
            var movieStudios = repository.Get("KING-STEPHEN");

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

            // Act
            repository.Deactivate(movieStudios);
            // Assert
            Assert.Equal(false, movieStudios.Active);
        }
Beispiel #4
0
        public void Verify_Remove_Should_RemoveTheEntityFromTheContext()
        {
            // Arrange
            Mock <IDbSet <MovieStudio> > mockSetMovieStudios;
            var mockContext  = MovieStudiosMockingSetup.DoMockingSetupForContext(true, out mockSetMovieStudios);
            var repository   = new MovieStudiosRepository(mockContext.Object);
            var movieStudios = repository.Get(1);

            // Act
            repository.Remove(movieStudios);
            // Assert
            mockSetMovieStudios.Verify(x => x.Remove((MovieStudio)movieStudios), Times.Once);
        }
Beispiel #5
0
        public void Verify_Update_Should_SetTheEntityStateToModified()
        {
            // Arrange
            Mock <IDbSet <MovieStudio> > mockSetMovieStudios;
            var mockContext  = MovieStudiosMockingSetup.DoMockingSetupForContext(true, out mockSetMovieStudios);
            var repository   = new MovieStudiosRepository(mockContext.Object);
            var movieStudios = repository.Get(1);

            movieStudios.ApiDetailUrl = "/TEST";
            // Act
            repository.Update(movieStudios);
            // Assert
            mockContext.Verify(x => x.SetModified(It.IsAny <object>()), Times.Once);
        }
 public void Verify_Get_ByID_Should_ReturnTheCorrectMovieStudio()
 {
     // Arrange
     Mock<IDbSet<MovieStudio>> mockSetMovieStudios;
     var mockContext = MovieStudiosMockingSetup.DoMockingSetupForContext(true, out mockSetMovieStudios);
     var repository = new MovieStudiosRepository(mockContext.Object);
     // Act
     var movieStudios = repository.Get(1);
     // Assert
                 Assert.Equal("/TEST/KING-STEPHEN", movieStudios.ApiDetailUrl);
 }
 public void Verify_Update_Should_SetTheEntityStateToModified()
 {
     // Arrange
     Mock<IDbSet<MovieStudio>> mockSetMovieStudios;
     var mockContext = MovieStudiosMockingSetup.DoMockingSetupForContext(true, out mockSetMovieStudios);
     var repository = new MovieStudiosRepository(mockContext.Object);
     var movieStudios = repository.Get(1);
     movieStudios.ApiDetailUrl = "/TEST";
     // Act
     repository.Update(movieStudios);
     // Assert
     mockContext.Verify(x => x.SetModified(It.IsAny<object>()), Times.Once);
 }
 public void Verify_Remove_Should_RemoveTheEntityFromTheContext()
 {
     // Arrange
     Mock<IDbSet<MovieStudio>> mockSetMovieStudios;
     var mockContext = MovieStudiosMockingSetup.DoMockingSetupForContext(true, out mockSetMovieStudios);
     var repository = new MovieStudiosRepository(mockContext.Object);
     var movieStudios = repository.Get(1);
     // Act
     repository.Remove(movieStudios);
     // Assert
     mockSetMovieStudios.Verify(x => x.Remove((MovieStudio)movieStudios), Times.Once);
 }