示例#1
0
        public void CanGetMapperForMod3ToDestination_Extra()
        {
            IPropFactory propFactory = _propFactory_V1;
            ViewModelFactoryInterface viewModelFactory = _viewModelFactory;

            PropModel propModel = GetPropModelForModel3Dest(propFactory);

            viewModelFactory.PropModelCache.Add(propModel);

            Type   typeToWrap        = typeof(DestinationModel3); // typeof(PropBag);
            string configPackageName = "Extra_Members";           // "Emit_Proxy";


            IMapperRequest mr = new MapperRequest(typeof(MyModel3), propModel, configPackageName);

            //IMapper rawAutoMapper = AutoMapperHelpers.GetAutoMapper<MyModel3, DestinationModel3>
            //    (
            //    mr,
            //    _amp,
            //    out IPropBagMapperKey<MyModel3, DestinationModel3> propBagMapperKey
            //    );

            //IPropBagMapper<MyModel3, DestinationModel3> cookedAutoMapper = new SimplePropBagMapper<MyModel3, DestinationModel3>
            //    (
            //    propBagMapperKey,
            //    rawAutoMapper,
            //    viewModelFactory,
            //    _amp
            //    );

            IPropBagMapper <MyModel3, DestinationModel3> propBagMapper = AutoMapperHelpers.GetAutoMapper <MyModel3, DestinationModel3>
                                                                         (
                mr,
                _amp,
                out IPropBagMapperRequestKey <MyModel3, DestinationModel3> propBagMapperKey
                                                                         );


            //IPropBagMapperKey<MyModel3, DestinationModel3> mapperRequest =
            //    _amp.SubmitMapperRequest<MyModel3, DestinationModel3>
            //    (
            //        propModel: propModel,
            //        viewModelFactory: viewModelFactory,
            //        typeToWrap: typeToWrap,
            //        configPackageName: configPackageName
            //    );

            Assert.That(propBagMapperKey, Is.Not.Null, "mapperRequest should be non-null.");

            //IPropBagMapper<MyModel3, DestinationModel3> mapper = _amp.GetMapper<MyModel3, DestinationModel3>(mapperRequest);

            Assert.That(propBagMapper, Is.Not.Null, "mapper should be non-null");

            MyModel4 dp = new MyModel4
            {
                MyString = "This is a good thing."
            };

            MyModel3 testSource = new MyModel3
            {
                Amount    = 11,
                Size      = 22.22,
                ProductId = Guid.Empty,
                Deep      = dp
            };


            DestinationModel3 testDest = propBagMapper.MapToDestination(testSource);

            //IPropBagMapperKey<MyModel3, DestinationModel3> mapperRequest2 =
            //    _amp.SubmitMapperRequest<MyModel3, DestinationModel3>
            //    (
            //        propModel: propModel,
            //        viewModelFactory: viewModelFactory,
            //        typeToWrap: typeToWrap,
            //        configPackageName: configPackageName
            //    );

            //IPropBagMapper<MyModel3, DestinationModel3> mapper2 = _amp.GetMapper<MyModel3, DestinationModel3>(mapperRequest2);


            IPropBagMapper <MyModel3, DestinationModel3> propBagMapper2 = AutoMapperHelpers.GetAutoMapper <MyModel3, DestinationModel3>
                                                                          (
                mr,
                _amp,
                out IPropBagMapperRequestKey <MyModel3, DestinationModel3> propBagMapperKey2
                                                                          );

            //IPropBagMapper<MyModel3, DestinationModel3> cookedAutoMapper2 = new SimplePropBagMapper<MyModel3, DestinationModel3>
            //    (
            //    propBagMapperKey,
            //    rawAutoMapper,
            //    viewModelFactory,
            //    _amp
            //    );

            DestinationModel3 testDest2 = propBagMapper2.MapToDestination(testSource);
        }
示例#2
0
 public DestinationModel3(DestinationModel3 copySource)
     : base(copySource)
 {
 }