示例#1
0
        public void Verify_Get_ByKey_Should_ReturnTheCorrectCharacterDiedInIssue()
        {
            // Arrange
            Mock <IDbSet <CharacterDiedInIssue> > mockSetCharacterDiedInIssues;
            var mockContext = CharacterDiedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterDiedInIssues);
            var repository  = new CharacterDiedInIssuesRepository(mockContext.Object);
            // Act
            var characterDiedInIssues = repository.Get("KING-STEPHEN");

            // Assert
            Assert.Equal("/TEST/KING-STEPHEN", characterDiedInIssues.ApiDetailUrl);
        }
 public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity()
 {
     // Arrange
     Mock<IDbSet<CharacterDiedInIssue>> mockSetCharacterDiedInIssues;
     var mockContext = CharacterDiedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterDiedInIssues);
     var repository = new CharacterDiedInIssuesRepository(mockContext.Object);
     var characterDiedInIssues = repository.Get(1);
     // Act
     repository.Deactivate(characterDiedInIssues);
     // Assert
     Assert.Equal(false, characterDiedInIssues.Active);
 }
示例#3
0
        public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity()
        {
            // Arrange
            Mock <IDbSet <CharacterDiedInIssue> > mockSetCharacterDiedInIssues;
            var mockContext           = CharacterDiedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterDiedInIssues);
            var repository            = new CharacterDiedInIssuesRepository(mockContext.Object);
            var characterDiedInIssues = repository.Get(1);

            // Act
            repository.Deactivate(characterDiedInIssues);
            // Assert
            Assert.Equal(false, characterDiedInIssues.Active);
        }
示例#4
0
        public void Verify_Remove_Should_RemoveTheEntityFromTheContext()
        {
            // Arrange
            Mock <IDbSet <CharacterDiedInIssue> > mockSetCharacterDiedInIssues;
            var mockContext           = CharacterDiedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterDiedInIssues);
            var repository            = new CharacterDiedInIssuesRepository(mockContext.Object);
            var characterDiedInIssues = repository.Get(1);

            // Act
            repository.Remove(characterDiedInIssues);
            // Assert
            mockSetCharacterDiedInIssues.Verify(x => x.Remove((CharacterDiedInIssue)characterDiedInIssues), Times.Once);
        }
示例#5
0
        public void Verify_Update_Should_SetTheEntityStateToModified()
        {
            // Arrange
            Mock <IDbSet <CharacterDiedInIssue> > mockSetCharacterDiedInIssues;
            var mockContext           = CharacterDiedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterDiedInIssues);
            var repository            = new CharacterDiedInIssuesRepository(mockContext.Object);
            var characterDiedInIssues = repository.Get(1);

            characterDiedInIssues.ApiDetailUrl = "/TEST";
            // Act
            repository.Update(characterDiedInIssues);
            // Assert
            mockContext.Verify(x => x.SetModified(It.IsAny <object>()), Times.Once);
        }
 public void Verify_Get_ByID_Should_ReturnTheCorrectCharacterDiedInIssue()
 {
     // Arrange
     Mock<IDbSet<CharacterDiedInIssue>> mockSetCharacterDiedInIssues;
     var mockContext = CharacterDiedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterDiedInIssues);
     var repository = new CharacterDiedInIssuesRepository(mockContext.Object);
     // Act
     var characterDiedInIssues = repository.Get(1);
     // Assert
                 Assert.Equal("/TEST/KING-STEPHEN", characterDiedInIssues.ApiDetailUrl);
 }
 public void Verify_Update_Should_SetTheEntityStateToModified()
 {
     // Arrange
     Mock<IDbSet<CharacterDiedInIssue>> mockSetCharacterDiedInIssues;
     var mockContext = CharacterDiedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterDiedInIssues);
     var repository = new CharacterDiedInIssuesRepository(mockContext.Object);
     var characterDiedInIssues = repository.Get(1);
     characterDiedInIssues.ApiDetailUrl = "/TEST";
     // Act
     repository.Update(characterDiedInIssues);
     // Assert
     mockContext.Verify(x => x.SetModified(It.IsAny<object>()), Times.Once);
 }
 public void Verify_Remove_Should_RemoveTheEntityFromTheContext()
 {
     // Arrange
     Mock<IDbSet<CharacterDiedInIssue>> mockSetCharacterDiedInIssues;
     var mockContext = CharacterDiedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterDiedInIssues);
     var repository = new CharacterDiedInIssuesRepository(mockContext.Object);
     var characterDiedInIssues = repository.Get(1);
     // Act
     repository.Remove(characterDiedInIssues);
     // Assert
     mockSetCharacterDiedInIssues.Verify(x => x.Remove((CharacterDiedInIssue)characterDiedInIssues), Times.Once);
 }