Exemple #1
0
        public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse()
        {
            // Arrange
            var mapper = new VolumeWriterMapper();
            var model  = VolumeWritersMockingSetup.DoMockingSetupForVolumeWriterModel(1);
            var entity = VolumeWritersMockingSetup.DoMockingSetupForVolumeWriter(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 <VolumeWriterMapper>();

            mockMapper.Setup(x => x.MapToEntity(It.IsAny <IVolumeWriterModel>(), It.IsAny <int>()));
            var mockModel = VolumeWritersMockingSetup.DoMockingSetupForVolumeWriterModel(1);

            VolumeWriterMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockModel.Object.MapToEntity();
            // Assert
            mockMapper.Verify(x => x.MapToEntity(It.IsAny <IVolumeWriterModel>(), It.IsAny <int>()), Times.Once);
        }
Exemple #3
0
        public void Verify_MapToModelLite_AssignsLiteOnlyVolumeWriterProperties()
        {
            // Arrange
            var mapper = new VolumeWriterMapper();
            var entity = VolumeWritersMockingSetup.DoMockingSetupForVolumeWriter();
            // Act
            var model = mapper.MapToModelLite(entity.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(entity.Object.VolumeId, model.VolumeId);
            Assert.Equal(entity.Object.WriterId, model.WriterId);
        }
Exemple #4
0
        public void Verify_MapToEntity_AssignsVolumeWriterProperties()
        {
            // Arrange
            var mapper = new VolumeWriterMapper();
            var model  = VolumeWritersMockingSetup.DoMockingSetupForVolumeWriterModel();
            // Act
            var entity = mapper.MapToEntity(model.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(model.Object.VolumeId, entity.VolumeId);
            Assert.Equal(model.Object.WriterId, entity.WriterId);
            // Associated Objects
            // <None>
        }
Exemple #5
0
        public void Verify_MapToSearchModel_AssignsVolumeWriterSearchProperties()
        {
            // Arrange
            var mapper = new VolumeWriterMapper();
            var model  = VolumeWritersMockingSetup.DoMockingSetupForVolumeWriterModel();
            // 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.WriterId, searchModel.WriterId);
            Assert.Equal(model.Object.Writer?.CustomKey, searchModel.WriterCustomKey);
            Assert.Equal(model.Object.Writer?.ApiDetailUrl, searchModel.WriterApiDetailUrl);
            Assert.Equal(model.Object.Writer?.SiteDetailUrl, searchModel.WriterSiteDetailUrl);
            Assert.Equal(model.Object.Writer?.Name, searchModel.WriterName);
            Assert.Equal(model.Object.Writer?.ShortDescription, searchModel.WriterShortDescription);
            Assert.Equal(model.Object.Writer?.Description, searchModel.WriterDescription);
        }