Exemplo n.º 1
0
        public static StringFieldOptions Create(TextFieldAttribute textFieldAttribute, StringLengthAttribute stringLengthAttr, RichTextAttribute richTextAttr)
        {
            var result = new StringFieldOptions();
            if (textFieldAttribute != null)
            {
                result.Mask = textFieldAttribute.Mask;
                result.MaskType = textFieldAttribute.MaskType;
                result.NumberOfCharacters = textFieldAttribute.NumberOfCharacters;
                result.NumberOfRows = textFieldAttribute.NumberOfRows;
            }

            if (stringLengthAttr == null)
            {
                result.MinimumLength = 0;
                result.MinimumLength = 999999999;
            }
            else
            {
                result.MaximumLength = stringLengthAttr.MaximumLength;
                result.MinimumLength = stringLengthAttr.MinimumLength;
                result.ErrorMessage = stringLengthAttr.ErrorMessage;
            }

            if (richTextAttr != null)
            {
                result.IsRichText = true;
            }

            return result;
        }
Exemplo n.º 2
0
        public void Ctor()
        {
            // arrange, act
            var attribute = new TextFieldAttribute(1, "any mask", "standart", 50);

            // assert
            Assert.AreEqual(1, attribute.NumberOfRows);
            Assert.AreEqual("any mask", attribute.Mask);
            Assert.AreEqual("standart", attribute.MaskType);
            Assert.AreEqual(50, attribute.NumberOfCharacters);
        }
 /// <summary>
 /// Gets the text field vm.
 /// </summary>
 /// <param name="prop">The property.</param>
 /// <param name="model">The model.</param>
 /// <param name="textAttr">The text attribute.</param>
 /// <param name="promptAttr">The prompt attribute.</param>
 /// <param name="display">The display.</param>
 /// <param name="fieldEditorAttr">The field editor attribute.</param>
 /// <returns></returns>
 private TextFieldViewModel GetTextFieldVM(PropertyInfo prop, IEditableRoot model, TextFieldAttribute textAttr, PromptAttribute promptAttr, DisplayAttribute display, FieldEditorAttribute fieldEditorAttr)
 {
     var vm = TextFieldViewModelFactory.CreateExport().Value;
     vm.NumberOfRows = textAttr.NumberOfRows;
     vm.Mask = textAttr.Mask;
     vm.MaskType = textAttr.MaskType;
     vm.MaxLength = textAttr.NumberOfCharacters;
     SetupField(prop, promptAttr, display, vm, model);
     vm.FieldType = GetFieldEditor(prop, fieldEditorAttr);
     return vm;
 }