コード例 #1
0
        public void Can_Map_From_Nullable_Source_To_Nullable_Target()
        {
            var poco = new NullablePrimitivesPoco {
                Id = Guid.NewGuid(), Name = "TestName"
            };

            NullablePrimitivesPoco2 dto = TypeAdapter.Adapt <NullablePrimitivesPoco, NullablePrimitivesPoco2>(poco);

            dto.Id.ShouldBe(poco.Id);
            dto.Name.ShouldBe(poco.Name);
            dto.IsImport.ShouldBeNull();
            dto.Amount.ShouldBeNull();
        }
コード例 #2
0
        public void Can_Map_From_Nullable_Source_To_Nullable_Existing_Target()
        {
            var poco = new NullablePrimitivesPoco { Id = Guid.NewGuid(), Name = "TestName" };

            NullablePrimitivesPoco2 dto = new NullablePrimitivesPoco2
            {
                IsImport = true,
                Amount = 1,
            };

            TypeAdapter.Adapt(poco, dto);

            dto.Id.ShouldBe(poco.Id);
            dto.Name.ShouldBe(poco.Name);
            dto.IsImport.ShouldBeNull();
            dto.Amount.ShouldBeNull();
        }
コード例 #3
0
        public void Can_Map_From_Nullable_Source_To_Nullable_Existing_Target()
        {
            var poco = new NullablePrimitivesPoco {
                Id = Guid.NewGuid(), Name = "TestName"
            };

            NullablePrimitivesPoco2 dto = new NullablePrimitivesPoco2
            {
                IsImport = true,
                Amount   = 1,
            };

            TypeAdapter.Adapt(poco, dto);

            dto.Id.ShouldEqual(poco.Id);
            dto.Name.ShouldEqual(poco.Name);
            dto.IsImport.ShouldBeNull();
            dto.Amount.ShouldBeNull();
        }