internal void Do_not_throw_if_target_object_properties_do_not_exist(Platform platform) { Type typeToMap = typeof(StringValueTypeProperties); InitializeMapperService($"{nameof(Do_not_throw_if_target_object_properties_do_not_exist)}{typeToMap.Name}{platform}"); typeToMap.Extend <IModelListView>(); var application = DefaultModelMapperModule(platform).Application; var modelListView = application.Model.Views.OfType <IModelListView>().First(); var mapName = typeToMap.ModelMapName(); var modelModelMap = (IModelModelMap)modelListView.GetNode(mapName); modelModelMap.Index = 100; var stringValueTypeProperties = new StringValueTypeProperties(); modelModelMap.BindTo(stringValueTypeProperties); }
internal void Bind_all_public_rw_string_properties(Platform platform) { Type typeToMap = typeof(StringValueTypeProperties); InitializeMapperService($"{nameof(Bind_all_public_rw_string_properties)}{typeToMap.Name}{platform}"); typeToMap.Extend <IModelListView>(); var application = DefaultModelMapperModule(platform).Application; var modelListView = application.Model.Views.OfType <IModelListView>().First(); var mapName = typeToMap.ModelMapName(); var modelModelMap = (IModelModelMap)modelListView.GetNode(mapName); modelModelMap.SetValue(nameof(StringValueTypeProperties.RWString), "test"); var stringValueTypeProperties = new StringValueTypeProperties(); modelModelMap.BindTo(stringValueTypeProperties); stringValueTypeProperties.RWString.ShouldBe("test"); }
internal void Bind_Only_NullAble_Properties_That_are_not_Null(Platform platform) { var typeToMap = typeof(StringValueTypeProperties); InitializeMapperService($"{nameof(Bind_Only_NullAble_Properties_That_are_not_Null)}{typeToMap.Name}{platform}"); typeToMap.Extend <IModelListView>(); var application = DefaultModelMapperModule(platform).Application; var modelListView = application.Model.Views.OfType <IModelListView>().First(); var mapName = typeToMap.ModelMapName(); var modelModelMap = (IModelModelMap)modelListView.GetNode(mapName); modelModelMap.SetValue(nameof(StringValueTypeProperties.RWInteger), 100); var stringValueTypeProperties = new StringValueTypeProperties { RWString = "shouldnotchange" }; modelModelMap.BindTo(stringValueTypeProperties); stringValueTypeProperties.RWInteger.ShouldBe(100); stringValueTypeProperties.RWString.ShouldBe("shouldnotchange"); }