Exemple #1
0
        public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse()
        {
            // Arrange
            var mapper = new ConceptIssueMapper();
            var model  = ConceptIssuesMockingSetup.DoMockingSetupForConceptIssueModel(1);
            var entity = ConceptIssuesMockingSetup.DoMockingSetupForConceptIssue(2);
            // Act
            var result = mapper.AreEqual(model.Object, entity.Object);

            // Assert
            Assert.False(result);
        }
Exemple #2
0
        public void Verify_MapToEntityExtension_CallsMapToEntity()
        {
            // Arrange
            var mockMapper = new Mock <ConceptIssueMapper>();

            mockMapper.Setup(x => x.MapToEntity(It.IsAny <IConceptIssueModel>(), It.IsAny <int>()));
            var mockModel = ConceptIssuesMockingSetup.DoMockingSetupForConceptIssueModel(1);

            ConceptIssueMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockModel.Object.MapToEntity();
            // Assert
            mockMapper.Verify(x => x.MapToEntity(It.IsAny <IConceptIssueModel>(), It.IsAny <int>()), Times.Once);
        }
Exemple #3
0
        public void Verify_MapToModelLite_AssignsLiteOnlyConceptIssueProperties()
        {
            // Arrange
            var mapper = new ConceptIssueMapper();
            var entity = ConceptIssuesMockingSetup.DoMockingSetupForConceptIssue();
            // Act
            var model = mapper.MapToModelLite(entity.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(entity.Object.ConceptId, model.ConceptId);
            Assert.Equal(entity.Object.IssueId, model.IssueId);
        }
Exemple #4
0
        public void Verify_MapToEntity_AssignsConceptIssueProperties()
        {
            // Arrange
            var mapper = new ConceptIssueMapper();
            var model  = ConceptIssuesMockingSetup.DoMockingSetupForConceptIssueModel();
            // Act
            var entity = mapper.MapToEntity(model.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(model.Object.ConceptId, entity.ConceptId);
            Assert.Equal(model.Object.IssueId, entity.IssueId);
            // Associated Objects
            // <None>
        }
Exemple #5
0
        public void Verify_MapToSearchModel_AssignsConceptIssueSearchProperties()
        {
            // Arrange
            var mapper = new ConceptIssueMapper();
            var model  = ConceptIssuesMockingSetup.DoMockingSetupForConceptIssueModel();
            // Act
            var searchModel = mapper.MapToSearchModel(model.Object);

            // Assert
            Assert.Equal(model.Object.ConceptId, searchModel.ConceptId);
            Assert.Equal(model.Object.Concept?.CustomKey, searchModel.ConceptCustomKey);
            Assert.Equal(model.Object.Concept?.ApiDetailUrl, searchModel.ConceptApiDetailUrl);
            Assert.Equal(model.Object.Concept?.SiteDetailUrl, searchModel.ConceptSiteDetailUrl);
            Assert.Equal(model.Object.Concept?.Name, searchModel.ConceptName);
            Assert.Equal(model.Object.Concept?.ShortDescription, searchModel.ConceptShortDescription);
            Assert.Equal(model.Object.Concept?.Description, searchModel.ConceptDescription);
            Assert.Equal(model.Object.IssueId, searchModel.IssueId);
            Assert.Equal(model.Object.Issue?.CustomKey, searchModel.IssueCustomKey);
            Assert.Equal(model.Object.Issue?.ApiDetailUrl, searchModel.IssueApiDetailUrl);
            Assert.Equal(model.Object.Issue?.SiteDetailUrl, searchModel.IssueSiteDetailUrl);
            Assert.Equal(model.Object.Issue?.Name, searchModel.IssueName);
            Assert.Equal(model.Object.Issue?.ShortDescription, searchModel.IssueShortDescription);
            Assert.Equal(model.Object.Issue?.Description, searchModel.IssueDescription);
        }