예제 #1
0
        public void Verify_Get_ByKey_Should_ReturnTheCorrectCharacterAppearedInIssue()
        {
            // Arrange
            Mock <IDbSet <CharacterAppearedInIssue> > mockSetCharacterAppearedInIssues;
            var mockContext = CharacterAppearedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterAppearedInIssues);
            var repository  = new CharacterAppearedInIssuesRepository(mockContext.Object);
            // Act
            var characterAppearedInIssues = repository.Get("KING-STEPHEN");

            // Assert
            Assert.Equal("/TEST/KING-STEPHEN", characterAppearedInIssues.ApiDetailUrl);
        }
 public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity()
 {
     // Arrange
     Mock<IDbSet<CharacterAppearedInIssue>> mockSetCharacterAppearedInIssues;
     var mockContext = CharacterAppearedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterAppearedInIssues);
     var repository = new CharacterAppearedInIssuesRepository(mockContext.Object);
     var characterAppearedInIssues = repository.Get(1);
     // Act
     repository.Deactivate(characterAppearedInIssues);
     // Assert
     Assert.Equal(false, characterAppearedInIssues.Active);
 }
예제 #3
0
        public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity()
        {
            // Arrange
            Mock <IDbSet <CharacterAppearedInIssue> > mockSetCharacterAppearedInIssues;
            var mockContext = CharacterAppearedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterAppearedInIssues);
            var repository  = new CharacterAppearedInIssuesRepository(mockContext.Object);
            var characterAppearedInIssues = repository.Get(1);

            // Act
            repository.Deactivate(characterAppearedInIssues);
            // Assert
            Assert.Equal(false, characterAppearedInIssues.Active);
        }
예제 #4
0
        public void Verify_Remove_Should_RemoveTheEntityFromTheContext()
        {
            // Arrange
            Mock <IDbSet <CharacterAppearedInIssue> > mockSetCharacterAppearedInIssues;
            var mockContext = CharacterAppearedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterAppearedInIssues);
            var repository  = new CharacterAppearedInIssuesRepository(mockContext.Object);
            var characterAppearedInIssues = repository.Get(1);

            // Act
            repository.Remove(characterAppearedInIssues);
            // Assert
            mockSetCharacterAppearedInIssues.Verify(x => x.Remove((CharacterAppearedInIssue)characterAppearedInIssues), Times.Once);
        }
예제 #5
0
        public void Verify_Update_Should_SetTheEntityStateToModified()
        {
            // Arrange
            Mock <IDbSet <CharacterAppearedInIssue> > mockSetCharacterAppearedInIssues;
            var mockContext = CharacterAppearedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterAppearedInIssues);
            var repository  = new CharacterAppearedInIssuesRepository(mockContext.Object);
            var characterAppearedInIssues = repository.Get(1);

            characterAppearedInIssues.ApiDetailUrl = "/TEST";
            // Act
            repository.Update(characterAppearedInIssues);
            // Assert
            mockContext.Verify(x => x.SetModified(It.IsAny <object>()), Times.Once);
        }
 public void Verify_Get_ByID_Should_ReturnTheCorrectCharacterAppearedInIssue()
 {
     // Arrange
     Mock<IDbSet<CharacterAppearedInIssue>> mockSetCharacterAppearedInIssues;
     var mockContext = CharacterAppearedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterAppearedInIssues);
     var repository = new CharacterAppearedInIssuesRepository(mockContext.Object);
     // Act
     var characterAppearedInIssues = repository.Get(1);
     // Assert
                 Assert.Equal("/TEST/KING-STEPHEN", characterAppearedInIssues.ApiDetailUrl);
 }
 public void Verify_Update_Should_SetTheEntityStateToModified()
 {
     // Arrange
     Mock<IDbSet<CharacterAppearedInIssue>> mockSetCharacterAppearedInIssues;
     var mockContext = CharacterAppearedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterAppearedInIssues);
     var repository = new CharacterAppearedInIssuesRepository(mockContext.Object);
     var characterAppearedInIssues = repository.Get(1);
     characterAppearedInIssues.ApiDetailUrl = "/TEST";
     // Act
     repository.Update(characterAppearedInIssues);
     // Assert
     mockContext.Verify(x => x.SetModified(It.IsAny<object>()), Times.Once);
 }
 public void Verify_Remove_Should_RemoveTheEntityFromTheContext()
 {
     // Arrange
     Mock<IDbSet<CharacterAppearedInIssue>> mockSetCharacterAppearedInIssues;
     var mockContext = CharacterAppearedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterAppearedInIssues);
     var repository = new CharacterAppearedInIssuesRepository(mockContext.Object);
     var characterAppearedInIssues = repository.Get(1);
     // Act
     repository.Remove(characterAppearedInIssues);
     // Assert
     mockSetCharacterAppearedInIssues.Verify(x => x.Remove((CharacterAppearedInIssue)characterAppearedInIssues), Times.Once);
 }