public void Verify_Get_ByKey_Should_ReturnTheCorrectMovieObject() { // Arrange Mock <IDbSet <MovieObject> > mockSetMovieObjects; var mockContext = MovieObjectsMockingSetup.DoMockingSetupForContext(true, out mockSetMovieObjects); var repository = new MovieObjectsRepository(mockContext.Object); // Act var movieObjects = repository.Get("KING-STEPHEN"); // Assert Assert.Equal("/TEST/KING-STEPHEN", movieObjects.ApiDetailUrl); }
public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity() { // Arrange Mock<IDbSet<MovieObject>> mockSetMovieObjects; var mockContext = MovieObjectsMockingSetup.DoMockingSetupForContext(true, out mockSetMovieObjects); var repository = new MovieObjectsRepository(mockContext.Object); var movieObjects = repository.Get(1); // Act repository.Deactivate(movieObjects); // Assert Assert.Equal(false, movieObjects.Active); }
public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity() { // Arrange Mock <IDbSet <MovieObject> > mockSetMovieObjects; var mockContext = MovieObjectsMockingSetup.DoMockingSetupForContext(true, out mockSetMovieObjects); var repository = new MovieObjectsRepository(mockContext.Object); var movieObjects = repository.Get(1); // Act repository.Deactivate(movieObjects); // Assert Assert.Equal(false, movieObjects.Active); }
public void Verify_Remove_Should_RemoveTheEntityFromTheContext() { // Arrange Mock <IDbSet <MovieObject> > mockSetMovieObjects; var mockContext = MovieObjectsMockingSetup.DoMockingSetupForContext(true, out mockSetMovieObjects); var repository = new MovieObjectsRepository(mockContext.Object); var movieObjects = repository.Get(1); // Act repository.Remove(movieObjects); // Assert mockSetMovieObjects.Verify(x => x.Remove((MovieObject)movieObjects), Times.Once); }
public void Verify_Update_Should_SetTheEntityStateToModified() { // Arrange Mock <IDbSet <MovieObject> > mockSetMovieObjects; var mockContext = MovieObjectsMockingSetup.DoMockingSetupForContext(true, out mockSetMovieObjects); var repository = new MovieObjectsRepository(mockContext.Object); var movieObjects = repository.Get(1); movieObjects.ApiDetailUrl = "/TEST"; // Act repository.Update(movieObjects); // Assert mockContext.Verify(x => x.SetModified(It.IsAny <object>()), Times.Once); }
public void Verify_Get_ByID_Should_ReturnTheCorrectMovieObject() { // Arrange Mock<IDbSet<MovieObject>> mockSetMovieObjects; var mockContext = MovieObjectsMockingSetup.DoMockingSetupForContext(true, out mockSetMovieObjects); var repository = new MovieObjectsRepository(mockContext.Object); // Act var movieObjects = repository.Get(1); // Assert Assert.Equal("/TEST/KING-STEPHEN", movieObjects.ApiDetailUrl); }
public void Verify_Update_Should_SetTheEntityStateToModified() { // Arrange Mock<IDbSet<MovieObject>> mockSetMovieObjects; var mockContext = MovieObjectsMockingSetup.DoMockingSetupForContext(true, out mockSetMovieObjects); var repository = new MovieObjectsRepository(mockContext.Object); var movieObjects = repository.Get(1); movieObjects.ApiDetailUrl = "/TEST"; // Act repository.Update(movieObjects); // Assert mockContext.Verify(x => x.SetModified(It.IsAny<object>()), Times.Once); }
public void Verify_Remove_Should_RemoveTheEntityFromTheContext() { // Arrange Mock<IDbSet<MovieObject>> mockSetMovieObjects; var mockContext = MovieObjectsMockingSetup.DoMockingSetupForContext(true, out mockSetMovieObjects); var repository = new MovieObjectsRepository(mockContext.Object); var movieObjects = repository.Get(1); // Act repository.Remove(movieObjects); // Assert mockSetMovieObjects.Verify(x => x.Remove((MovieObject)movieObjects), Times.Once); }