public static string GenerateTestPage(FactoryInformation information) { List <string> Properties = new List <string>(); information.PageFields.RemoveAll(field => field.IsListColumnOnly); TestModel test = new TestModel(information.PageFields, information.Blocks, Properties); test.FormatToListAssignmentFormat(); TestsTemplate testPage = new TestsTemplate(); foreach (var item in information.PropertieModels) { Properties.Add(ModelHelpers.ConvertToPascalCasePattern(item.ColumnName)); } testPage.Session = new Dictionary <string, object>(); testPage.Session.Add("ColumnsNames", test.ToString()); testPage.Session.Add("RequiredFields", test.RequiredFields); testPage.Session.Add("ClassName", information.Page.ClassName); testPage.Session.Add("AllBlocksList", test.AllBlocksList); testPage.Session.Add("ReadWriteUsers", information.Permissions.GetReadWriteUsersString()); testPage.Session.Add("ReadOnlyUsers", information.Permissions.GetReadOnlyUsersString()); testPage.Session.Add("NoReadUsers", information.Permissions.GetNoReadUsersString()); testPage.Session.Add("UsersThatHasAccessToThePage", information.Permissions.GetUsersThatHasAccessToThePagesString()); testPage.Session.Add("EditMethod", test.GenerateEdit()); testPage.Session.Add("AssertMethod", test.GenerateAssert()); testPage.Initialize(); return(testPage.TransformText()); }
public EditPagePropertiesModel(Field field) { ModelHelpers.ValidateFieldProperties(field); PropertieName = ModelHelpers.ConvertToPascalCasePattern(field.Name); FieldName = ModelHelpers.ConvertToPrivateVariablePattern(field.Name); Type = field.Type; DataFieldType = field.DataFieldType; }
public APIFactoryModel(List <APIPropertieModel> propertieModels, string className) { foreach (var item in propertieModels) { Properties.Add(ModelHelpers.ConvertToPascalCasePattern(item.ColumnName)); } _className = className; }
public void GenerateAPIModelPage(List <APIPropertieModel> properties) { var fileName = ModelHelpers.ConvertToPascalCasePattern(Informations.Page.MenuName.ToUpper()); var classModel = new APIClassModel(Informations.Page.ComponentKey.ToUpper(), Informations.Page.ClassName); Informations.APIClass = classModel; string pathToRecordFile = outputFolderPath + $"{fileName}.cs"; string pathToRecorAPIFactory = outputFolderPath + $"{fileName}Factory.cs"; CreateOutputDirectoryIfDoesNotExist(); File.WriteAllText(pathToRecordFile, APIModelsFactory.Generate(Informations)); File.WriteAllText(pathToRecorAPIFactory, APIFactoryFactory.Generate(Informations)); }
public TestModel(List <Field> fields, List <Block> blocks, List <string> Properties) { foreach (var item in fields) { this.fields.Add(ModelHelpers.ConvertToPascalCasePattern(item.Name)); } this.Properties = Properties; fields.ForEach(field => ColumnsNames.Add(field.NameDisplayedInMibPage)); fields.ForEach((Action <Field>)(field => { if (field.IsRequired) { this._requiredFields.Add(field.NameDisplayedInMibPage); } })); blocks.ForEach((Action <Block>)(block => { this._allBlocksList.Add(block.Name); })); }
public APIPropertieModel(string columnName, string propertieType) { this.ColumnName = columnName; this.PropertieType = propertieType; this._propertieName = ModelHelpers.ConvertToPascalCasePattern(ColumnName); }