private void OpenRegularExpressionEdition(IEntity entity) { var regularExpression = entity as IRegularExpression; var entityValidator = EntityService.GetEntityValidator(MetaRegularExpression); if (regularExpression == null) { regularExpression = MetaDataService.InitializeRegularExpression(MetaRegularExpression); } var entityItemViewModels = new Dictionary <IEntityMetaField, List <IEntityItemViewModel> >(); var metaField = (IEntityMetaField) EntityService.GetMetaField <IEntity>(MetaRegularExpression, nameof(IRegularExpression.CreationUser)); var mdUserItemViewModels = new List <IEntityItemViewModel> { MdUserItemViewModel.Create(regularExpression.CreationUser) }; entityItemViewModels.Add(metaField, mdUserItemViewModels); metaField = (IEntityMetaField) EntityService.GetMetaField <IEntity>(MetaRegularExpression, nameof(IRegularExpression.LastUpdateUser)); mdUserItemViewModels = new List <IEntityItemViewModel> { MdUserItemViewModel.Create(regularExpression.LastUpdateUser) }; entityItemViewModels.Add(metaField, mdUserItemViewModels); Panels.Add(EntityEditionPanelViewModel.Create(ValidateRegularExpression, DeleteRegularExpressions, entityValidator, regularExpression, entityItemViewModels)); SetFocusOnSelectedPanel(); }
public void TestInitializeRegularExpression() { var metaDataService = new MetaDataService(); var metaEntity = Repository.MetaEntities.First(); var regularExpression = metaDataService.InitializeRegularExpression(metaEntity); Assert.NotNull(regularExpression); Assert.AreEqual(INTEGER_DEFAULT_VALUE, regularExpression.Id); Assert.AreEqual(STRING_DEFAULT_VALUE, regularExpression.Label); }