コード例 #1
0
        public void Verify_Get_ByKey_Should_ReturnTheCorrectConceptIssue()
        {
            // Arrange
            Mock <IDbSet <ConceptIssue> > mockSetConceptIssues;
            var mockContext = ConceptIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetConceptIssues);
            var repository  = new ConceptIssuesRepository(mockContext.Object);
            // Act
            var conceptIssues = repository.Get("KING-STEPHEN");

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

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

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

            conceptIssues.ApiDetailUrl = "/TEST";
            // Act
            repository.Update(conceptIssues);
            // Assert
            mockContext.Verify(x => x.SetModified(It.IsAny <object>()), Times.Once);
        }
 public void Verify_Get_ByID_Should_ReturnTheCorrectConceptIssue()
 {
     // Arrange
     Mock<IDbSet<ConceptIssue>> mockSetConceptIssues;
     var mockContext = ConceptIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetConceptIssues);
     var repository = new ConceptIssuesRepository(mockContext.Object);
     // Act
     var conceptIssues = repository.Get(1);
     // Assert
                 Assert.Equal("/TEST/KING-STEPHEN", conceptIssues.ApiDetailUrl);
 }
 public void Verify_Update_Should_SetTheEntityStateToModified()
 {
     // Arrange
     Mock<IDbSet<ConceptIssue>> mockSetConceptIssues;
     var mockContext = ConceptIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetConceptIssues);
     var repository = new ConceptIssuesRepository(mockContext.Object);
     var conceptIssues = repository.Get(1);
     conceptIssues.ApiDetailUrl = "/TEST";
     // Act
     repository.Update(conceptIssues);
     // Assert
     mockContext.Verify(x => x.SetModified(It.IsAny<object>()), Times.Once);
 }
 public void Verify_Remove_Should_RemoveTheEntityFromTheContext()
 {
     // Arrange
     Mock<IDbSet<ConceptIssue>> mockSetConceptIssues;
     var mockContext = ConceptIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetConceptIssues);
     var repository = new ConceptIssuesRepository(mockContext.Object);
     var conceptIssues = repository.Get(1);
     // Act
     repository.Remove(conceptIssues);
     // Assert
     mockSetConceptIssues.Verify(x => x.Remove((ConceptIssue)conceptIssues), Times.Once);
 }