public void Verify_Get_ByKey_Should_ReturnTheCorrectVideo() { // Arrange Mock <IDbSet <Video> > mockSetVideos; var mockContext = VideosMockingSetup.DoMockingSetupForContext(true, out mockSetVideos); var repository = new VideosRepository(mockContext.Object); // Act var videos = repository.Get("KING-STEPHEN"); // Assert Assert.Equal("/TEST/KING-STEPHEN", videos.ApiDetailUrl); }
public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity() { // Arrange Mock<IDbSet<Video>> mockSetVideos; var mockContext = VideosMockingSetup.DoMockingSetupForContext(true, out mockSetVideos); var repository = new VideosRepository(mockContext.Object); var videos = repository.Get(1); // Act repository.Deactivate(videos); // Assert Assert.Equal(false, videos.Active); }
public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity() { // Arrange Mock <IDbSet <Video> > mockSetVideos; var mockContext = VideosMockingSetup.DoMockingSetupForContext(true, out mockSetVideos); var repository = new VideosRepository(mockContext.Object); var videos = repository.Get(1); // Act repository.Deactivate(videos); // Assert Assert.Equal(false, videos.Active); }
public void Verify_Remove_Should_RemoveTheEntityFromTheContext() { // Arrange Mock <IDbSet <Video> > mockSetVideos; var mockContext = VideosMockingSetup.DoMockingSetupForContext(true, out mockSetVideos); var repository = new VideosRepository(mockContext.Object); var videos = repository.Get(1); // Act repository.Remove(videos); // Assert mockSetVideos.Verify(x => x.Remove((Video)videos), Times.Once); }
public void Verify_Update_Should_SetTheEntityStateToModified() { // Arrange Mock <IDbSet <Video> > mockSetVideos; var mockContext = VideosMockingSetup.DoMockingSetupForContext(true, out mockSetVideos); var repository = new VideosRepository(mockContext.Object); var videos = repository.Get(1); videos.ApiDetailUrl = "/TEST"; // Act repository.Update(videos); // Assert mockContext.Verify(x => x.SetModified(It.IsAny <object>()), Times.Once); }
public IEnumerable <Video> Get() { return(_repo.Get()); }
public void Verify_Get_ByID_Should_ReturnTheCorrectVideo() { // Arrange Mock<IDbSet<Video>> mockSetVideos; var mockContext = VideosMockingSetup.DoMockingSetupForContext(true, out mockSetVideos); var repository = new VideosRepository(mockContext.Object); // Act var videos = repository.Get(1); // Assert Assert.Equal("/TEST/KING-STEPHEN", videos.ApiDetailUrl); }
public void Verify_Update_Should_SetTheEntityStateToModified() { // Arrange Mock<IDbSet<Video>> mockSetVideos; var mockContext = VideosMockingSetup.DoMockingSetupForContext(true, out mockSetVideos); var repository = new VideosRepository(mockContext.Object); var videos = repository.Get(1); videos.ApiDetailUrl = "/TEST"; // Act repository.Update(videos); // Assert mockContext.Verify(x => x.SetModified(It.IsAny<object>()), Times.Once); }
public void Verify_Remove_Should_RemoveTheEntityFromTheContext() { // Arrange Mock<IDbSet<Video>> mockSetVideos; var mockContext = VideosMockingSetup.DoMockingSetupForContext(true, out mockSetVideos); var repository = new VideosRepository(mockContext.Object); var videos = repository.Get(1); // Act repository.Remove(videos); // Assert mockSetVideos.Verify(x => x.Remove((Video)videos), Times.Once); }