Ejemplo n.º 1
0
        public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse()
        {
            // Arrange
            var mapper = new VolumeLocationMapper();
            var model  = VolumeLocationsMockingSetup.DoMockingSetupForVolumeLocationModel(1);
            var entity = VolumeLocationsMockingSetup.DoMockingSetupForVolumeLocation(2);
            // Act
            var result = mapper.AreEqual(model.Object, entity.Object);

            // Assert
            Assert.False(result);
        }
Ejemplo n.º 2
0
        public void Verify_MapToEntityExtension_CallsMapToEntity()
        {
            // Arrange
            var mockMapper = new Mock <VolumeLocationMapper>();

            mockMapper.Setup(x => x.MapToEntity(It.IsAny <IVolumeLocationModel>(), It.IsAny <int>()));
            var mockModel = VolumeLocationsMockingSetup.DoMockingSetupForVolumeLocationModel(1);

            VolumeLocationMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockModel.Object.MapToEntity();
            // Assert
            mockMapper.Verify(x => x.MapToEntity(It.IsAny <IVolumeLocationModel>(), It.IsAny <int>()), Times.Once);
        }
Ejemplo n.º 3
0
        public void Verify_MapToModelLite_AssignsLiteOnlyVolumeLocationProperties()
        {
            // Arrange
            var mapper = new VolumeLocationMapper();
            var entity = VolumeLocationsMockingSetup.DoMockingSetupForVolumeLocation();
            // Act
            var model = mapper.MapToModelLite(entity.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(entity.Object.VolumeId, model.VolumeId);
            Assert.Equal(entity.Object.LocationId, model.LocationId);
        }
Ejemplo n.º 4
0
        public void Verify_MapToEntity_AssignsVolumeLocationProperties()
        {
            // Arrange
            var mapper = new VolumeLocationMapper();
            var model  = VolumeLocationsMockingSetup.DoMockingSetupForVolumeLocationModel();
            // Act
            var entity = mapper.MapToEntity(model.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(model.Object.VolumeId, entity.VolumeId);
            Assert.Equal(model.Object.LocationId, entity.LocationId);
            // Associated Objects
            // <None>
        }
Ejemplo n.º 5
0
        public void Verify_MapToSearchModel_AssignsVolumeLocationSearchProperties()
        {
            // Arrange
            var mapper = new VolumeLocationMapper();
            var model  = VolumeLocationsMockingSetup.DoMockingSetupForVolumeLocationModel();
            // 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.LocationId, searchModel.LocationId);
            Assert.Equal(model.Object.Location?.CustomKey, searchModel.LocationCustomKey);
            Assert.Equal(model.Object.Location?.ApiDetailUrl, searchModel.LocationApiDetailUrl);
            Assert.Equal(model.Object.Location?.SiteDetailUrl, searchModel.LocationSiteDetailUrl);
            Assert.Equal(model.Object.Location?.Name, searchModel.LocationName);
            Assert.Equal(model.Object.Location?.ShortDescription, searchModel.LocationShortDescription);
            Assert.Equal(model.Object.Location?.Description, searchModel.LocationDescription);
        }