예제 #1
0
        public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse()
        {
            // Arrange
            var mapper = new PersonAliasMapper();
            var model  = PersonAliasesMockingSetup.DoMockingSetupForPersonAliasModel(1);
            var entity = PersonAliasesMockingSetup.DoMockingSetupForPersonAlias(2);
            // Act
            var result = mapper.AreEqual(model.Object, entity.Object);

            // Assert
            Assert.False(result);
        }
예제 #2
0
        public void Verify_MapToModelLite_AssignsLiteOnlyPersonAliasProperties()
        {
            // Arrange
            var mapper = new PersonAliasMapper();
            var entity = PersonAliasesMockingSetup.DoMockingSetupForPersonAlias();
            // Act
            var model = mapper.MapToModelLite(entity.Object);

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

            mockMapper.Setup(x => x.MapToEntity(It.IsAny <IPersonAliasModel>(), It.IsAny <int>()));
            var mockModel = PersonAliasesMockingSetup.DoMockingSetupForPersonAliasModel(1);

            PersonAliasMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockModel.Object.MapToEntity();
            // Assert
            mockMapper.Verify(x => x.MapToEntity(It.IsAny <IPersonAliasModel>(), It.IsAny <int>()), Times.Once);
        }
예제 #4
0
        public void Verify_MapToEntity_AssignsPersonAliasProperties()
        {
            // Arrange
            var mapper = new PersonAliasMapper();
            var model  = PersonAliasesMockingSetup.DoMockingSetupForPersonAliasModel();
            // Act
            var entity = mapper.MapToEntity(model.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(model.Object.PersonId, entity.PersonId);
            // Associated Objects
            // <None>
        }
예제 #5
0
        public void Verify_MapToSearchModel_AssignsPersonAliasSearchProperties()
        {
            // Arrange
            var mapper = new PersonAliasMapper();
            var model  = PersonAliasesMockingSetup.DoMockingSetupForPersonAliasModel();
            // Act
            var searchModel = mapper.MapToSearchModel(model.Object);

            // Assert
            Assert.Equal(model.Object.PersonId, searchModel.PersonId);
            Assert.Equal(model.Object.Person?.CustomKey, searchModel.PersonCustomKey);
            Assert.Equal(model.Object.Person?.ApiDetailUrl, searchModel.PersonApiDetailUrl);
            Assert.Equal(model.Object.Person?.SiteDetailUrl, searchModel.PersonSiteDetailUrl);
            Assert.Equal(model.Object.Person?.Name, searchModel.PersonName);
            Assert.Equal(model.Object.Person?.ShortDescription, searchModel.PersonShortDescription);
            Assert.Equal(model.Object.Person?.Description, searchModel.PersonDescription);
        }