Пример #1
0
        public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse()
        {
            // Arrange
            var mapper = new VolumeConceptMapper();
            var model  = VolumeConceptsMockingSetup.DoMockingSetupForVolumeConceptModel(1);
            var entity = VolumeConceptsMockingSetup.DoMockingSetupForVolumeConcept(2);
            // Act
            var result = mapper.AreEqual(model.Object, entity.Object);

            // Assert
            Assert.False(result);
        }
Пример #2
0
        public void Verify_MapToEntityExtension_CallsMapToEntity()
        {
            // Arrange
            var mockMapper = new Mock <VolumeConceptMapper>();

            mockMapper.Setup(x => x.MapToEntity(It.IsAny <IVolumeConceptModel>(), It.IsAny <int>()));
            var mockModel = VolumeConceptsMockingSetup.DoMockingSetupForVolumeConceptModel(1);

            VolumeConceptMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockModel.Object.MapToEntity();
            // Assert
            mockMapper.Verify(x => x.MapToEntity(It.IsAny <IVolumeConceptModel>(), It.IsAny <int>()), Times.Once);
        }
Пример #3
0
        public void Verify_MapToEntity_AssignsVolumeConceptProperties()
        {
            // Arrange
            var mapper = new VolumeConceptMapper();
            var model  = VolumeConceptsMockingSetup.DoMockingSetupForVolumeConceptModel();
            // Act
            var entity = mapper.MapToEntity(model.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(model.Object.VolumeId, entity.VolumeId);
            Assert.Equal(model.Object.ConceptId, entity.ConceptId);
            // Associated Objects
            // <None>
        }
Пример #4
0
        public void Verify_MapToSearchModel_AssignsVolumeConceptSearchProperties()
        {
            // Arrange
            var mapper = new VolumeConceptMapper();
            var model  = VolumeConceptsMockingSetup.DoMockingSetupForVolumeConceptModel();
            // Act
            var searchModel = mapper.MapToSearchModel(model.Object);

            // Assert
            Assert.Equal(model.Object.VolumeId, searchModel.VolumeId);
            Assert.Equal(model.Object.Volume?.CustomKey, searchModel.VolumeCustomKey);
            Assert.Equal(model.Object.Volume?.ApiDetailUrl, searchModel.VolumeApiDetailUrl);
            Assert.Equal(model.Object.Volume?.SiteDetailUrl, searchModel.VolumeSiteDetailUrl);
            Assert.Equal(model.Object.Volume?.Name, searchModel.VolumeName);
            Assert.Equal(model.Object.Volume?.ShortDescription, searchModel.VolumeShortDescription);
            Assert.Equal(model.Object.Volume?.Description, searchModel.VolumeDescription);
            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);
        }