示例#1
0
        public void ValueType_String_Object_Is_Always_Primitive()
        {
            var sourceDto = new PrimitivePoco
            {
                Id   = "test",
                Time = TimeSpan.FromHours(7),
            };
            var targetDto = Mapper.Map <PrimitivePoco, PrimitivePoco>(sourceDto);

            Assert.Equal(sourceDto.Id, targetDto.Id);
            Assert.Equal(sourceDto.Time, targetDto.Time);
        }
示例#2
0
        public void ValueType_String_Object_Is_Always_Primitive()
        {
            var sourceDto = new PrimitivePoco
            {
                Id = "test",
                Time = TimeSpan.FromHours(7),
                Obj = new object(),
            };
            var targetDto = TypeAdapter.Adapt<PrimitivePoco, PrimitivePoco>(sourceDto);

            targetDto.Id.ShouldEqual(sourceDto.Id);
            targetDto.Time.ShouldEqual(sourceDto.Time);
            targetDto.Obj.ShouldBeSameAs(sourceDto.Obj);
        }
示例#3
0
        public void ValueType_String_Object_Is_Always_Primitive()
        {
            var sourceDto = new PrimitivePoco
            {
                Id   = "test",
                Time = TimeSpan.FromHours(7),
                Obj  = new object(),
            };
            var targetDto = TypeAdapter.Adapt <PrimitivePoco, PrimitivePoco>(sourceDto);

            targetDto.Id.ShouldBe(sourceDto.Id);
            targetDto.Time.ShouldBe(sourceDto.Time);
            targetDto.Obj.ShouldBeSameAs(sourceDto.Obj);
        }