public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity()
 {
     // Arrange
     Mock<IDbSet<ConceptAppearedInIssue>> mockSetConceptAppearedInIssues;
     var mockContext = ConceptAppearedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetConceptAppearedInIssues);
     var repository = new ConceptAppearedInIssuesRepository(mockContext.Object);
     var conceptAppearedInIssues = repository.Get(1);
     // Act
     repository.Deactivate(conceptAppearedInIssues);
     // Assert
     Assert.Equal(false, conceptAppearedInIssues.Active);
 }
        public void Verify_Get_ByKey_Should_ReturnTheCorrectConceptAppearedInIssue()
        {
            // Arrange
            Mock <IDbSet <ConceptAppearedInIssue> > mockSetConceptAppearedInIssues;
            var mockContext = ConceptAppearedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetConceptAppearedInIssues);
            var repository  = new ConceptAppearedInIssuesRepository(mockContext.Object);
            // Act
            var conceptAppearedInIssues = repository.Get("KING-STEPHEN");

            // Assert
            Assert.Equal("/TEST/KING-STEPHEN", conceptAppearedInIssues.ApiDetailUrl);
        }
 public void Verify_Add_Should_AddTheEntityToTheContext()
 {
     // Arrange
     Mock<IDbSet<ConceptAppearedInIssue>> mockSetConceptAppearedInIssues;
     var mockContext = ConceptAppearedInIssuesMockingSetup.DoMockingSetupForContext(false, out mockSetConceptAppearedInIssues);
     var repository = new ConceptAppearedInIssuesRepository(mockContext.Object);
     var conceptAppearedInIssues = new ConceptAppearedInIssue { Active = true, CustomKey = "SALVATORE-RAA", };
     // Act
     repository.Add(conceptAppearedInIssues);
     // Assert
     mockSetConceptAppearedInIssues.Verify(x => x.Add(conceptAppearedInIssues), Times.Once);
 }
        public void Verify_Remove_Should_RemoveTheEntityFromTheContext()
        {
            // Arrange
            Mock <IDbSet <ConceptAppearedInIssue> > mockSetConceptAppearedInIssues;
            var mockContext             = ConceptAppearedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetConceptAppearedInIssues);
            var repository              = new ConceptAppearedInIssuesRepository(mockContext.Object);
            var conceptAppearedInIssues = repository.Get(1);

            // Act
            repository.Remove(conceptAppearedInIssues);
            // Assert
            mockSetConceptAppearedInIssues.Verify(x => x.Remove((ConceptAppearedInIssue)conceptAppearedInIssues), Times.Once);
        }
        public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity()
        {
            // Arrange
            Mock <IDbSet <ConceptAppearedInIssue> > mockSetConceptAppearedInIssues;
            var mockContext             = ConceptAppearedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetConceptAppearedInIssues);
            var repository              = new ConceptAppearedInIssuesRepository(mockContext.Object);
            var conceptAppearedInIssues = repository.Get(1);

            // Act
            repository.Deactivate(conceptAppearedInIssues);
            // Assert
            Assert.Equal(false, conceptAppearedInIssues.Active);
        }
        public void Verify_Update_Should_SetTheEntityStateToModified()
        {
            // Arrange
            Mock <IDbSet <ConceptAppearedInIssue> > mockSetConceptAppearedInIssues;
            var mockContext             = ConceptAppearedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetConceptAppearedInIssues);
            var repository              = new ConceptAppearedInIssuesRepository(mockContext.Object);
            var conceptAppearedInIssues = repository.Get(1);

            conceptAppearedInIssues.ApiDetailUrl = "/TEST";
            // Act
            repository.Update(conceptAppearedInIssues);
            // Assert
            mockContext.Verify(x => x.SetModified(It.IsAny <object>()), Times.Once);
        }
        public void Verify_Add_Should_AddTheEntityToTheContext()
        {
            // Arrange
            Mock <IDbSet <ConceptAppearedInIssue> > mockSetConceptAppearedInIssues;
            var mockContext             = ConceptAppearedInIssuesMockingSetup.DoMockingSetupForContext(false, out mockSetConceptAppearedInIssues);
            var repository              = new ConceptAppearedInIssuesRepository(mockContext.Object);
            var conceptAppearedInIssues = new ConceptAppearedInIssue {
                Active = true, CustomKey = "SALVATORE-RAA",
            };

            // Act
            repository.Add(conceptAppearedInIssues);
            // Assert
            mockSetConceptAppearedInIssues.Verify(x => x.Add(conceptAppearedInIssues), Times.Once);
        }
        public void Verify_List_Should_ReturnAListOfConceptAppearedInIssuesWithData()
        {
            // Arrange
            Mock <IDbSet <ConceptAppearedInIssue> > mockSetConceptAppearedInIssues;
            var mockContext = ConceptAppearedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetConceptAppearedInIssues);
            var repository  = new ConceptAppearedInIssuesRepository(mockContext.Object);
            // Act
            var conceptAppearedInIssues = repository.List.ToArray();

            // Assert
            Assert.Equal(2, conceptAppearedInIssues.Length);
            Assert.Equal(1, conceptAppearedInIssues[0].Id);
            Assert.Equal("/TEST/KING-STEPHEN", conceptAppearedInIssues[0].ApiDetailUrl);
            Assert.Equal(2, conceptAppearedInIssues[1].Id);
            Assert.Equal("/TEST/NIVEN-LARRY", conceptAppearedInIssues[1].ApiDetailUrl);
        }
        public void Verify_Search_WithSelectStatement_Should_ReturnAListOfDynamicObjects()
        {
            // Arrange
            Mock <IDbSet <ConceptAppearedInIssue> > mockSetConceptAppearedInIssues;
            var mockContext = ConceptAppearedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetConceptAppearedInIssues, true);
            var repository  = new ConceptAppearedInIssuesRepository(mockContext.Object);
            var searchModel = new Mock <IConceptAppearedInIssueSearchModel>();
            // Act
            var conceptAppearedInIssues = repository.Search(searchModel.Object, i => new { i.Id, MyApiDetailUrl = i.ApiDetailUrl }).ToArray();

            // Assert
            Assert.Equal(1, conceptAppearedInIssues.Length);
            Assert.Equal(2, conceptAppearedInIssues[0].Id);
            Assert.Equal("/TEST/NIVEN-LARRY", conceptAppearedInIssues[0].MyApiDetailUrl);
            // Stephen King was filtered out because he was Inactive
        }
        public void Verify_Search_WithPaging_Should_ReturnAListOfConceptAppearedInIssuesWithDataMatchingSearchParameters()
        {
            // Arrange
            Mock <IDbSet <ConceptAppearedInIssue> > mockSetConceptAppearedInIssues;
            var mockContext = ConceptAppearedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetConceptAppearedInIssues);
            var repository  = new ConceptAppearedInIssuesRepository(mockContext.Object);
            var searchModel = new ConceptAppearedInIssueSearchModel {
                Paging = new Paging {
                    Skip = 1, Take = 1
                }
            };
            // Act
            var conceptAppearedInIssues = repository.Search(searchModel /*.Object*/).ToArray();

            // Assert
            Assert.Equal(1, conceptAppearedInIssues.Length);
            Assert.Equal(2, conceptAppearedInIssues[0].Id);
            Assert.Equal("/TEST/NIVEN-LARRY", conceptAppearedInIssues[0].ApiDetailUrl);
            // Stephen King was filtered out because he was Skipped
        }
        public void Verify_Search_WithModifiedSince_Should_ReturnAListOfConceptAppearedInIssuesWithDataMatchingSearchParameters()
        {
            // Arrange
            Mock <IDbSet <ConceptAppearedInIssue> > mockSetConceptAppearedInIssues;
            var mockContext = ConceptAppearedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetConceptAppearedInIssues, true);
            var repository  = new ConceptAppearedInIssuesRepository(mockContext.Object);
            var createDate  = new System.DateTime(2015, 05, 28, 10, 45, 00).AddDays(1).AddMinutes(-1);
            //var searchModel = new Mock<IConceptAppearedInIssueSearchModel>();
            //searchModel.Setup(m => m.ModifiedSince).Returns(() => createDate);
            var searchModel = new ConceptAppearedInIssueSearchModel {
                ModifiedSince = createDate
            };
            // Act
            var conceptAppearedInIssues = repository.Search(searchModel /*.Object*/).ToArray();

            // Assert
            Assert.Equal(1, conceptAppearedInIssues.Length);
            Assert.Equal(2, conceptAppearedInIssues[0].Id);
            Assert.Equal("/TEST/NIVEN-LARRY", conceptAppearedInIssues[0].ApiDetailUrl);
            // Stephen King was filtered out because he was created before the modified since date
        }
 public void Verify_List_Should_ReturnAListOfConceptAppearedInIssuesWithData()
 {
     // Arrange
     Mock<IDbSet<ConceptAppearedInIssue>> mockSetConceptAppearedInIssues;
     var mockContext = ConceptAppearedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetConceptAppearedInIssues);
     var repository = new ConceptAppearedInIssuesRepository(mockContext.Object);
     // Act
     var conceptAppearedInIssues = repository.List.ToArray();
     // Assert
     Assert.Equal(2, conceptAppearedInIssues.Length);
     Assert.Equal(1, conceptAppearedInIssues[0].Id);
     Assert.Equal("/TEST/KING-STEPHEN", conceptAppearedInIssues[0].ApiDetailUrl);
     Assert.Equal(2, conceptAppearedInIssues[1].Id);
     Assert.Equal("/TEST/NIVEN-LARRY", conceptAppearedInIssues[1].ApiDetailUrl);
 }
 public void Verify_Search_WithModifiedSince_Should_ReturnAListOfConceptAppearedInIssuesWithDataMatchingSearchParameters()
 {
     // Arrange
     Mock<IDbSet<ConceptAppearedInIssue>> mockSetConceptAppearedInIssues;
     var mockContext = ConceptAppearedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetConceptAppearedInIssues, true);
     var repository = new ConceptAppearedInIssuesRepository(mockContext.Object);
     var createDate = new System.DateTime(2015, 05, 28, 10, 45, 00).AddDays(1).AddMinutes(-1);
     //var searchModel = new Mock<IConceptAppearedInIssueSearchModel>();
     //searchModel.Setup(m => m.ModifiedSince).Returns(() => createDate);
     var searchModel = new ConceptAppearedInIssueSearchModel { ModifiedSince = createDate };
     // Act
     var conceptAppearedInIssues = repository.Search(searchModel/*.Object*/).ToArray();
     // Assert
     Assert.Equal(1, conceptAppearedInIssues.Length);
     Assert.Equal(2, conceptAppearedInIssues[0].Id);
     Assert.Equal("/TEST/NIVEN-LARRY", conceptAppearedInIssues[0].ApiDetailUrl);
     // Stephen King was filtered out because he was created before the modified since date
 }
 public void Verify_Search_WithPaging_Should_ReturnAListOfConceptAppearedInIssuesWithDataMatchingSearchParameters()
 {
     // Arrange
     Mock<IDbSet<ConceptAppearedInIssue>> mockSetConceptAppearedInIssues;
     var mockContext = ConceptAppearedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetConceptAppearedInIssues);
     var repository = new ConceptAppearedInIssuesRepository(mockContext.Object);
     var searchModel = new ConceptAppearedInIssueSearchModel { Paging = new Paging { Skip = 1, Take = 1 } };
     // Act
     var conceptAppearedInIssues = repository.Search(searchModel/*.Object*/).ToArray();
     // Assert
     Assert.Equal(1, conceptAppearedInIssues.Length);
     Assert.Equal(2, conceptAppearedInIssues[0].Id);
     Assert.Equal("/TEST/NIVEN-LARRY", conceptAppearedInIssues[0].ApiDetailUrl);
     // Stephen King was filtered out because he was Skipped
 }
 public void Verify_Remove_Should_RemoveTheEntityFromTheContext()
 {
     // Arrange
     Mock<IDbSet<ConceptAppearedInIssue>> mockSetConceptAppearedInIssues;
     var mockContext = ConceptAppearedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetConceptAppearedInIssues);
     var repository = new ConceptAppearedInIssuesRepository(mockContext.Object);
     var conceptAppearedInIssues = repository.Get(1);
     // Act
     repository.Remove(conceptAppearedInIssues);
     // Assert
     mockSetConceptAppearedInIssues.Verify(x => x.Remove((ConceptAppearedInIssue)conceptAppearedInIssues), Times.Once);
 }
 public void Verify_Get_ByID_Should_ReturnTheCorrectConceptAppearedInIssue()
 {
     // Arrange
     Mock<IDbSet<ConceptAppearedInIssue>> mockSetConceptAppearedInIssues;
     var mockContext = ConceptAppearedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetConceptAppearedInIssues);
     var repository = new ConceptAppearedInIssuesRepository(mockContext.Object);
     // Act
     var conceptAppearedInIssues = repository.Get(1);
     // Assert
                 Assert.Equal("/TEST/KING-STEPHEN", conceptAppearedInIssues.ApiDetailUrl);
 }
 public void Verify_Search_WithSelectStatement_Should_ReturnAListOfDynamicObjects()
 {
     // Arrange
     Mock<IDbSet<ConceptAppearedInIssue>> mockSetConceptAppearedInIssues;
     var mockContext = ConceptAppearedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetConceptAppearedInIssues, true);
     var repository = new ConceptAppearedInIssuesRepository(mockContext.Object);
     var searchModel = new Mock<IConceptAppearedInIssueSearchModel>();
     // Act
     var conceptAppearedInIssues = repository.Search(searchModel.Object, i => new { i.Id, MyApiDetailUrl = i.ApiDetailUrl }).ToArray();
     // Assert
     Assert.Equal(1, conceptAppearedInIssues.Length);
     Assert.Equal(2, conceptAppearedInIssues[0].Id);
     Assert.Equal("/TEST/NIVEN-LARRY", conceptAppearedInIssues[0].MyApiDetailUrl);
     // Stephen King was filtered out because he was Inactive
 }
 public void Verify_Update_Should_SetTheEntityStateToModified()
 {
     // Arrange
     Mock<IDbSet<ConceptAppearedInIssue>> mockSetConceptAppearedInIssues;
     var mockContext = ConceptAppearedInIssuesMockingSetup.DoMockingSetupForContext(true, out mockSetConceptAppearedInIssues);
     var repository = new ConceptAppearedInIssuesRepository(mockContext.Object);
     var conceptAppearedInIssues = repository.Get(1);
     conceptAppearedInIssues.ApiDetailUrl = "/TEST";
     // Act
     repository.Update(conceptAppearedInIssues);
     // Assert
     mockContext.Verify(x => x.SetModified(It.IsAny<object>()), Times.Once);
 }