예제 #1
0
        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);
 }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
 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);
 }