コード例 #1
0
        public void WhenNotRegistered_ThrowsException()
        {
            var mapper   = new SimpleMapper();
            var instance = new SimpleMapperTestClasses.One()
            {
                Count = 1325
            };

            Assert.Throws <ArgumentException>(() => mapper.MapTo <SimpleMapperTestClasses.Two>(instance));
        }
コード例 #2
0
        public void WithMatchingProperties_CopiesValuesCorrectly()
        {
            var mapper = new SimpleMapper();

            mapper.Register <
                SimpleMapperTestClasses.One,
                SimpleMapperTestClasses.Two
                >();

            var instanceOne = new SimpleMapperTestClasses.One()
            {
                Count = 123
            };

            var instanceTwo =
                mapper.MapTo <SimpleMapperTestClasses.Two>(instanceOne);

            Assert.That(instanceTwo.Count, Is.EqualTo(123));
        }