Example #1
0
        public void NullableStruct_to_Struct()
        {
            NullableTypes.B3.BInt bint = new B3.BInt();
            bint.fld1 = "b";
            B3 b = new B3();

            b.fld1 = bint;
            b.fld2 = bint;
            b.fld3 = bint;
            b.fld4 = bint;
            b.fld6 = bint;
            b.fld7 = bint;
            var mapper = ObjectMapperManager.DefaultInstance.GetMapper <B3, A3>();
            //DynamicAssemblyManager.SaveAssembly();

            A3 a = mapper.Map(b);

            Assert.AreEqual("b", a.fld1.Value.fld1);
            Assert.AreEqual("b", a.fld2.Value.fld1);
            Assert.AreEqual("b", a.fld3.Value.fld1);
            Assert.AreEqual("b", a.fld4.Value.fld1);
            Assert.AreEqual("b", a.fld6.Value.fld1);
            Assert.AreEqual("b", a.fld7.fld1);
            Assert.AreEqual("a", a.fld2.Value.fld3);
            Assert.IsFalse(a.fld5.HasValue);
        }
Example #2
0
    public void NullableStruct_to_Struct()
    {
        var bint = new B3.BInt {
            Fld1 = "b"
        };

        var b = new B3
        {
            Fld1 = bint,
            Fld2 = bint,
            Fld3 = bint,
            Fld4 = bint,
            Fld6 = bint,
            Fld7 = bint
        };

        var mapper = Mapper.Default.GetMapper <B3, A3>();

        // DynamicAssemblyManager.SaveAssembly();
        var a = mapper.Map(b);

        a.Fld1.Value.Fld1.ShouldBe("b");
        a.Fld2.Value.Fld1.ShouldBe("b");
        a.Fld3.Value.Fld1.ShouldBe("b");
        a.Fld4.Value.Fld1.ShouldBe("b");
        a.Fld6.Value.Fld1.ShouldBe("b");
        a.Fld7.Fld1.ShouldBe("b");
        a.Fld2.Value.Fld3.ShouldBe("a");
        a.Fld5.HasValue.ShouldBeFalse();
    }
Example #3
0
        public void NullableStruct_to_Struct()
        {
            NullableTypes.B3.BInt bint = new B3.BInt();
            bint.fld1 = "b";
            B3 b = new B3();

            b.fld1 = bint;
            b.fld2 = bint;
            b.fld3 = bint;
            b.fld4 = bint;
            b.fld6 = bint;
            b.fld7 = bint;

            A3 a = Mapper.Map <B3, A3>(b);

            Assert.AreEqual("b", a.fld1.Value.fld1);
            Assert.AreEqual("b", a.fld2.Value.fld1);
            Assert.AreEqual("b", a.fld3.Value.fld1);
            Assert.AreEqual("b", a.fld4.Value.fld1);
            Assert.AreEqual("b", a.fld6.Value.fld1);
            Assert.AreEqual("b", a.fld7.fld1);
            Assert.IsFalse(a.fld5.HasValue);
        }
        public void NullableStruct_to_Struct()
        {
            NullableTypes.B3.BInt bint = new B3.BInt();
            bint.fld1 = "b";
            B3 b = new B3();
            b.fld1 = bint;
            b.fld2 = bint;
            b.fld3 = bint;
            b.fld4 = bint;
            b.fld6 = bint;
            b.fld7 = bint;
            var mapper = ObjectMapperManager.DefaultInstance.GetMapper<B3, A3>();
            //DynamicAssemblyManager.SaveAssembly();

            A3 a = mapper.Map(b);
            Assert.AreEqual("b", a.fld1.Value.fld1);
            Assert.AreEqual("b", a.fld2.Value.fld1);
            Assert.AreEqual("b", a.fld3.Value.fld1);
            Assert.AreEqual("b", a.fld4.Value.fld1);
            Assert.AreEqual("b", a.fld6.Value.fld1);
            Assert.AreEqual("b", a.fld7.fld1);
            Assert.AreEqual("a", a.fld2.Value.fld3);
            Assert.IsFalse(a.fld5.HasValue);
        }
Example #5
-1
        public void NullableStruct_to_Struct()
        {
            NullableTypes.B3.BInt bint = new B3.BInt();
            bint.fld1 = "b";
            B3 b = new B3();
            b.fld1 = bint;
            b.fld2 = bint;
            b.fld3 = bint;
            b.fld4 = bint;
            b.fld6 = bint;
            b.fld7 = bint;

            A3 a = Mapper.Map<B3, A3>(b);
            Assert.AreEqual("b", a.fld1.Value.fld1);
            Assert.AreEqual("b", a.fld2.Value.fld1);
            Assert.AreEqual("b", a.fld3.Value.fld1);
            Assert.AreEqual("b", a.fld4.Value.fld1);
            Assert.AreEqual("b", a.fld6.Value.fld1);
            Assert.AreEqual("b", a.fld7.fld1);
            Assert.IsFalse(a.fld5.HasValue);
        }