コード例 #1
0
        public void Verify_Get_ByKey_Should_ReturnTheCorrectEpisodeLocationFirstAppearance()
        {
            // Arrange
            Mock <IDbSet <EpisodeLocationFirstAppearance> > mockSetEpisodeLocationFirstAppearances;
            var mockContext = EpisodeLocationFirstAppearancesMockingSetup.DoMockingSetupForContext(true, out mockSetEpisodeLocationFirstAppearances);
            var repository  = new EpisodeLocationFirstAppearancesRepository(mockContext.Object);
            // Act
            var episodeLocationFirstAppearances = repository.Get("KING-STEPHEN");

            // Assert
            Assert.Equal("/TEST/KING-STEPHEN", episodeLocationFirstAppearances.ApiDetailUrl);
        }
 public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity()
 {
     // Arrange
     Mock<IDbSet<EpisodeLocationFirstAppearance>> mockSetEpisodeLocationFirstAppearances;
     var mockContext = EpisodeLocationFirstAppearancesMockingSetup.DoMockingSetupForContext(true, out mockSetEpisodeLocationFirstAppearances);
     var repository = new EpisodeLocationFirstAppearancesRepository(mockContext.Object);
     var episodeLocationFirstAppearances = repository.Get(1);
     // Act
     repository.Deactivate(episodeLocationFirstAppearances);
     // Assert
     Assert.Equal(false, episodeLocationFirstAppearances.Active);
 }
コード例 #3
0
        public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity()
        {
            // Arrange
            Mock <IDbSet <EpisodeLocationFirstAppearance> > mockSetEpisodeLocationFirstAppearances;
            var mockContext = EpisodeLocationFirstAppearancesMockingSetup.DoMockingSetupForContext(true, out mockSetEpisodeLocationFirstAppearances);
            var repository  = new EpisodeLocationFirstAppearancesRepository(mockContext.Object);
            var episodeLocationFirstAppearances = repository.Get(1);

            // Act
            repository.Deactivate(episodeLocationFirstAppearances);
            // Assert
            Assert.Equal(false, episodeLocationFirstAppearances.Active);
        }
コード例 #4
0
        public void Verify_Remove_Should_RemoveTheEntityFromTheContext()
        {
            // Arrange
            Mock <IDbSet <EpisodeLocationFirstAppearance> > mockSetEpisodeLocationFirstAppearances;
            var mockContext = EpisodeLocationFirstAppearancesMockingSetup.DoMockingSetupForContext(true, out mockSetEpisodeLocationFirstAppearances);
            var repository  = new EpisodeLocationFirstAppearancesRepository(mockContext.Object);
            var episodeLocationFirstAppearances = repository.Get(1);

            // Act
            repository.Remove(episodeLocationFirstAppearances);
            // Assert
            mockSetEpisodeLocationFirstAppearances.Verify(x => x.Remove((EpisodeLocationFirstAppearance)episodeLocationFirstAppearances), Times.Once);
        }
コード例 #5
0
        public void Verify_Update_Should_SetTheEntityStateToModified()
        {
            // Arrange
            Mock <IDbSet <EpisodeLocationFirstAppearance> > mockSetEpisodeLocationFirstAppearances;
            var mockContext = EpisodeLocationFirstAppearancesMockingSetup.DoMockingSetupForContext(true, out mockSetEpisodeLocationFirstAppearances);
            var repository  = new EpisodeLocationFirstAppearancesRepository(mockContext.Object);
            var episodeLocationFirstAppearances = repository.Get(1);

            episodeLocationFirstAppearances.ApiDetailUrl = "/TEST";
            // Act
            repository.Update(episodeLocationFirstAppearances);
            // Assert
            mockContext.Verify(x => x.SetModified(It.IsAny <object>()), Times.Once);
        }
 public void Verify_Get_ByID_Should_ReturnTheCorrectEpisodeLocationFirstAppearance()
 {
     // Arrange
     Mock<IDbSet<EpisodeLocationFirstAppearance>> mockSetEpisodeLocationFirstAppearances;
     var mockContext = EpisodeLocationFirstAppearancesMockingSetup.DoMockingSetupForContext(true, out mockSetEpisodeLocationFirstAppearances);
     var repository = new EpisodeLocationFirstAppearancesRepository(mockContext.Object);
     // Act
     var episodeLocationFirstAppearances = repository.Get(1);
     // Assert
                 Assert.Equal("/TEST/KING-STEPHEN", episodeLocationFirstAppearances.ApiDetailUrl);
 }
 public void Verify_Update_Should_SetTheEntityStateToModified()
 {
     // Arrange
     Mock<IDbSet<EpisodeLocationFirstAppearance>> mockSetEpisodeLocationFirstAppearances;
     var mockContext = EpisodeLocationFirstAppearancesMockingSetup.DoMockingSetupForContext(true, out mockSetEpisodeLocationFirstAppearances);
     var repository = new EpisodeLocationFirstAppearancesRepository(mockContext.Object);
     var episodeLocationFirstAppearances = repository.Get(1);
     episodeLocationFirstAppearances.ApiDetailUrl = "/TEST";
     // Act
     repository.Update(episodeLocationFirstAppearances);
     // Assert
     mockContext.Verify(x => x.SetModified(It.IsAny<object>()), Times.Once);
 }
 public void Verify_Remove_Should_RemoveTheEntityFromTheContext()
 {
     // Arrange
     Mock<IDbSet<EpisodeLocationFirstAppearance>> mockSetEpisodeLocationFirstAppearances;
     var mockContext = EpisodeLocationFirstAppearancesMockingSetup.DoMockingSetupForContext(true, out mockSetEpisodeLocationFirstAppearances);
     var repository = new EpisodeLocationFirstAppearancesRepository(mockContext.Object);
     var episodeLocationFirstAppearances = repository.Get(1);
     // Act
     repository.Remove(episodeLocationFirstAppearances);
     // Assert
     mockSetEpisodeLocationFirstAppearances.Verify(x => x.Remove((EpisodeLocationFirstAppearance)episodeLocationFirstAppearances), Times.Once);
 }