Beispiel #1
0
 public static ModelMapperTestModule Extend(this PredefinedMap[] maps, ModelMapperTestModule testModule = null, Action <ModelMapperConfiguration> configure = null)
 {
     testModule ??= new ModelMapperTestModule();
     testModule.ApplicationModulesManager.FirstAsync(_ => _.module == testModule)
     .SelectMany(_ => maps.Select(map => {
         _.manager.Extend(map, configure);
         return(Unit.Default);
     }))
     .Subscribe();
     return(testModule);
 }
Beispiel #2
0
 public static ModelMapperTestModule Extend <T>(this Type extenderType, ModelMapperTestModule testModule = null,
                                                Action <ModelMapperConfiguration> configure = null) where T : IModelNode
 {
     testModule ??= new ModelMapperTestModule();
     testModule.ApplicationModulesManager.FirstAsync()
     .Do(_ => {
         var configuration = new ModelMapperConfiguration(extenderType, typeof(T));
         configure?.Invoke(configuration);
         _.manager.Extend(configuration);
     })
     .Subscribe();
     return(testModule);
 }
        public void Extend_Multiple_Objects_with_common_types()
        {
            var typeToMap1 = typeof(TestModelMapperCommonType1);
            var typeToMap2 = typeof(TestModelMapperCommonType2);

            InitializeMapperService();

            using var module = new ModelMapperTestModule();
            typeToMap1.Extend <IModelListView>(module);
            typeToMap2.Extend <IModelColumn>(module);

            using var application = DefaultModelMapperModule(Platform.Win, module).Application;
            var appearanceCell = application.Model.GetNodeByPath($@"{MMListViewNodePath}/Columns/Test/{nameof(TestModelMapperCommonType2)}/{nameof(TestModelMapperCommonType2.AppearanceCell)}");

            appearanceCell.ShouldNotBeNull();
            appearanceCell.GetNodeByPath($"{nameof(AppearanceObjectEx.TextOptions)}");
        }
Beispiel #4
0
 public static ModelMapperTestModule Extend(this PredefinedMap map, ModelMapperTestModule testModule = null, Action <ModelMapperConfiguration> configure = null)
 {
     testModule ??= new ModelMapperTestModule();
     return(new[] { map }.Extend(testModule, configure));
 }