コード例 #1
0
        public void MissingDestProp()
        {
            var primitiveC = new SimpleC();
            var primitiveA = _mapper.Map <SimpleObjectA>(primitiveC);

            Assert.AreEqual(primitiveC.Primitive, primitiveA.Primitive);
        }
コード例 #2
0
        public void WithOutOverrideHashCode()
        {
            var mapper = new MapperBuilder()
                         .AddMapper <SimpleC, SimpleD>()
                         .Reverse()
                         .Build();

            var a = new SimpleC
            {
                Id       = _fixture.Create <int>(),
                Text     = _fixture.Create <string>(),
                IsEnable = _fixture.Create <bool>()
            };

            var b = new SimpleD
            {
                Id       = _fixture.Create <int>(),
                Text     = _fixture.Create <string>(),
                IsEnable = _fixture.Create <bool>()
            };

            a.Simple = b;
            b.Simple = a;

            var newB = mapper.Map <SimpleD>(a);

            newB.Id.Should().Be(a.Id);
            newB.Text.Should().Be(a.Text);
            newB.IsEnable.Should().Be(a.IsEnable);

            newB.Simple.Id.Should().Be(b.Id);
            newB.Simple.Text.Should().Be(b.Text);
            newB.Simple.IsEnable.Should().Be(b.IsEnable);
        }
コード例 #3
0
        public void MissingDestPropWithValues()
        {
            var primitiveC = new SimpleC {
                Primitive = 32, HereOnly = 12
            };
            var primitiveA = _mapper.Map <SimpleObjectA>(primitiveC);

            Assert.AreEqual(primitiveC.Primitive, primitiveA.Primitive);
        }
コード例 #4
0
 public virtual bool NeedTransition(SimpleC target)
 {
     return(false);
 }
コード例 #5
0
 public virtual void Excute(SimpleC target)
 {
 }