public void Verify_Add_Should_AddTheEntityToTheContext()
 {
     // Arrange
     Mock<IDbSet<ConceptIssue>> mockSetConceptIssues;
     var mockContext = ConceptIssuesMockingSetup.DoMockingSetupForContext(false, out mockSetConceptIssues);
     var repository = new ConceptIssuesRepository(mockContext.Object);
     var conceptIssues = new ConceptIssue { Active = true, CustomKey = "SALVATORE-RAA", };
     // Act
     repository.Add(conceptIssues);
     // Assert
     mockSetConceptIssues.Verify(x => x.Add(conceptIssues), Times.Once);
 }
Esempio n. 2
0
        public void Verify_Add_Should_AddTheEntityToTheContext()
        {
            // Arrange
            Mock <IDbSet <ConceptIssue> > mockSetConceptIssues;
            var mockContext   = ConceptIssuesMockingSetup.DoMockingSetupForContext(false, out mockSetConceptIssues);
            var repository    = new ConceptIssuesRepository(mockContext.Object);
            var conceptIssues = new ConceptIssue {
                Active = true, CustomKey = "SALVATORE-RAA",
            };

            // Act
            repository.Add(conceptIssues);
            // Assert
            mockSetConceptIssues.Verify(x => x.Add(conceptIssues), Times.Once);
        }
Esempio n. 3
0
        public void Verify_MapToEntity_WithExistingEntity_AssignsConceptIssueProperties()
        {
            // Arrange
            var mapper = new ConceptIssueMapper();
            var model  = ConceptIssuesMockingSetup.DoMockingSetupForConceptIssueModel();
            // Act
            IConceptIssue existingEntity = new ConceptIssue {
                Id = 1
            };

            mapper.MapToEntity(model.Object, ref existingEntity);
            // Assert
            // <None>
            // Related Objects
            Assert.Equal(model.Object.ConceptId, existingEntity.ConceptId);
            Assert.Equal(model.Object.IssueId, existingEntity.IssueId);
            // Associated Objects
            // <None>
        }
 public void Verify_MapToEntity_WithExistingEntity_AssignsConceptIssueProperties()
 {
     // Arrange
     var mapper = new ConceptIssueMapper();
     var model = ConceptIssuesMockingSetup.DoMockingSetupForConceptIssueModel();
     // Act
     IConceptIssue existingEntity = new ConceptIssue { Id = 1 };
     mapper.MapToEntity(model.Object, ref existingEntity);
     // Assert
     // <None>
     // Related Objects
     Assert.Equal(model.Object.ConceptId, existingEntity.ConceptId);
     Assert.Equal(model.Object.IssueId, existingEntity.IssueId);
     // Associated Objects
     // <None>
 }