Exemplo n.º 1
0
        public void SetupAutoMapperSupport_V1()
        {
            AutoMapperHelpers ourHelper = new AutoMapperHelpers();

            _propFactory_V1        = ourHelper.PropFactory_V1;
            _amp                   = ourHelper.GetAutoMapperSetup_V1();
            _wrapperTypeCreator_V1 = ourHelper.GetWrapperTypeCreator_V1();
            PropModelCacheInterface _propModelCache = ourHelper.GetPropModelCache_V1();

            _viewModelFactory = ourHelper.ViewModelFactory;
        }
Exemplo n.º 2
0
        public void Create()
        {
            upCntr = 0;

            object stuff = new object();

            AutoMapperSupport.AutoMapperHelpers mapperHelpers = new AutoMapperSupport.AutoMapperHelpers();

            IPropFactory standardPropFactory = mapperHelpers.PropFactory_V1;

            IPropFactory factory = mapperHelpers.PropFactoryExt_V1;

            PSAccessServiceCreatorInterface storeAccessCreator = mapperHelpers.StoreAccessCreator;

            mod1 = ExtStoreModel.Create(storeAccessCreator, factory);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
 public void Create()
 {
     _amHelpers = new AutoMapperSupport.AutoMapperHelpers();
 }