예제 #1
0
        public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse()
        {
            // Arrange
            var mapper = new LocationAliasMapper();
            var model  = LocationAliasesMockingSetup.DoMockingSetupForLocationAliasModel(1);
            var entity = LocationAliasesMockingSetup.DoMockingSetupForLocationAlias(2);
            // Act
            var result = mapper.AreEqual(model.Object, entity.Object);

            // Assert
            Assert.False(result);
        }
예제 #2
0
        public void Verify_MapToModelLite_AssignsLiteOnlyLocationAliasProperties()
        {
            // Arrange
            var mapper = new LocationAliasMapper();
            var entity = LocationAliasesMockingSetup.DoMockingSetupForLocationAlias();
            // Act
            var model = mapper.MapToModelLite(entity.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(entity.Object.LocationId, model.LocationId);
        }
예제 #3
0
        public void Verify_MapToEntityExtension_CallsMapToEntity()
        {
            // Arrange
            var mockMapper = new Mock <LocationAliasMapper>();

            mockMapper.Setup(x => x.MapToEntity(It.IsAny <ILocationAliasModel>(), It.IsAny <int>()));
            var mockModel = LocationAliasesMockingSetup.DoMockingSetupForLocationAliasModel(1);

            LocationAliasMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockModel.Object.MapToEntity();
            // Assert
            mockMapper.Verify(x => x.MapToEntity(It.IsAny <ILocationAliasModel>(), It.IsAny <int>()), Times.Once);
        }
예제 #4
0
        public void Verify_MapToEntity_AssignsLocationAliasProperties()
        {
            // Arrange
            var mapper = new LocationAliasMapper();
            var model  = LocationAliasesMockingSetup.DoMockingSetupForLocationAliasModel();
            // Act
            var entity = mapper.MapToEntity(model.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(model.Object.LocationId, entity.LocationId);
            // Associated Objects
            // <None>
        }
예제 #5
0
        public void Verify_MapToSearchModel_AssignsLocationAliasSearchProperties()
        {
            // Arrange
            var mapper = new LocationAliasMapper();
            var model  = LocationAliasesMockingSetup.DoMockingSetupForLocationAliasModel();
            // Act
            var searchModel = mapper.MapToSearchModel(model.Object);

            // Assert
            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);
        }