Esempio n. 1
0
        public void ShouldMapNormalProperty()
        {
            // arrange
            var source = new CompanyModel
            {
                CompanyName = "Test Company"
            };

            Mapper.WithRule(new Flattening());

            // act
            var result = Mapper.Map <CompanyDto>(source);

            // assert
            Assert.Equal(source.CompanyName, result.CompanyName);
        }
        public void ShouldMapGuidToString()
        {
            // arrange
            var source = new PersonModel {
                PersonGuid = Guid.NewGuid()
            };

            Mapper.AddConverter(new GuidToString());

            // act
            var result = Mapper.Map <PersonDto>(source);

            // assert
            Assert.Equal(source.PersonGuid.ToString(), result.PersonGuid);
        }
Esempio n. 3
0
 public static TDestination Map <TDestination>(object source) where TDestination : new()
 {
     return(Instance.Map <TDestination>(source));
 }
Esempio n. 4
0
        public void ShouldMapString()
        {
            // arrange
            var source = new PersonModel {
                Name = "Test"
            };

            // act
            var result = Mapper.Map <PersonDto>(source);

            // assert
            Assert.Equal(source.Name, result.Name);
        }