diff --git a/QuestionsProperties.xlsx b/QuestionsProperties.xlsx new file mode 100644 index 0000000..5fca10c Binary files /dev/null and b/QuestionsProperties.xlsx differ diff --git a/src/SurveyExtensions/Builders/BooleanQuestionBuilder.cs b/src/SurveyExtensions/Builders/BooleanQuestionBuilder.cs new file mode 100644 index 0000000..e7fc8b5 --- /dev/null +++ b/src/SurveyExtensions/Builders/BooleanQuestionBuilder.cs @@ -0,0 +1,64 @@ +namespace SurveyExtensions.Builders +{ + using Elements; + using SurveyExtensions.Elements.Questions; + + public class BooleanQuestionBuilder : + QuestionBuilderBase, + IBuilder where TEntity : new() + { + + public BooleanQuestionBuilder HasName(string value) + { + _item.Name = value; + return this; + } + public BooleanQuestionBuilder HasTitle(string value) + { + _item.Title = value; + return this; + } + + public BooleanQuestionBuilder HasDescription(string value) + { + _item.Description = value; + return this; + } + + public BooleanQuestionBuilder IsRequired() + { + _item.IsRequired = true; + return this; + } + + public BooleanQuestionBuilder IsHidden() + { + _item.Visible = false; + return this; + } + + public BooleanQuestionBuilder ContinueInSameLine() + { + _item.StartWithNewLine = false; + return this; + } + + public BooleanQuestionBuilder HasLabel(string label) + { + _item.Label = label; + return this; + } + + public BooleanQuestionBuilder HasLabelTrue(string labelTrue) + { + _item.LabelTrue = labelTrue; + return this; + } + + public BooleanQuestionBuilder HasLabelFalse(string labelFalse) + { + _item.LabelFalse = labelFalse; + return this; + } + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Builders/CheckboxQuestionBuilder.cs b/src/SurveyExtensions/Builders/CheckboxQuestionBuilder.cs new file mode 100644 index 0000000..4a24712 --- /dev/null +++ b/src/SurveyExtensions/Builders/CheckboxQuestionBuilder.cs @@ -0,0 +1,94 @@ +namespace SurveyExtensions.Builders +{ + using System; + using Elements; + using SurveyExtensions.Elements.QuestionElements; + using SurveyExtensions.Elements.Questions; + using SurveyExtensions.Enums; + + public class CheckboxQuestionBuilder : + QuestionBuilderBase, + IBuilder where TEntity : new() + { + + public CheckboxQuestionBuilder HasName(string value) + { + _item.Name = value; + return this; + } + public CheckboxQuestionBuilder HasTitle(string value) + { + _item.Title = value; + return this; + } + + public CheckboxQuestionBuilder HasDescription(string value) + { + _item.Description = value; + return this; + } + + public CheckboxQuestionBuilder IsRequired() + { + _item.IsRequired = true; + return this; + } + + public CheckboxQuestionBuilder IsHidden() + { + _item.Visible = false; + return this; + } + + public CheckboxQuestionBuilder ContinueInSameLine() + { + _item.StartWithNewLine = false; + return this; + } + + public CheckboxQuestionBuilder HasColumnCount(int value) + { + _item.ColCount = value; + return this; + } + + public CheckboxQuestionBuilder SetChoicesOrder(ChoicesOrderOprions order) + { + string enumName = Enum.GetName(typeof(ChoicesOrderOprions), order); + if (enumName != null) + { + _item.ChoicesOrder = enumName.ToLowerInvariant(); + } + + return this; + } + + public CheckboxQuestionBuilder HasOtherChoice(string choiceText) + { + _item.OtherText = choiceText; + _item.HasNone = true; + return this; + } + + public CheckboxQuestionBuilder HasSelectAllChoice(string choiceText) + { + _item.HasSelectAll = true; + _item.SelectAllText = choiceText; + return this; + } + + public CheckboxQuestionBuilder HasSelectNoneChoice(string choiceText) + { + _item.HasNone = true; + _item.NoneText = choiceText; + return this; + } + + public CheckboxQuestionBuilder AddChoice(string choiceValue, string choiceText) + { + _item.Choices.Add(new Choice() { Value = choiceValue, Text = choiceText }); + return this; + } + + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Builders/CommentQuestionBuilder.cs b/src/SurveyExtensions/Builders/CommentQuestionBuilder.cs new file mode 100644 index 0000000..032c02e --- /dev/null +++ b/src/SurveyExtensions/Builders/CommentQuestionBuilder.cs @@ -0,0 +1,59 @@ +namespace SurveyExtensions.Builders +{ + using System; + using Elements; + using SurveyExtensions.Elements.Questions; + + public class CommentQuestionBuilder : + QuestionBuilderBase, + IBuilder where TEntity : new() + { + + public CommentQuestionBuilder HasName(string value) + { + _item.Name = value; + return this; + } + public CommentQuestionBuilder HasTitle(string value) + { + _item.Title = value; + return this; + } + + public CommentQuestionBuilder HasDescription(string value) + { + _item.Description = value; + return this; + } + + public CommentQuestionBuilder IsRequired() + { + _item.IsRequired = true; + return this; + } + + public CommentQuestionBuilder IsHidden() + { + _item.Visible = false; + return this; + } + + public CommentQuestionBuilder ContinueInSameLine() + { + _item.StartWithNewLine = false; + return this; + } + + public CommentQuestionBuilder HasPlaceHolder(string placeholder) + { + _item.PlaceHolder = placeholder; + return this; + } + + public CommentQuestionBuilder HasRows(int rows) + { + _item.Rows = rows; + return this; + } + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Builders/DropdownQuestionBuilder.cs b/src/SurveyExtensions/Builders/DropdownQuestionBuilder.cs new file mode 100644 index 0000000..4484fd7 --- /dev/null +++ b/src/SurveyExtensions/Builders/DropdownQuestionBuilder.cs @@ -0,0 +1,81 @@ +namespace SurveyExtensions.Builders +{ + using System; + using Elements; + using SurveyExtensions.Elements.QuestionElements; + using SurveyExtensions.Elements.Questions; + using SurveyExtensions.Enums; + + public class DropdownQuestionBuilder : + QuestionBuilderBase, + IBuilder where TEntity : new() + { + + public DropdownQuestionBuilder HasName(string value) + { + _item.Name = value; + return this; + } + public DropdownQuestionBuilder HasTitle(string value) + { + _item.Title = value; + return this; + } + + public DropdownQuestionBuilder HasDescription(string value) + { + _item.Description = value; + return this; + } + + public DropdownQuestionBuilder IsRequired() + { + _item.IsRequired = true; + return this; + } + + public DropdownQuestionBuilder IsHidden() + { + _item.Visible = false; + return this; + } + + public DropdownQuestionBuilder ContinueInSameLine() + { + _item.StartWithNewLine = false; + return this; + } + + public DropdownQuestionBuilder SetChoicesOrder(ChoicesOrderOprions order) + { + string enumName = Enum.GetName(typeof(ChoicesOrderOprions), order); + if (enumName != null) + { + _item.ChoicesOrder = enumName.ToLowerInvariant(); + } + + return this; + } + + public DropdownQuestionBuilder HasOtherChoice(string choiceText) + { + _item.HasOther = true; + _item.OtherText = choiceText; + return this; + } + + public DropdownQuestionBuilder AddChoice(string choiceValue, string choiceText) + { + _item.Choices.Add(new Choice() { Value = choiceValue, Text = choiceText }); + return this; + } + + public DropdownQuestionBuilder AutoChoices(int minChoice, int maxChoice, int choiceStep) + { + _item.ChoicesMin = minChoice; + _item.ChoicesMax = maxChoice; + _item.ChoicesStep = choiceStep; + return this; + } + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Builders/FileQuestionBuilder.cs b/src/SurveyExtensions/Builders/FileQuestionBuilder.cs new file mode 100644 index 0000000..48c02f4 --- /dev/null +++ b/src/SurveyExtensions/Builders/FileQuestionBuilder.cs @@ -0,0 +1,37 @@ +namespace SurveyExtensions.Builders +{ + using System; + using Elements; + using SurveyExtensions.Elements.Questions; + + public class FileQuestionBuilder : + QuestionBuilderBase, + IBuilder where TEntity : new() + { + + public FileQuestionBuilder HasName(string value) + { + _item.Name = value; + return this; + } + + public FileQuestionBuilder IsHidden() + { + _item.Visible = false; + return this; + } + + public FileQuestionBuilder ContinueInSameLine() + { + _item.StartWithNewLine = false; + return this; + } + + public FileQuestionBuilder HasMaxSize(int maxSize) + { + _item.MaxSize = maxSize; + return this; + } + + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Builders/HtmlEditorQuestionBuilder.cs b/src/SurveyExtensions/Builders/HtmlEditorQuestionBuilder.cs new file mode 100644 index 0000000..760e5e3 --- /dev/null +++ b/src/SurveyExtensions/Builders/HtmlEditorQuestionBuilder.cs @@ -0,0 +1,37 @@ +namespace SurveyExtensions.Builders +{ + using System; + using Elements; + using SurveyExtensions.Elements.Questions; + + public class HtmlEditorQuestionBuilder : + QuestionBuilderBase, + IBuilder where TEntity : new() + { + + public HtmlEditorQuestionBuilder HasName(string value) + { + _item.Name = value; + return this; + } + + public HtmlEditorQuestionBuilder IsHidden() + { + _item.Visible = false; + return this; + } + + public HtmlEditorQuestionBuilder ContinueInSameLine() + { + _item.StartWithNewLine = false; + return this; + } + + public HtmlEditorQuestionBuilder HasHtml(string html) + { + _item.Html = html; + return this; + } + + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Builders/ImagePickerQuestionBuilder.cs b/src/SurveyExtensions/Builders/ImagePickerQuestionBuilder.cs new file mode 100644 index 0000000..dec797e --- /dev/null +++ b/src/SurveyExtensions/Builders/ImagePickerQuestionBuilder.cs @@ -0,0 +1,80 @@ +namespace SurveyExtensions.Builders +{ + using System; + using Elements; + using SurveyExtensions.Elements.QuestionElements; + using SurveyExtensions.Elements.Questions; + using SurveyExtensions.Enums; + + public class ImagePickerQuestionBuilder : + QuestionBuilderBase, + IBuilder where TEntity : new() + { + + public ImagePickerQuestionBuilder HasName(string value) + { + _item.Name = value; + return this; + } + public ImagePickerQuestionBuilder HasTitle(string value) + { + _item.Title = value; + return this; + } + + public ImagePickerQuestionBuilder HasDescription(string value) + { + _item.Description = value; + return this; + } + + public ImagePickerQuestionBuilder IsRequired() + { + _item.IsRequired = true; + return this; + } + + public ImagePickerQuestionBuilder IsHidden() + { + _item.Visible = false; + return this; + } + + public ImagePickerQuestionBuilder ContinueInSameLine() + { + _item.StartWithNewLine = false; + return this; + } + + public ImagePickerQuestionBuilder HasColumnCount(int value) + { + _item.ColCount = value; + return this; + } + + public ImagePickerQuestionBuilder SetChoicesOrder(ChoicesOrderOprions order) + { + string enumName = Enum.GetName(typeof(ChoicesOrderOprions), order); + if (enumName != null) + { + _item.ChoicesOrder = enumName.ToLowerInvariant(); + } + + return this; + } + + + public ImagePickerQuestionBuilder AddChoice(string choiceValue, string choiceText, string imageLink) + { + _item.Choices.Add( + new ImagePickerChoice() + { + Value = choiceValue, + Text = choiceText, + ImageLink = imageLink, + }); + return this; + } + + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Builders/MatrixMultipleChoiceQuestionBuilder.cs b/src/SurveyExtensions/Builders/MatrixMultipleChoiceQuestionBuilder.cs new file mode 100644 index 0000000..f8321e0 --- /dev/null +++ b/src/SurveyExtensions/Builders/MatrixMultipleChoiceQuestionBuilder.cs @@ -0,0 +1,98 @@ +namespace SurveyExtensions.Builders +{ + using System; + using Elements; + using SurveyExtensions.Elements.QuestionElements; + using SurveyExtensions.Elements.Questions; + using SurveyExtensions.Enums; + + public class MatrixMultipleChoiceQuestionBuilder : + QuestionBuilderBase, + IBuilder where TEntity : new() + { + + public MatrixMultipleChoiceQuestionBuilder HasName(string value) + { + _item.Name = value; + return this; + } + public MatrixMultipleChoiceQuestionBuilder HasTitle(string value) + { + _item.Title = value; + return this; + } + + public MatrixMultipleChoiceQuestionBuilder HasDescription(string value) + { + _item.Description = value; + return this; + } + + public MatrixMultipleChoiceQuestionBuilder IsRequired() + { + _item.IsRequired = true; + return this; + } + + public MatrixMultipleChoiceQuestionBuilder IsHidden() + { + _item.Visible = false; + return this; + } + + public MatrixMultipleChoiceQuestionBuilder ContinueInSameLine() + { + _item.StartWithNewLine = false; + return this; + } + + public MatrixMultipleChoiceQuestionBuilder HasTotalText(string value) + { + _item.TotalText= value; + return this; + } + + public MatrixMultipleChoiceQuestionBuilder HasCellType(CellTypes cellType) + { + string enumName = Enum.GetName(typeof(CellTypes), cellType); + if (enumName != null) + { + _item.CellType = enumName.ToLowerInvariant(); + } + + return this; + } + + public MatrixMultipleChoiceQuestionBuilder AddColumn(string value, string text, CellTypes cellType) + { + string ct = null; + string enumName = Enum.GetName(typeof(CellTypes), cellType); + if (enumName != null) + { + ct = enumName.ToLowerInvariant(); + } + + _item.Columns.Add(new MatrixMultipleChoiceChoice() { Value = value, Text = text, CellType = ct }); + return this; + } + + public MatrixMultipleChoiceQuestionBuilder AddColumn(string value, string text) + { + string ct = null; + _item.Columns.Add(new MatrixMultipleChoiceChoice() { Value = value, Text = text, CellType = ct }); + return this; + } + + public MatrixMultipleChoiceQuestionBuilder AddRow(string value, string text) + { + _item.Rows.Add(new Choice() { Value = value, Text = text }); + return this; + } + + public MatrixMultipleChoiceQuestionBuilder AddChoice(string value, string text) + { + _item.Choices.Add(new Choice() { Value = value, Text = text }); + return this; + } + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Builders/MatrixSingleChoiceQuestionBuilder.cs b/src/SurveyExtensions/Builders/MatrixSingleChoiceQuestionBuilder.cs new file mode 100644 index 0000000..733c8af --- /dev/null +++ b/src/SurveyExtensions/Builders/MatrixSingleChoiceQuestionBuilder.cs @@ -0,0 +1,67 @@ +namespace SurveyExtensions.Builders +{ + using System; + using Elements; + using SurveyExtensions.Elements.QuestionElements; + using SurveyExtensions.Elements.Questions; + using SurveyExtensions.Enums; + + public class MatrixSingleChoiceQuestionBuilder : + QuestionBuilderBase, + IBuilder where TEntity : new() + { + + public MatrixSingleChoiceQuestionBuilder HasName(string value) + { + _item.Name = value; + return this; + } + public MatrixSingleChoiceQuestionBuilder HasTitle(string value) + { + _item.Title = value; + return this; + } + + public MatrixSingleChoiceQuestionBuilder HasDescription(string value) + { + _item.Description = value; + return this; + } + + public MatrixSingleChoiceQuestionBuilder IsRequired() + { + _item.IsRequired = true; + return this; + } + + public MatrixSingleChoiceQuestionBuilder IsHidden() + { + _item.Visible = false; + return this; + } + + public MatrixSingleChoiceQuestionBuilder ContinueInSameLine() + { + _item.StartWithNewLine = false; + return this; + } + + public MatrixSingleChoiceQuestionBuilder SetIsAllRowRequired() + { + _item.IsAllRowRequired = true; + return this; + } + + public MatrixSingleChoiceQuestionBuilder AddColumn(string value, string text) + { + _item.Columns.Add(new Choice() { Value = value, Text = text }); + return this; + } + public MatrixSingleChoiceQuestionBuilder AddRow(string value, string text) + { + _item.Rows.Add(new Choice() { Value = value, Text = text }); + return this; + } + + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Builders/MultipleTextQuestionBuilder.cs b/src/SurveyExtensions/Builders/MultipleTextQuestionBuilder.cs new file mode 100644 index 0000000..050e39b --- /dev/null +++ b/src/SurveyExtensions/Builders/MultipleTextQuestionBuilder.cs @@ -0,0 +1,60 @@ +namespace SurveyExtensions.Builders +{ + using System; + using Elements; + using SurveyExtensions.Elements.Questions; + using SurveyExtensions.Enums; + + public class MultipleTextQuestionBuilder : + QuestionBuilderBase, + IBuilder where TEntity : new() + { + public MultipleTextQuestionBuilder HasName(string value) + { + _item.Name = value; + return this; + } + public MultipleTextQuestionBuilder HasTitle(string value) + { + _item.Title = value; + return this; + } + + public MultipleTextQuestionBuilder HasDescription(string value) + { + _item.Description = value; + return this; + } + + public MultipleTextQuestionBuilder IsRequired() + { + _item.IsRequired = true; + return this; + } + + public MultipleTextQuestionBuilder IsHidden() + { + _item.Visible = false; + return this; + } + + public MultipleTextQuestionBuilder ContinueInSameLine() + { + _item.StartWithNewLine = false; + return this; + } + + public MultipleTextQuestionBuilder HasColumnCount(int value) + { + _item.ColCount = value; + return this; + } + + + public MultipleTextQuestionBuilder AddItem(string text) + { + _item.Items.Add(new Elements.QuestionElements.MultiTextItem() { Name = text }); + return this; + } + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Builders/PageBuilder.cs b/src/SurveyExtensions/Builders/PageBuilder.cs new file mode 100644 index 0000000..c49546b --- /dev/null +++ b/src/SurveyExtensions/Builders/PageBuilder.cs @@ -0,0 +1,183 @@ +namespace SurveyExtensions.Builders +{ + using System; + using System.Collections.Generic; + using System.Linq.Expressions; + using Elements; + using Helpers; + using SurveyExtensions.Enums; + + public class PageBuilder: IBuilder where TEntity : new() + { + private SurveyPage _item = new SurveyPage(); + private List> elementsBuilder = new List>(); + + public PageBuilder HasName(string name) + { + _item.Name = name; + return this; + } + + public PageBuilder AddSingleInputQuestion(Expression> expression, Action> inputBuilder) + { + TEntity mEntity = new TEntity(); + var myProperty = ReflectionHelpers.GetPropertyInfo(mEntity, expression); + var builder = new SimgleItemQuestionBuilder(); + inputBuilder.Invoke(builder); + builder.HasName(myProperty.Name); + elementsBuilder.Add(builder); + return this; + } + + public PageBuilder AddCommentInput(Expression> expression, Action> commentBuilder) + { + TEntity mEntity = new TEntity(); + var myProperty = ReflectionHelpers.GetPropertyInfo(mEntity, expression); + var builder = new CommentQuestionBuilder(); + commentBuilder.Invoke(builder); + builder.HasName(myProperty.Name); + elementsBuilder.Add(builder); + return this; + } + + public PageBuilder AddCheckboxInput(Expression> expression, Action> checkboxBuilder) + { + TEntity mEntity = new TEntity(); + var myProperty = ReflectionHelpers.GetPropertyInfo(mEntity, expression); + var builder = new CheckboxQuestionBuilder(); + checkboxBuilder.Invoke(builder); + builder.HasName(myProperty.Name); + elementsBuilder.Add(builder); + return this; + } + + public PageBuilder AddRadiogroup(Expression> expression, Action> radiogroupBuilder) + { + TEntity mEntity = new TEntity(); + var myProperty = ReflectionHelpers.GetPropertyInfo(mEntity, expression); + var builder = new RadiogroupQuestionBuilder(); + radiogroupBuilder.Invoke(builder); + builder.HasName(myProperty.Name); + elementsBuilder.Add(builder); + return this; + } + + public PageBuilder AddDropdown(Expression> expression, Action> dropDownBuilder) + { + TEntity mEntity = new TEntity(); + var myProperty = ReflectionHelpers.GetPropertyInfo(mEntity, expression); + var builder = new DropdownQuestionBuilder(); + dropDownBuilder.Invoke(builder); + builder.HasName(myProperty.Name); + elementsBuilder.Add(builder); + return this; + } + + public PageBuilder AddRating(Expression> expression, Action> ratingBuilder) + { + TEntity mEntity = new TEntity(); + var myProperty = ReflectionHelpers.GetPropertyInfo(mEntity, expression); + var builder = new RatingQuestionBuilder(); + ratingBuilder.Invoke(builder); + builder.HasName(myProperty.Name); + elementsBuilder.Add(builder); + return this; + } + + public PageBuilder AddImagePickerInput(Expression> expression, Action> imagePickerBuilder) + { + TEntity mEntity = new TEntity(); + var myProperty = ReflectionHelpers.GetPropertyInfo(mEntity, expression); + var builder = new ImagePickerQuestionBuilder(); + imagePickerBuilder.Invoke(builder); + builder.HasName(myProperty.Name); + elementsBuilder.Add(builder); + return this; + } + + public PageBuilder AddBooleanInput(Expression> expression, Action> booleanBuilder) + { + TEntity mEntity = new TEntity(); + var myProperty = ReflectionHelpers.GetPropertyInfo(mEntity, expression); + var builder = new BooleanQuestionBuilder(); + booleanBuilder.Invoke(builder); + builder.HasName(myProperty.Name); + elementsBuilder.Add(builder); + return this; + } + + public PageBuilder AddHtmlEditor(Expression> expression, Action> htmlEditorBuilder) + { + TEntity mEntity = new TEntity(); + var myProperty = ReflectionHelpers.GetPropertyInfo(mEntity, expression); + var builder = new HtmlEditorQuestionBuilder(); + htmlEditorBuilder.Invoke(builder); + builder.HasName(myProperty.Name); + elementsBuilder.Add(builder); + return this; + } + + public PageBuilder AddFile(Expression> expression, Action> fileBuilder) + { + TEntity mEntity = new TEntity(); + var myProperty = ReflectionHelpers.GetPropertyInfo(mEntity, expression); + var builder = new FileQuestionBuilder(); + fileBuilder.Invoke(builder); + builder.HasName(myProperty.Name); + elementsBuilder.Add(builder); + return this; + } + + public PageBuilder AddMatrixSingleChoice(Expression> expression, Action> matrixSingleChoiceQuestionBuilder) + { + TEntity mEntity = new TEntity(); + var myProperty = ReflectionHelpers.GetPropertyInfo(mEntity, expression); + var builder = new MatrixSingleChoiceQuestionBuilder(); + matrixSingleChoiceQuestionBuilder.Invoke(builder); + builder.HasName(myProperty.Name); + elementsBuilder.Add(builder); + return this; + } + + public PageBuilder AddMatrixMutipleChoice(Expression> expression, Action> matrixMutipleChoiceQuestionBuilder) + { + TEntity mEntity = new TEntity(); + var myProperty = ReflectionHelpers.GetPropertyInfo(mEntity, expression); + var builder = new MatrixMultipleChoiceQuestionBuilder(); + matrixMutipleChoiceQuestionBuilder.Invoke(builder); + builder.HasName(myProperty.Name); + elementsBuilder.Add(builder); + return this; + } + + public PageBuilder AddMultipleText(Expression> expression, Action> multipleTextQuestionBuilder) + { + TEntity mEntity = new TEntity(); + var myProperty = ReflectionHelpers.GetPropertyInfo(mEntity, expression); + var builder = new MultipleTextQuestionBuilder(); + multipleTextQuestionBuilder.Invoke(builder); + builder.HasName(myProperty.Name); + elementsBuilder.Add(builder); + return this; + } + + public PageBuilder AddPanel(string name,Action> panelBuilder) + { + var builder = new PanelBuilder(); + panelBuilder.Invoke(builder); + builder.HasName(name); + elementsBuilder.Add(builder); + return this; + } + + + public SurveyPage Build() + { + foreach (var surveyItemBuilder in elementsBuilder) + { + _item.Elements.Add(surveyItemBuilder.Build()); + } + return _item; + } + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Builders/PanelBuilder.cs b/src/SurveyExtensions/Builders/PanelBuilder.cs new file mode 100644 index 0000000..4f4c4f1 --- /dev/null +++ b/src/SurveyExtensions/Builders/PanelBuilder.cs @@ -0,0 +1,174 @@ +namespace SurveyExtensions.Builders +{ + using System; + using System.Collections.Generic; + using System.Linq.Expressions; + using Elements; + using Helpers; + using SurveyExtensions.Enums; + + public class PanelBuilder: + IBuilder where TEntity : new() + { + private SurveyPanel _item = new SurveyPanel(); + private List> elementsBuilder = new List>(); + + public PanelBuilder HasName(string name) + { + _item.Name = name; + return this; + } + + public PanelBuilder AddSingleInputQuestion(Expression> expression, Action> inputBuilder) + { + TEntity mEntity = new TEntity(); + var myProperty = ReflectionHelpers.GetPropertyInfo(mEntity, expression); + var builder = new SimgleItemQuestionBuilder(); + inputBuilder.Invoke(builder); + builder.HasName(myProperty.Name); + elementsBuilder.Add(builder); + return this; + } + + public PanelBuilder AddCommentInput(Expression> expression, Action> commentBuilder) + { + TEntity mEntity = new TEntity(); + var myProperty = ReflectionHelpers.GetPropertyInfo(mEntity, expression); + var builder = new CommentQuestionBuilder(); + commentBuilder.Invoke(builder); + builder.HasName(myProperty.Name); + elementsBuilder.Add(builder); + return this; + } + + public PanelBuilder AddCheckboxInput(Expression> expression, Action> checkboxBuilder) + { + TEntity mEntity = new TEntity(); + var myProperty = ReflectionHelpers.GetPropertyInfo(mEntity, expression); + var builder = new CheckboxQuestionBuilder(); + checkboxBuilder.Invoke(builder); + builder.HasName(myProperty.Name); + elementsBuilder.Add(builder); + return this; + } + + public PanelBuilder AddRadiogroup(Expression> expression, Action> radiogroupBuilder) + { + TEntity mEntity = new TEntity(); + var myProperty = ReflectionHelpers.GetPropertyInfo(mEntity, expression); + var builder = new RadiogroupQuestionBuilder(); + radiogroupBuilder.Invoke(builder); + builder.HasName(myProperty.Name); + elementsBuilder.Add(builder); + return this; + } + + public PanelBuilder AddDropdown(Expression> expression, Action> dropDownBuilder) + { + TEntity mEntity = new TEntity(); + var myProperty = ReflectionHelpers.GetPropertyInfo(mEntity, expression); + var builder = new DropdownQuestionBuilder(); + dropDownBuilder.Invoke(builder); + builder.HasName(myProperty.Name); + elementsBuilder.Add(builder); + return this; + } + + public PanelBuilder AddRating(Expression> expression, Action> ratingBuilder) + { + TEntity mEntity = new TEntity(); + var myProperty = ReflectionHelpers.GetPropertyInfo(mEntity, expression); + var builder = new RatingQuestionBuilder(); + ratingBuilder.Invoke(builder); + builder.HasName(myProperty.Name); + elementsBuilder.Add(builder); + return this; + } + + public PanelBuilder AddImagePickerInput(Expression> expression, Action> imagePickerBuilder) + { + TEntity mEntity = new TEntity(); + var myProperty = ReflectionHelpers.GetPropertyInfo(mEntity, expression); + var builder = new ImagePickerQuestionBuilder(); + imagePickerBuilder.Invoke(builder); + builder.HasName(myProperty.Name); + elementsBuilder.Add(builder); + return this; + } + + public PanelBuilder AddBooleanInput(Expression> expression, Action> booleanBuilder) + { + TEntity mEntity = new TEntity(); + var myProperty = ReflectionHelpers.GetPropertyInfo(mEntity, expression); + var builder = new BooleanQuestionBuilder(); + booleanBuilder.Invoke(builder); + builder.HasName(myProperty.Name); + elementsBuilder.Add(builder); + return this; + } + + public PanelBuilder AddHtmlEditor(Expression> expression, Action> htmlEditorBuilder) + { + TEntity mEntity = new TEntity(); + var myProperty = ReflectionHelpers.GetPropertyInfo(mEntity, expression); + var builder = new HtmlEditorQuestionBuilder(); + htmlEditorBuilder.Invoke(builder); + builder.HasName(myProperty.Name); + elementsBuilder.Add(builder); + return this; + } + + public PanelBuilder AddFile(Expression> expression, Action> fileBuilder) + { + TEntity mEntity = new TEntity(); + var myProperty = ReflectionHelpers.GetPropertyInfo(mEntity, expression); + var builder = new FileQuestionBuilder(); + fileBuilder.Invoke(builder); + builder.HasName(myProperty.Name); + elementsBuilder.Add(builder); + return this; + } + + public PanelBuilder AddMatrixSingleChoice(Expression> expression, Action> matrixSingleChoiceQuestionBuilder) + { + TEntity mEntity = new TEntity(); + var myProperty = ReflectionHelpers.GetPropertyInfo(mEntity, expression); + var builder = new MatrixSingleChoiceQuestionBuilder(); + matrixSingleChoiceQuestionBuilder.Invoke(builder); + builder.HasName(myProperty.Name); + elementsBuilder.Add(builder); + return this; + } + + public PanelBuilder AddMatrixMutipleChoice(Expression> expression, Action> matrixMutipleChoiceQuestionBuilder) + { + TEntity mEntity = new TEntity(); + var myProperty = ReflectionHelpers.GetPropertyInfo(mEntity, expression); + var builder = new MatrixMultipleChoiceQuestionBuilder(); + matrixMutipleChoiceQuestionBuilder.Invoke(builder); + builder.HasName(myProperty.Name); + elementsBuilder.Add(builder); + return this; + } + + public PanelBuilder AddMultipleText(Expression> expression, Action> multipleTextQuestionBuilder) + { + TEntity mEntity = new TEntity(); + var myProperty = ReflectionHelpers.GetPropertyInfo(mEntity, expression); + var builder = new MultipleTextQuestionBuilder(); + multipleTextQuestionBuilder.Invoke(builder); + builder.HasName(myProperty.Name); + elementsBuilder.Add(builder); + return this; + } + + SurveyItem IBuilder.Build() + { + foreach (var surveyItemBuilder in elementsBuilder) + { + _item.Elements.Add(surveyItemBuilder.Build()); + } + return _item; + } + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Builders/QuestionBuilderBase.cs b/src/SurveyExtensions/Builders/QuestionBuilderBase.cs new file mode 100644 index 0000000..56ce3f1 --- /dev/null +++ b/src/SurveyExtensions/Builders/QuestionBuilderBase.cs @@ -0,0 +1,18 @@ +namespace SurveyExtensions.Builders +{ + using System; + using Elements; + using SurveyExtensions.Elements.Questions; + + public abstract class QuestionBuilderBase : IBuilder + where TEntity : new() + where TQuestion : Question + { + protected TQuestion _item = (TQuestion)(Activator.CreateInstance(typeof(TQuestion))); + + public SurveyItem Build() + { + return _item; + } + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Builders/RadiogroupQuestionBuilder.cs b/src/SurveyExtensions/Builders/RadiogroupQuestionBuilder.cs new file mode 100644 index 0000000..cb7f8a1 --- /dev/null +++ b/src/SurveyExtensions/Builders/RadiogroupQuestionBuilder.cs @@ -0,0 +1,79 @@ +namespace SurveyExtensions.Builders +{ + using System; + using Elements; + using SurveyExtensions.Elements.QuestionElements; + using SurveyExtensions.Elements.Questions; + using SurveyExtensions.Enums; + + public class RadiogroupQuestionBuilder : + QuestionBuilderBase, + IBuilder where TEntity : new() + { + + public RadiogroupQuestionBuilder HasName(string value) + { + _item.Name = value; + return this; + } + public RadiogroupQuestionBuilder HasTitle(string value) + { + _item.Title = value; + return this; + } + + public RadiogroupQuestionBuilder HasDescription(string value) + { + _item.Description = value; + return this; + } + + public RadiogroupQuestionBuilder IsRequired() + { + _item.IsRequired = true; + return this; + } + + public RadiogroupQuestionBuilder IsHidden() + { + _item.Visible = false; + return this; + } + + public RadiogroupQuestionBuilder ContinueInSameLine() + { + _item.StartWithNewLine = false; + return this; + } + + public RadiogroupQuestionBuilder HasColumnCount(int value) + { + _item.ColCount = value; + return this; + } + + public RadiogroupQuestionBuilder SetChoicesOrder(ChoicesOrderOprions order) + { + string enumName = Enum.GetName(typeof(ChoicesOrderOprions), order); + if (enumName != null) + { + _item.ChoicesOrder = enumName.ToLowerInvariant(); + } + + return this; + } + + public RadiogroupQuestionBuilder HasOtherChoice(string choiceText) + { + _item.HasOther = true; + _item.OtherText = choiceText; + return this; + } + + public RadiogroupQuestionBuilder AddChoice(string choiceValue, string choiceText) + { + _item.Choices.Add(new Choice() { Value = choiceValue, Text = choiceText }); + return this; + } + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Builders/RatingQuestionBuilder.cs b/src/SurveyExtensions/Builders/RatingQuestionBuilder.cs new file mode 100644 index 0000000..257ea88 --- /dev/null +++ b/src/SurveyExtensions/Builders/RatingQuestionBuilder.cs @@ -0,0 +1,83 @@ +namespace SurveyExtensions.Builders +{ + using Elements; + using SurveyExtensions.Elements.QuestionElements; + using SurveyExtensions.Elements.Questions; + + public class RatingQuestionBuilder : + QuestionBuilderBase, + IBuilder where TEntity : new() + { + + public RatingQuestionBuilder HasName(string value) + { + _item.Name = value; + return this; + } + public RatingQuestionBuilder HasTitle(string value) + { + _item.Title = value; + return this; + } + + public RatingQuestionBuilder HasDescription(string value) + { + _item.Description = value; + return this; + } + + public RatingQuestionBuilder IsRequired() + { + _item.IsRequired = true; + return this; + } + + public RatingQuestionBuilder IsHidden() + { + _item.Visible = false; + return this; + } + + public RatingQuestionBuilder ContinueInSameLine() + { + _item.StartWithNewLine = false; + return this; + } + + public RatingQuestionBuilder HasRateMin(int value) + { + _item.RateMin = value; + return this; + } + + public RatingQuestionBuilder HasRateMax(int value) + { + _item.RateMax = value; + return this; + } + + public RatingQuestionBuilder HasRateStep(int value) + { + _item.RateStep = value; + return this; + } + + public RatingQuestionBuilder AddRateValue(string value, string text) + { + _item.RateValues.Add(new Choice() { Value = value, Text = text}); + return this; + } + + public RatingQuestionBuilder HasMinRateDescription(string value) + { + _item.MinRateDescription = value; + return this; + } + + public RatingQuestionBuilder HasMaxRateDescription(string value) + { + _item.MaxRateDescription = value; + return this; + } + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Builders/SimgleItemQuestionBuilder.cs b/src/SurveyExtensions/Builders/SimgleItemQuestionBuilder.cs new file mode 100644 index 0000000..4f7ce96 --- /dev/null +++ b/src/SurveyExtensions/Builders/SimgleItemQuestionBuilder.cs @@ -0,0 +1,64 @@ +namespace SurveyExtensions.Builders +{ + using System; + using Elements; + using SurveyExtensions.Elements.Questions; + using SurveyExtensions.Enums; + + public class SimgleItemQuestionBuilder : + QuestionBuilderBase, + IBuilder where TEntity : new() + { + public SimgleItemQuestionBuilder HasName(string value) + { + _item.Name = value; + return this; + } + public SimgleItemQuestionBuilder HasTitle(string value) + { + _item.Title = value; + return this; + } + + public SimgleItemQuestionBuilder HasDescription(string value) + { + _item.Description = value; + return this; + } + + public SimgleItemQuestionBuilder IsRequired() + { + _item.IsRequired = true; + return this; + } + + public SimgleItemQuestionBuilder IsHidden() + { + _item.Visible = false; + return this; + } + + public SimgleItemQuestionBuilder ContinueInSameLine() + { + _item.StartWithNewLine = false; + return this; + } + + public SimgleItemQuestionBuilder SetInputType(SingleInputTypes inputType) + { + string enumName = Enum.GetName(typeof(SingleInputTypes) ,inputType); + if (enumName != null) + { + _item.InputType = enumName.ToLowerInvariant(); + } + + return this; + } + + public SimgleItemQuestionBuilder HasPlaceHolder(string placeholder) + { + _item.PlaceHolder = placeholder; + return this; + } + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Builders/SurveyBuilder.cs b/src/SurveyExtensions/Builders/SurveyBuilder.cs index 4bc9a41..9877b3f 100644 --- a/src/SurveyExtensions/Builders/SurveyBuilder.cs +++ b/src/SurveyExtensions/Builders/SurveyBuilder.cs @@ -8,12 +8,12 @@ public class SurveyBuilder where TEntity : new() { private readonly Survey survey = new Survey(); - private readonly List> _pageBuilders = new List>(); + private readonly List> _pageBuilders = new List>(); - public SurveyBuilder AddPage(string pageName, Action> pageBuilder) + public SurveyBuilder AddPage(string pageName, Action> pageBuilder) { - var builder = new SurveyPageBuilder(); + var builder = new PageBuilder(); pageBuilder.Invoke(builder); builder.HasName(pageName); _pageBuilders.Add(builder); diff --git a/src/SurveyExtensions/Builders/SurveyCheckboxItemBuilder.cs b/src/SurveyExtensions/Builders/SurveyCheckboxItemBuilder.cs deleted file mode 100644 index dba5f06..0000000 --- a/src/SurveyExtensions/Builders/SurveyCheckboxItemBuilder.cs +++ /dev/null @@ -1,97 +0,0 @@ -namespace SurveyExtensions.Builders -{ - using System; - using Elements; - - public class SurveyCheckboxItemBuilder : - SurveyItemBuilderBase, - IBuilder where TEntity : new() - { - public SurveyCheckboxItemBuilder() - { - _item.Type = "checkbox"; - } - - public SurveyCheckboxItemBuilder HasName(string value) - { - _item.Name = value; - return this; - } - - public SurveyCheckboxItemBuilder HasTitle(string value) - { - _item.Title = value; - return this; - } - - public SurveyCheckboxItemBuilder HasDescription(string value) - { - _item.Description = value; - return this; - } - - public SurveyCheckboxItemBuilder IsRequired() - { - _item.IsRequired = true; - return this; - } - - public SurveyCheckboxItemBuilder IsNotRequired() - { - _item.IsRequired = false; - return this; - } - - public SurveyCheckboxItemBuilder IsVisible() - { - _item.IsVisible = true; - return this; - } - - public SurveyCheckboxItemBuilder IsNotVisible() - { - _item.IsVisible = false; - return this; - } - - public SurveyCheckboxItemBuilder HasColumnCount(int value) - { - _item.ColCount = value; - return this; - } - - public SurveyCheckboxItemBuilder SetChoicesOrder(SurveyChoicesOrderEnum order) - { - string enumName = Enum.GetName(typeof(SurveyChoicesOrderEnum), order); - if (enumName != null) _item.ChoicesOrder = enumName.ToLowerInvariant(); - return this; - } - - public SurveyCheckboxItemBuilder HasOtherChoice(string choiceText) - { - _item.OtherText = choiceText; - return this; - } - - public SurveyCheckboxItemBuilder HasSelectAllChoice(string choiceText) - { - _item.HasSelectAll = true; - _item.SelectAllText = choiceText; - return this; - } - - public SurveyCheckboxItemBuilder HasSelectNoneChoice(string choiceText) - { - _item.HasNone = true; - _item.NoneText = choiceText; - return this; - } - - public SurveyCheckboxItemBuilder AddChoice(string choiceValue, string choiceText) - { - _item.Choices.Add(new SurveyChoice() { Value = choiceValue, Text = choiceText }); - return this; - } - - } -} \ No newline at end of file diff --git a/src/SurveyExtensions/Builders/SurveyInputItemBuilder.cs b/src/SurveyExtensions/Builders/SurveyInputItemBuilder.cs deleted file mode 100644 index d2ddfa1..0000000 --- a/src/SurveyExtensions/Builders/SurveyInputItemBuilder.cs +++ /dev/null @@ -1,71 +0,0 @@ -namespace SurveyExtensions.Builders -{ - using System; - using Elements; - - public class SurveyInputItemBuilder : - SurveyItemBuilderBase, - IBuilder where TEntity : new() - { - public SurveyInputItemBuilder() - { - _item.Type = "text"; - _item.InputType = "text"; - } - - public SurveyInputItemBuilder HasName(string value) - { - _item.Name = value; - return this; - } - - public SurveyInputItemBuilder HasTitle(string value) - { - _item.Title = value; - return this; - } - - public SurveyInputItemBuilder HasDescription(string value) - { - _item.Description = value; - return this; - } - - public SurveyInputItemBuilder IsRequired() - { - _item.IsRequired = true; - return this; - } - - public SurveyInputItemBuilder IsNotRequired() - { - _item.IsRequired = false; - return this; - } - - public SurveyInputItemBuilder IsVisible() - { - _item.IsVisible = true; - return this; - } - - public SurveyInputItemBuilder IsNotVisible() - { - _item.IsVisible = false; - return this; - } - - public SurveyInputItemBuilder SetInputType(SurveyInputType inputType) - { - string enumName = Enum.GetName(typeof(SurveyInputType) ,inputType); - if (enumName != null) _item.InputType = enumName.ToLowerInvariant(); - return this; - } - - public SurveyInputItemBuilder HasPlaceHolder(string placeholder) - { - _item.PlaceHolder = placeholder; - return this; - } - } -} \ No newline at end of file diff --git a/src/SurveyExtensions/Builders/SurveyItemBuilderBase.cs b/src/SurveyExtensions/Builders/SurveyItemBuilderBase.cs deleted file mode 100644 index fb40798..0000000 --- a/src/SurveyExtensions/Builders/SurveyItemBuilderBase.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace SurveyExtensions.Builders -{ - using System; - using Elements; - - public class SurveyItemBuilderBase : IBuilder - where TEntity : new() - where TItem : SurveyPageElement - { - protected TItem _item = (TItem)(Activator.CreateInstance(typeof(TItem))); - - public SurveyItem Build() - { - return _item; - } - } -} \ No newline at end of file diff --git a/src/SurveyExtensions/Builders/SurveyPageBuilder.cs b/src/SurveyExtensions/Builders/SurveyPageBuilder.cs deleted file mode 100644 index eaacf7d..0000000 --- a/src/SurveyExtensions/Builders/SurveyPageBuilder.cs +++ /dev/null @@ -1,80 +0,0 @@ -namespace SurveyExtensions.Builders -{ - using System; - using System.Collections.Generic; - using System.Linq.Expressions; - using Elements; - using Helpers; - - public class SurveyPageBuilder: IBuilder where TEntity : new() - { - private SurveyPage _item = new SurveyPage(); - private List> elementsBuilder = new List>(); - - public SurveyPageBuilder HasName(string name) - { - _item.Name = name; - return this; - } - - public SurveyPageBuilder AddSingleInput(Expression> expression, Action> inputBuilder) - { - TEntity mEntity = new TEntity(); - var myProperty = ReflectionHelpers.GetPropertyInfo(mEntity, expression); - var builder = new SurveyInputItemBuilder(); - inputBuilder.Invoke(builder); - builder.HasName(myProperty.Name); - elementsBuilder.Add(builder); - return this; - } - - public SurveyPageBuilder AddSingleInput(Expression> expression, string title, string placeholder, SurveyInputType inputType) - { - return AddSingleInput(expression, - x => x.HasTitle(title) - .HasPlaceHolder(placeholder) - .SetInputType(inputType)); - } - - - public SurveyPageBuilder AddCheckboxInput(Expression> expression, Action> checkboxBuilder) - { - TEntity mEntity = new TEntity(); - var myProperty = ReflectionHelpers.GetPropertyInfo(mEntity, expression); - var builder = new SurveyCheckboxItemBuilder(); - checkboxBuilder.Invoke(builder); - builder.HasName(myProperty.Name); - elementsBuilder.Add(builder); - return this; - } - - public SurveyPageBuilder AddCheckboxInput(Expression> expression, string title) - { - return AddCheckboxInput(expression, x => x.HasTitle(title)); - } - - public SurveyPageBuilder AddRadiogroupInput(Expression> expression, Action> radiogroupBuilder) - { - TEntity mEntity = new TEntity(); - var myProperty = ReflectionHelpers.GetPropertyInfo(mEntity, expression); - var builder = new SurveyRadiogroupItemBuilder(); - radiogroupBuilder.Invoke(builder); - builder.HasName(myProperty.Name); - elementsBuilder.Add(builder); - return this; - } - - public SurveyPageBuilder AddRadiogroupInput(Expression> expression, string title) - { - return AddRadiogroupInput(expression, x => x.HasTitle(title)); - } - public SurveyPage Build() - { - foreach (var surveyItemBuilder in elementsBuilder) - { - _item.Elements.Add(surveyItemBuilder.Build()); - } - return _item; - } - } -} \ No newline at end of file diff --git a/src/SurveyExtensions/Builders/SurveyRadiogroupItemBuilder.cs b/src/SurveyExtensions/Builders/SurveyRadiogroupItemBuilder.cs deleted file mode 100644 index bec2f53..0000000 --- a/src/SurveyExtensions/Builders/SurveyRadiogroupItemBuilder.cs +++ /dev/null @@ -1,83 +0,0 @@ -namespace SurveyExtensions.Builders -{ - using System; - using Elements; - - public class SurveyRadiogroupItemBuilder : - SurveyItemBuilderBase, - IBuilder where TEntity : new() - { - public SurveyRadiogroupItemBuilder() - { - _item.Type = "radiogroup"; - } - - public SurveyRadiogroupItemBuilder HasName(string value) - { - _item.Name = value; - return this; - } - - public SurveyRadiogroupItemBuilder HasTitle(string value) - { - _item.Title = value; - return this; - } - - public SurveyRadiogroupItemBuilder HasDescription(string value) - { - _item.Description = value; - return this; - } - - public SurveyRadiogroupItemBuilder IsRequired() - { - _item.IsRequired = true; - return this; - } - - public SurveyRadiogroupItemBuilder IsNotRequired() - { - _item.IsRequired = false; - return this; - } - - public SurveyRadiogroupItemBuilder IsVisible() - { - _item.IsVisible = true; - return this; - } - - public SurveyRadiogroupItemBuilder IsNotVisible() - { - _item.IsVisible = false; - return this; - } - - public SurveyRadiogroupItemBuilder HasColumnCount(int value) - { - _item.ColCount = value; - return this; - } - - public SurveyRadiogroupItemBuilder SetChoicesOrder(SurveyChoicesOrderEnum order) - { - string enumName = Enum.GetName(typeof(SurveyChoicesOrderEnum), order); - if (enumName != null) _item.ChoicesOrder = enumName.ToLowerInvariant(); - return this; - } - - public SurveyRadiogroupItemBuilder HasOtherChoice(string choiceText) - { - _item.HasOther = true; - _item.OtherText = choiceText; - return this; - } - - public SurveyRadiogroupItemBuilder AddChoice(string choiceValue, string choiceText) - { - _item.Choices.Add(new SurveyChoice() { Value = choiceValue, Text = choiceText }); - return this; - } - } -} \ No newline at end of file diff --git a/src/SurveyExtensions/Elements/SurveyChoice.cs b/src/SurveyExtensions/Elements/QuestionElements/Choice.cs similarity index 56% rename from src/SurveyExtensions/Elements/SurveyChoice.cs rename to src/SurveyExtensions/Elements/QuestionElements/Choice.cs index 3ea9a10..840c57e 100644 --- a/src/SurveyExtensions/Elements/SurveyChoice.cs +++ b/src/SurveyExtensions/Elements/QuestionElements/Choice.cs @@ -1,6 +1,6 @@ -namespace SurveyExtensions.Elements +namespace SurveyExtensions.Elements.QuestionElements { - public class SurveyChoice + public class Choice { public string Value { get; set; } diff --git a/src/SurveyExtensions/Elements/QuestionElements/ImagePickerChoice.cs b/src/SurveyExtensions/Elements/QuestionElements/ImagePickerChoice.cs new file mode 100644 index 0000000..87f0997 --- /dev/null +++ b/src/SurveyExtensions/Elements/QuestionElements/ImagePickerChoice.cs @@ -0,0 +1,8 @@ +namespace SurveyExtensions.Elements.QuestionElements +{ + public class ImagePickerChoice : Choice + { + + public string ImageLink { get; set; } + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Elements/QuestionElements/MatrixMultipleChoiceChoice.cs b/src/SurveyExtensions/Elements/QuestionElements/MatrixMultipleChoiceChoice.cs new file mode 100644 index 0000000..bd59047 --- /dev/null +++ b/src/SurveyExtensions/Elements/QuestionElements/MatrixMultipleChoiceChoice.cs @@ -0,0 +1,8 @@ +namespace SurveyExtensions.Elements.QuestionElements +{ + public class MatrixMultipleChoiceChoice : Choice + { + + public string CellType { get; set; } + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Elements/QuestionElements/MultiTextItem.cs b/src/SurveyExtensions/Elements/QuestionElements/MultiTextItem.cs new file mode 100644 index 0000000..daf16e6 --- /dev/null +++ b/src/SurveyExtensions/Elements/QuestionElements/MultiTextItem.cs @@ -0,0 +1,7 @@ +namespace SurveyExtensions.Elements.QuestionElements +{ + public class MultiTextItem + { + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Elements/Questions/BooleanQuestion.cs b/src/SurveyExtensions/Elements/Questions/BooleanQuestion.cs new file mode 100644 index 0000000..3e7a2a4 --- /dev/null +++ b/src/SurveyExtensions/Elements/Questions/BooleanQuestion.cs @@ -0,0 +1,18 @@ +namespace SurveyExtensions.Elements.Questions +{ + public class BooleanQuestion : Question + { + public BooleanQuestion() + { + Type = "boolean"; + } + + public string Title { get; set; } + public string Description { get; set; } + public bool IsRequired { get; set; } = false; + public bool StartWithNewLine { get; set; } = true; + public string Label { get; set; } + public string LabelTrue { get; set; } = "Yes"; + public string LabelFalse { get; set; } = "No"; + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Elements/Questions/CheckboxQuestion.cs b/src/SurveyExtensions/Elements/Questions/CheckboxQuestion.cs new file mode 100644 index 0000000..62b5ca3 --- /dev/null +++ b/src/SurveyExtensions/Elements/Questions/CheckboxQuestion.cs @@ -0,0 +1,27 @@ +namespace SurveyExtensions.Elements.Questions +{ + using SurveyExtensions.Elements.QuestionElements; + using System.Collections.Generic; + + public class CheckboxQuestion : Question + { + public CheckboxQuestion() + { + Type = "checkbox"; + } + + public string Title { get; set; } + public string Description { get; set; } + public bool IsRequired { get; set; } = false; + public bool StartWithNewLine { get; set; } = true; + public string ChoicesOrder { get; set; } + public int ColCount { get; set; } + public IList Choices { get; set; } = new List(); + public bool HasOther { get; set; } + public string OtherText { get; set; } + public bool HasSelectAll { get; set; } = false; + public string SelectAllText { get; set; } + public bool HasNone { get; set; } = false; + public string NoneText { get; set; } + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Elements/Questions/CommentsQuestion.cs b/src/SurveyExtensions/Elements/Questions/CommentsQuestion.cs new file mode 100644 index 0000000..60e404c --- /dev/null +++ b/src/SurveyExtensions/Elements/Questions/CommentsQuestion.cs @@ -0,0 +1,17 @@ +namespace SurveyExtensions.Elements.Questions +{ + public class CommentsQuestion : Question + { + public CommentsQuestion() + { + Type = "comment"; + } + + public string Title { get; set; } + public string Description { get; set; } + public bool IsRequired { get; set; } = false; + public bool StartWithNewLine { get; set; } = true; + public string PlaceHolder { get; set; } + public int Rows { get; set; } = 4; + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Elements/Questions/DropdownIQuestion.cs b/src/SurveyExtensions/Elements/Questions/DropdownIQuestion.cs new file mode 100644 index 0000000..3d8f5dd --- /dev/null +++ b/src/SurveyExtensions/Elements/Questions/DropdownIQuestion.cs @@ -0,0 +1,27 @@ +namespace SurveyExtensions.Elements.Questions +{ + using SurveyExtensions.Elements.QuestionElements; + using System.Collections.Generic; + + public class DropdownIQuestion : Question + { + + public DropdownIQuestion() + { + Type = "dropdown"; + } + + public string Title { get; set; } + public string Description { get; set; } + public bool IsRequired { get; set; } = false; + public bool StartWithNewLine { get; set; } = true; + public string ChoicesOrder { get; set; } + public IList Choices { get; set; } = new List(); + public bool HasOther { get; set; } = false; + public string OtherText { get; set; } + public string OptionCaption { get; set; } + public int ChoicesMin { get; set; } + public int ChoicesMax { get; set; } + public int ChoicesStep { get; set; } + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Elements/Questions/FileQuestion.cs b/src/SurveyExtensions/Elements/Questions/FileQuestion.cs new file mode 100644 index 0000000..0c44b4f --- /dev/null +++ b/src/SurveyExtensions/Elements/Questions/FileQuestion.cs @@ -0,0 +1,20 @@ +namespace SurveyExtensions.Elements.Questions +{ + public class FileQuestion : Question + { + public FileQuestion() + { + Type = "file"; + } + + public string Title { get; set; } + public string Description { get; set; } + public bool IsRequired { get; set; } = false; + public bool StartWithNewLine { get; set; } = true; + public bool ShowPreview { get; set; } + public int ImageHeight { get; set; } + public int ImageWidth { get; set; } + public bool StoreDataAsText { get; set; } + public int MaxSize { get; set; } = 0; + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Elements/Questions/HtmlEditorQuestion.cs b/src/SurveyExtensions/Elements/Questions/HtmlEditorQuestion.cs new file mode 100644 index 0000000..5a0e67e --- /dev/null +++ b/src/SurveyExtensions/Elements/Questions/HtmlEditorQuestion.cs @@ -0,0 +1,13 @@ +namespace SurveyExtensions.Elements.Questions +{ + public class HtmlEditorQuestion : Question + { + public HtmlEditorQuestion() + { + Type = "html"; + } + + public bool StartWithNewLine { get; set; } = true; + public string Html { get; set; } + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Elements/Questions/ImagePickerQuestion.cs b/src/SurveyExtensions/Elements/Questions/ImagePickerQuestion.cs new file mode 100644 index 0000000..0364664 --- /dev/null +++ b/src/SurveyExtensions/Elements/Questions/ImagePickerQuestion.cs @@ -0,0 +1,22 @@ +namespace SurveyExtensions.Elements.Questions +{ + using SurveyExtensions.Elements.QuestionElements; + using System.Collections.Generic; + + public class ImagePickerQuestion : Question + { + public ImagePickerQuestion() + { + Type = "imagepicker"; + } + + public string Title { get; set; } + public string Description { get; set; } + public bool IsRequired { get; set; } = false; + public bool StartWithNewLine { get; set; } = true; + public string ChoicesOrder { get; set; } + public int ColCount { get; set; } = 0; + public IList Choices { get; set; } = new List(); + + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Elements/Questions/MatrixMultipleChoiceQuestion.cs b/src/SurveyExtensions/Elements/Questions/MatrixMultipleChoiceQuestion.cs new file mode 100644 index 0000000..9bcea4e --- /dev/null +++ b/src/SurveyExtensions/Elements/Questions/MatrixMultipleChoiceQuestion.cs @@ -0,0 +1,23 @@ +namespace SurveyExtensions.Elements.Questions +{ + using SurveyExtensions.Elements.QuestionElements; + using System.Collections.Generic; + + public class MatrixMultipleChoiceQuestion : Question + { + public MatrixMultipleChoiceQuestion() + { + Type = "matrixdropdown"; + } + + public string Title { get; set; } + public string Description { get; set; } + public bool IsRequired { get; set; } = false; + public bool StartWithNewLine { get; set; } = true; + public string CellType { get; set; } + public string TotalText { get; set; } + public IList Columns { get; set; } = new List(); + public IList Rows { get; set; } = new List(); + public IList Choices { get; set; } = new List(); + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Elements/Questions/MatrixSingleChoiceQuestion.cs b/src/SurveyExtensions/Elements/Questions/MatrixSingleChoiceQuestion.cs new file mode 100644 index 0000000..2b66b44 --- /dev/null +++ b/src/SurveyExtensions/Elements/Questions/MatrixSingleChoiceQuestion.cs @@ -0,0 +1,21 @@ +namespace SurveyExtensions.Elements.Questions +{ + using SurveyExtensions.Elements.QuestionElements; + using System.Collections.Generic; + + public class MatrixSingleChoiceQuestion : Question + { + public MatrixSingleChoiceQuestion() + { + Type = "matrix"; + } + + public string Title { get; set; } + public string Description { get; set; } + public bool IsRequired { get; set; } = false; + public bool StartWithNewLine { get; set; } = true; + public IList Columns { get; set; } = new List(); + public IList Rows { get; set; } = new List(); + public bool IsAllRowRequired { get; set; } = false; + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Elements/Questions/MultipleTextQuestion.cs b/src/SurveyExtensions/Elements/Questions/MultipleTextQuestion.cs new file mode 100644 index 0000000..758435e --- /dev/null +++ b/src/SurveyExtensions/Elements/Questions/MultipleTextQuestion.cs @@ -0,0 +1,20 @@ +namespace SurveyExtensions.Elements.Questions +{ + using SurveyExtensions.Elements.QuestionElements; + using System.Collections.Generic; + + public class MultipleTextQuestion : Question + { + public MultipleTextQuestion() + { + Type = "multipletext"; + } + + public string Title { get; set; } + public string Description { get; set; } + public bool IsRequired { get; set; } = false; + public bool StartWithNewLine { get; set; } = true; + public int ColCount { get; set; } = 1; + public IList Items { get; set; } = new List(); + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Elements/Questions/Question.cs b/src/SurveyExtensions/Elements/Questions/Question.cs new file mode 100644 index 0000000..34a6914 --- /dev/null +++ b/src/SurveyExtensions/Elements/Questions/Question.cs @@ -0,0 +1,10 @@ +namespace SurveyExtensions.Elements.Questions +{ + using System; + + public abstract class Question : SurveyItem + { + public string Type { get; set; } + public bool Visible { get; set; } = true; + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Elements/Questions/RadiogroupQuestion.cs b/src/SurveyExtensions/Elements/Questions/RadiogroupQuestion.cs new file mode 100644 index 0000000..7d3557e --- /dev/null +++ b/src/SurveyExtensions/Elements/Questions/RadiogroupQuestion.cs @@ -0,0 +1,27 @@ +namespace SurveyExtensions.Elements.Questions +{ + using SurveyExtensions.Elements.QuestionElements; + using System.Collections.Generic; + + public class RadiogroupQuestion : Question + { + + public RadiogroupQuestion() + { + Type = "radiogroup"; + } + public string Title { get; set; } + + public string Description { get; set; } + + public bool IsRequired { get; set; } = false; + public bool StartWithNewLine { get; set; } = true; + public string ChoicesOrder { get; set; } + public int ColCount { get; set; } + public bool HasOther { get; set; } + public string OtherText { get; set; } + + public IList Choices { get; set; } = new List(); + + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Elements/Questions/RatingQuestion.cs b/src/SurveyExtensions/Elements/Questions/RatingQuestion.cs new file mode 100644 index 0000000..a20a0b6 --- /dev/null +++ b/src/SurveyExtensions/Elements/Questions/RatingQuestion.cs @@ -0,0 +1,25 @@ +namespace SurveyExtensions.Elements.Questions +{ + using SurveyExtensions.Elements.QuestionElements; + using System.Collections.Generic; + + public class RatingQuestion : Question + { + + public RatingQuestion() + { + Type = "rating"; + } + + public string Title { get; set; } + public string Description { get; set; } + public bool IsRequired { get; set; } = false; + public bool StartWithNewLine { get; set; } = true; + public int RateMin { get; set; } = 1; + public int RateMax { get; set; } = 5; + public int RateStep { get; set; } = 1; + public IList RateValues { get; set; } = new List(); + public string MinRateDescription { get; set; } + public string MaxRateDescription { get; set; } + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Elements/Questions/SingleInputQuestion.cs b/src/SurveyExtensions/Elements/Questions/SingleInputQuestion.cs new file mode 100644 index 0000000..211e4b0 --- /dev/null +++ b/src/SurveyExtensions/Elements/Questions/SingleInputQuestion.cs @@ -0,0 +1,18 @@ +namespace SurveyExtensions.Elements.Questions +{ + public class SingleInputQuestion : Question + { + public SingleInputQuestion() + { + Type = "text"; + InputType = "text"; + } + + public string Title { get; set; } + public string Description { get; set; } + public bool IsRequired { get; set; } = false; + public bool StartWithNewLine { get; set; } = true; + public string PlaceHolder { get; set; } + public string InputType { get; set; } + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Elements/Survey.cs b/src/SurveyExtensions/Elements/Survey.cs index 5475c54..d78d998 100644 --- a/src/SurveyExtensions/Elements/Survey.cs +++ b/src/SurveyExtensions/Elements/Survey.cs @@ -1,9 +1,13 @@ namespace SurveyExtensions.Elements { + using Newtonsoft.Json; + using Newtonsoft.Json.Serialization; using System.Collections.Generic; public class Survey { public List Pages { get; set; } = new List(); + + public string ToJson() => JsonConvert.SerializeObject(this, new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() }); } } \ No newline at end of file diff --git a/src/SurveyExtensions/Elements/SurveyCheckboxItem.cs b/src/SurveyExtensions/Elements/SurveyCheckboxItem.cs deleted file mode 100644 index 6306505..0000000 --- a/src/SurveyExtensions/Elements/SurveyCheckboxItem.cs +++ /dev/null @@ -1,23 +0,0 @@ -namespace SurveyExtensions.Elements -{ - using System.Collections.Generic; - - public class SurveyCheckboxItem : SurveyPageElement - { - - public string ChoicesOrder { get; set; } - - public int ColCount { get; set; } - - public IList Choices { get; set; } = new List(); - - - public string OtherText { get; set; } - - public bool HasSelectAll { get; set; } = false; - public string SelectAllText { get; set; } - - public bool HasNone { get; set; } = false; - public string NoneText { get; set; } - } -} \ No newline at end of file diff --git a/src/SurveyExtensions/Elements/SurveyChoicesOrderEnum.cs b/src/SurveyExtensions/Elements/SurveyChoicesOrderEnum.cs deleted file mode 100644 index f6e83a2..0000000 --- a/src/SurveyExtensions/Elements/SurveyChoicesOrderEnum.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace SurveyExtensions.Elements -{ - public enum SurveyChoicesOrderEnum - { - none, - asc, - desc, - random, - } -} \ No newline at end of file diff --git a/src/SurveyExtensions/Elements/SurveyInputItem.cs b/src/SurveyExtensions/Elements/SurveyInputItem.cs deleted file mode 100644 index 71c2576..0000000 --- a/src/SurveyExtensions/Elements/SurveyInputItem.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace SurveyExtensions.Elements -{ - public class SurveyInputItem : SurveyPageElement - { - - public string PlaceHolder { get; set; } - public string InputType { get; set; } - } -} \ No newline at end of file diff --git a/src/SurveyExtensions/Elements/SurveyItem.cs b/src/SurveyExtensions/Elements/SurveyItem.cs index eaa9f82..c0c5dce 100644 --- a/src/SurveyExtensions/Elements/SurveyItem.cs +++ b/src/SurveyExtensions/Elements/SurveyItem.cs @@ -3,8 +3,6 @@ public class SurveyItem { public string Name { get; set; } - public bool IsVisible { get; set; } = true; - public bool IsRequired { get; set; } = false; } } \ No newline at end of file diff --git a/src/SurveyExtensions/Elements/SurveyPage.cs b/src/SurveyExtensions/Elements/SurveyPage.cs index f0b5f63..e576641 100644 --- a/src/SurveyExtensions/Elements/SurveyPage.cs +++ b/src/SurveyExtensions/Elements/SurveyPage.cs @@ -2,7 +2,7 @@ { using System.Collections.Generic; - public class SurveyPage:SurveyItem + public class SurveyPage : SurveyItem { public IList Elements { get; set; } = new List(); } diff --git a/src/SurveyExtensions/Elements/SurveyPageElement.cs b/src/SurveyExtensions/Elements/SurveyPageElement.cs deleted file mode 100644 index ae14e4c..0000000 --- a/src/SurveyExtensions/Elements/SurveyPageElement.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace SurveyExtensions.Elements -{ - using System; - - public class SurveyPageElement : SurveyItem - { - public string Type { get; set; } - public string Title { get; set; } - public string Description { get; set; } - - } -} \ No newline at end of file diff --git a/src/SurveyExtensions/Elements/SurveyPanel.cs b/src/SurveyExtensions/Elements/SurveyPanel.cs new file mode 100644 index 0000000..210edef --- /dev/null +++ b/src/SurveyExtensions/Elements/SurveyPanel.cs @@ -0,0 +1,11 @@ +namespace SurveyExtensions.Elements +{ + using System.Collections.Generic; + + public class SurveyPanel : SurveyItem + { + public string Type { get => "panel"; } + public string Title { get; set; } + public IList Elements { get; set; } = new List(); + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Elements/SurveyRadiogroupItem.cs b/src/SurveyExtensions/Elements/SurveyRadiogroupItem.cs deleted file mode 100644 index 5ee6fac..0000000 --- a/src/SurveyExtensions/Elements/SurveyRadiogroupItem.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace SurveyExtensions.Elements -{ - using System.Collections.Generic; - - public class SurveyRadiogroupItem : SurveyPageElement - { - - public string ChoicesOrder { get; set; } - public int ColCount { get; set; } - public bool HasOther { get; set; } - public string OtherText { get; set; } - - public IList Choices { get; set; } = new List(); - - } -} \ No newline at end of file diff --git a/src/SurveyExtensions/Enums/CellTypes.cs b/src/SurveyExtensions/Enums/CellTypes.cs new file mode 100644 index 0000000..23e7c0a --- /dev/null +++ b/src/SurveyExtensions/Enums/CellTypes.cs @@ -0,0 +1,12 @@ +namespace SurveyExtensions.Enums +{ + public enum CellTypes + { + Dropdown, + Checkbox, + Radiogroup, + Text, + Comment, + Boolean + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Enums/ChoicesOrderOprions.cs b/src/SurveyExtensions/Enums/ChoicesOrderOprions.cs new file mode 100644 index 0000000..66500b7 --- /dev/null +++ b/src/SurveyExtensions/Enums/ChoicesOrderOprions.cs @@ -0,0 +1,10 @@ +namespace SurveyExtensions.Enums +{ + public enum ChoicesOrderOprions + { + none, + asc, + desc, + random, + } +} \ No newline at end of file diff --git a/src/SurveyExtensions/Elements/SurveyInputType.cs b/src/SurveyExtensions/Enums/SingleInputTypes.cs similarity index 50% rename from src/SurveyExtensions/Elements/SurveyInputType.cs rename to src/SurveyExtensions/Enums/SingleInputTypes.cs index c69274b..bc4a652 100644 --- a/src/SurveyExtensions/Elements/SurveyInputType.cs +++ b/src/SurveyExtensions/Enums/SingleInputTypes.cs @@ -1,6 +1,6 @@ -namespace SurveyExtensions.Elements +namespace SurveyExtensions.Enums { - public enum SurveyInputType + public enum SingleInputTypes { Text, Date, diff --git a/src/SurveyExtensions/Helpers/ReflectionHelpers.cs b/src/SurveyExtensions/Helpers/ReflectionHelpers.cs index db4e6d5..a795703 100644 --- a/src/SurveyExtensions/Helpers/ReflectionHelpers.cs +++ b/src/SurveyExtensions/Helpers/ReflectionHelpers.cs @@ -11,22 +11,28 @@ public static PropertyInfo GetPropertyInfo(TSource source, E Type type = typeof(TSource); MemberExpression member = propertyLambda.Body as MemberExpression; if (member == null) + { throw new ArgumentException(string.Format( "Expression '{0}' refers to a method, not a property.", propertyLambda.ToString())); + } PropertyInfo propInfo = member.Member as PropertyInfo; if (propInfo == null) + { throw new ArgumentException(string.Format( "Expression '{0}' refers to a field, not a property.", propertyLambda.ToString())); + } if (type != propInfo.ReflectedType && !type.IsSubclassOf(propInfo.ReflectedType)) + { throw new ArgumentException(string.Format( "Expression '{0}' refers to a property that is not from type {1}.", propertyLambda.ToString(), type)); + } return propInfo; } diff --git a/src/SurveyExtensions/SurveyExtensions.csproj b/src/SurveyExtensions/SurveyExtensions.csproj index 2bd48b2..5221246 100644 --- a/src/SurveyExtensions/SurveyExtensions.csproj +++ b/src/SurveyExtensions/SurveyExtensions.csproj @@ -4,4 +4,8 @@ netcoreapp2.2 + + + + diff --git a/test/SurveyExtensionsTests/Factory/BulderFactory.cs b/test/SurveyExtensionsTests/Factory/BulderFactory.cs index 1292772..2a304fa 100644 --- a/test/SurveyExtensionsTests/Factory/BulderFactory.cs +++ b/test/SurveyExtensionsTests/Factory/BulderFactory.cs @@ -1,34 +1,38 @@ namespace SurveyExtensionsTests.Factory { using SurveyExtensions.Builders; - using SurveyExtensions.Elements; + using SurveyExtensions.Enums; using SurveyExtensionsTests.Dtos; - using System; - using System.Collections.Generic; - using System.Text; public static class BulderFactory { - public static void Get_1Page_3Checkbox(SurveyBuilder builder, - string pageName) + public static void Get_1Page_CheckboxWithAllWithNoneSortedAscending + (SurveyBuilder builder,string pageName) { builder.AddPage(pageName, - page => - page.AddCheckboxInput(x => x.ContactData, - b => b - .HasTitle("Choice 1 Title (asc) - All - None") - .AddChoice("CB1Val1", "Choice 1") - .AddChoice("CB1Val2", "Choice 2") - .AddChoice("CB1Val3", "Choice 3") - .AddChoice("CB1Val4", "Choice 4") - .AddChoice("CB1Val5", "Choice 5") - .HasColumnCount(1) - .HasOtherChoice("Other choice text") - .HasSelectAllChoice("Select All") - .HasSelectNoneChoice("Select none") - .SetChoicesOrder(SurveyChoicesOrderEnum.asc)) - .AddCheckboxInput(x => x.ContactData, + page => + page.AddCheckboxInput(x => x.ContactData, + b => b + .HasTitle("Choice 1 Title (asc) - All - None") + .AddChoice("CB1Val1", "Choice 1") + .AddChoice("CB1Val2", "Choice 2") + .AddChoice("CB1Val3", "Choice 3") + .AddChoice("CB1Val4", "Choice 4") + .AddChoice("CB1Val5", "Choice 5") + .HasColumnCount(1) + .HasOtherChoice("Other choice text") + .HasSelectAllChoice("Select All") + .HasSelectNoneChoice("Select none") + .SetChoicesOrder(ChoicesOrderOprions.asc)) + ); + } + + public static void Get_1Page_CheckboxWithAllSortedDescending + (SurveyBuilder builder, string pageName) + { + builder.AddPage(pageName, + page =>page.AddCheckboxInput(x => x.ContactData, b => b .HasTitle("Choice 2 Title (desc) - All") .AddChoice("CB2Val1", "Choice 1") @@ -39,7 +43,16 @@ public static void Get_1Page_3Checkbox(SurveyBuilder builder, .HasColumnCount(2) .HasOtherChoice("Other choice text") .HasSelectAllChoice("Select All") - .SetChoicesOrder(SurveyChoicesOrderEnum.desc)) + .SetChoicesOrder(ChoicesOrderOprions.desc)) + ); + } + + public static void Get_1Page_CheckboxWithNoneSortedRandom + (SurveyBuilder builder, string pageName) + { + builder.AddPage(pageName, + page => + page .AddCheckboxInput(x => x.ContactData, b => b .HasTitle("Choice 3 Title (random) - None") @@ -51,16 +64,16 @@ public static void Get_1Page_3Checkbox(SurveyBuilder builder, .HasColumnCount(3) .HasOtherChoice("Other choice text") .HasSelectNoneChoice("Select none") - .SetChoicesOrder(SurveyChoicesOrderEnum.random)) + .SetChoicesOrder(ChoicesOrderOprions.random)) ); } - public static void Get_1Page_3Radiogroup(SurveyBuilder builder, - string pageName) + public static void Get_1Page_RadiogroupAscending(SurveyBuilder builder, + string pageName) { - builder.AddPage(pageName, + builder.AddPage(pageName, page => - page.AddRadiogroupInput(x => x.ContactData, + page.AddRadiogroup(x => x.ContactData, b => b .HasTitle("Radiogroup 1 Title (asc)") .AddChoice("RG1Val1", "Choice 1") @@ -70,8 +83,16 @@ public static void Get_1Page_3Radiogroup(SurveyBuilder builder, .AddChoice("RG1Val5", "Choice 5") .HasColumnCount(1) .HasOtherChoice("Other choice text") - .SetChoicesOrder(SurveyChoicesOrderEnum.asc)) - .AddRadiogroupInput(x => x.ContactData, + .SetChoicesOrder(ChoicesOrderOprions.asc)) + ); + } + + public static void Get_1Page_RadiogroupDescending(SurveyBuilder builder, + string pageName) + { + builder.AddPage(pageName, + page => + page.AddRadiogroup(x => x.ContactData, b => b .HasTitle("Radiogroup 2 Title (desc)") .AddChoice("RG2Val1", "Choice 1") @@ -80,7 +101,15 @@ public static void Get_1Page_3Radiogroup(SurveyBuilder builder, .AddChoice("RG2Val4", "Choice 4") .AddChoice("RG2Val5", "Choice 5") .HasColumnCount(2)) - .AddRadiogroupInput(x => x.ContactData, + ); + } + + public static void Get_1Page_RadiogroupRandom(SurveyBuilder builder, + string pageName) + { + builder.AddPage(pageName, + page => + page.AddRadiogroup(x => x.ContactData, b => b .HasTitle("Radiogroup 3 Title (random)") .AddChoice("RG3Val1", "Choice 1") @@ -89,7 +118,113 @@ public static void Get_1Page_3Radiogroup(SurveyBuilder builder, .AddChoice("RG3Val4", "Choice 4") .AddChoice("RG3Val5", "Choice 5") .HasColumnCount(3) - .SetChoicesOrder(SurveyChoicesOrderEnum.random)) + .SetChoicesOrder(ChoicesOrderOprions.random)) + ); + } + + public static void Get_1Page_DropdownAscending(SurveyBuilder builder, + string pageName) + { + builder.AddPage(pageName, + page => + page.AddDropdown(x => x.ContactData, + b => b + .HasTitle("Dropdown 1 Title (asc)") + .HasDescription("Dropdown 1 description") + .AddChoice("DD1Val1", "Choice 1") + .AddChoice("DD1Val2", "Choice 2") + .AddChoice("DD1Val3", "Choice 3") + .AddChoice("DD1Val4", "Choice 4") + .AddChoice("DD1Val5", "Choice 5") + .HasOtherChoice("Other choice text") + .SetChoicesOrder(ChoicesOrderOprions.asc)) + ); + } + + public static void Get_1Page_DropdownDescending(SurveyBuilder builder, + string pageName) + { + builder.AddPage(pageName, + page => + page.AddDropdown(x => x.ContactData, + b => b + .HasTitle("Dropdown 2 Title (desc)") + .HasDescription("Dropdown 2 description") + .AddChoice("DD2Val1", "Choice 1") + .AddChoice("DD2Val2", "Choice 2") + .AddChoice("DD2Val3", "Choice 3") + .AddChoice("DD2Val4", "Choice 4") + .AddChoice("DD2Val5", "Choice 5") + .SetChoicesOrder(ChoicesOrderOprions.desc)) + ); + } + + public static void Get_1Page_DropdownRandom(SurveyBuilder builder, + string pageName) + { + builder.AddPage(pageName, + page => + page.AddDropdown(x => x.ContactData, + b => b + .HasTitle("Dropdown 3 Title (random)") + .HasDescription("Dropdown 3 description") + .AddChoice("DD3Val1", "Choice 1") + .AddChoice("DD3Val2", "Choice 2") + .AddChoice("DD3Val3", "Choice 3") + .AddChoice("DD3Val4", "Choice 4") + .AddChoice("DD3Val5", "Choice 5") + .SetChoicesOrder(ChoicesOrderOprions.random)) + ); + } + + public static void Get_1Page_ImagePickerAscending(SurveyBuilder builder, + string pageName) + { + builder.AddPage(pageName, + page => + page.AddImagePickerInput(x => x.ContactData, + b => b + .HasTitle("Image Picker 1 Title (asc)") + .AddChoice("IP1Val1", "Lion", "https://surveyjs.io/Content/Images/examples/image-picker/lion.jpg") + .AddChoice("IP1Val2", "Giraffe", "https://surveyjs.io/Content/Images/examples/image-picker/giraffe.jpg") + .AddChoice("IP1Val3", "Panda", "https://surveyjs.io/Content/Images/examples/image-picker/panda.jpg") + .AddChoice("IP1Val4", "Camel", "https://surveyjs.io/Content/Images/examples/image-picker/camel.jpg") + .HasColumnCount(0) + .SetChoicesOrder(ChoicesOrderOprions.asc)) + ); + } + + public static void Get_1Page_ImagePickerDescending(SurveyBuilder builder, + string pageName) + { + builder.AddPage(pageName, + page => + page.AddImagePickerInput(x => x.ContactData, + b => b + .HasTitle("Image Picker 1 Title (asc)") + .AddChoice("IP1Val1", "Lion", "https://surveyjs.io/Content/Images/examples/image-picker/lion.jpg") + .AddChoice("IP1Val2", "Giraffe", "https://surveyjs.io/Content/Images/examples/image-picker/giraffe.jpg") + .AddChoice("IP1Val3", "Panda", "https://surveyjs.io/Content/Images/examples/image-picker/panda.jpg") + .AddChoice("IP1Val4", "Camel", "https://surveyjs.io/Content/Images/examples/image-picker/camel.jpg") + .HasColumnCount(2) + .SetChoicesOrder(ChoicesOrderOprions.desc)) + ); + } + + public static void Get_1Page_ImagePickerRandom(SurveyBuilder builder, + string pageName) + { + builder.AddPage(pageName, + page => + page.AddImagePickerInput(x => x.ContactData, + b => b + .HasTitle("Image Picker 1 Title (asc)") + .AddChoice("IP1Val1", "Lion", "https://surveyjs.io/Content/Images/examples/image-picker/lion.jpg") + .AddChoice("IP1Val2", "Giraffe", "https://surveyjs.io/Content/Images/examples/image-picker/giraffe.jpg") + .AddChoice("IP1Val3", "Panda", "https://surveyjs.io/Content/Images/examples/image-picker/panda.jpg") + .AddChoice("IP1Val4", "Camel", "https://surveyjs.io/Content/Images/examples/image-picker/camel.jpg") + .HasColumnCount(0) + .SetChoicesOrder(ChoicesOrderOprions.random)) ); } } diff --git a/test/SurveyExtensionsTests/GeneralBuilderTests.cs b/test/SurveyExtensionsTests/GeneralBuilderTests.cs index f15c8b0..08f191f 100644 --- a/test/SurveyExtensionsTests/GeneralBuilderTests.cs +++ b/test/SurveyExtensionsTests/GeneralBuilderTests.cs @@ -6,6 +6,7 @@ namespace SurveyExtensionsTests using FluentAssertions; using SurveyExtensions.Builders; using SurveyExtensions.Elements; + using SurveyExtensions.Enums; public class GeneralBuilderTests { @@ -16,22 +17,25 @@ public void TestSingleInput() companyBuilder.AddPage("Pagina 1", page => - page.AddSingleInput(x => x.DocumentId, + page.AddSingleInputQuestion(x => x.DocumentId, b => b .HasTitle("Dni") .HasPlaceHolder("Ponga aqui su dni") - .SetInputType(SurveyInputType.Text)) - .AddSingleInput(x=> x.ContactData, + .SetInputType(SingleInputTypes.Text)) + .AddSingleInputQuestion(x=> x.ContactData, b=> b .HasTitle("Datos de Contacto") .HasPlaceHolder("Ponga Aqui sus Datos de Contacto")) ) .AddPage("Pagina 2", page=> - page.AddSingleInput(x=> x.IsCashReceiptCriteria, b=> b.SetInputType(SurveyInputType.Email)) + page.AddSingleInputQuestion(x=> x.IsCashReceiptCriteria, b=> b.SetInputType(SingleInputTypes.Email)) ); companyBuilder.AddPage("MiPaginaMolona", - p => p.AddSingleInput(c => c.DocumentId, "placeholderMolon", "MiDni", SurveyInputType.Text)); + p => p.AddSingleInputQuestion(c => c.DocumentId, + i => i.HasPlaceHolder("placeholderMolon") + .HasTitle("MiDni") + .SetInputType(SingleInputTypes.Text))); @@ -39,16 +43,5 @@ public void TestSingleInput() myBuildedElements.Pages.Count.Should().Be(3); } - [Fact] - public void TestBuilders() - { - SurveyBuilder companyBuilder = new SurveyBuilder(); - - Factory.BulderFactory.Get_1Page_3Checkbox(companyBuilder, "Checkbox Page"); - Factory.BulderFactory.Get_1Page_3Radiogroup(companyBuilder, "Radiogroup Page"); - - var myBuildedElements = companyBuilder.Build(); - myBuildedElements.Pages.Count.Should().Be(2); - } } } diff --git a/test/SurveyExtensionsTests/JsonTests.cs b/test/SurveyExtensionsTests/JsonTests.cs index 86414fd..cb59d32 100644 --- a/test/SurveyExtensionsTests/JsonTests.cs +++ b/test/SurveyExtensionsTests/JsonTests.cs @@ -1,30 +1,321 @@ namespace SurveyExtensionsTests { - using System; using Xunit; using SurveyExtensionsTests.Dtos; using FluentAssertions; using SurveyExtensionsTests.jsonResults; - using Newtonsoft.Json; - using Newtonsoft.Json.Serialization; using SurveyExtensions.Builders; - using SurveyExtensions.Elements; + using SurveyExtensions.Enums; public class JsonTests { [Fact] - public void TestSerialization() + public void SingleTextInputTest() { SurveyBuilder companyBuilder = new SurveyBuilder(); - companyBuilder.AddPage("Page1",p => p.AddSingleInput(c => c.DocumentId, "Put Here your DNI", "Document Id Card", SurveyInputType.Text)); + companyBuilder.AddPage("Page1", + p => p.AddSingleInputQuestion(c => c.DocumentId, + i => i.HasPlaceHolder("Put Here your DNI") + .HasTitle("Document Id Card") + .SetInputType(SingleInputTypes.Text)) + ); - Factory.BulderFactory.Get_1Page_3Checkbox(companyBuilder, "Checkbox Page"); - Factory.BulderFactory.Get_1Page_3Radiogroup(companyBuilder, "Radiogroup Page"); + var builtCompany = companyBuilder.Build(); + var extractedJson = builtCompany.ToJson(); + extractedJson.Should().Be(jsoncollections.SingleInputTestExtractedJson); + } + + [Fact] + public void CommentTest() + { + SurveyBuilder companyBuilder = new SurveyBuilder(); + + companyBuilder.AddPage("Page1", + p => p.AddCommentInput(c => c.ContactData, + i => i.HasTitle("Datos de contacto") + .HasPlaceHolder("entra los datos de contacto") + .HasRows(7)) + .AddCommentInput(c => c.ContactData, + i => i.HasTitle("Datos de contacto 2") + .HasPlaceHolder("placeholder 2") + .HasRows(14) + .ContinueInSameLine()) + ); + + var builtCompany = companyBuilder.Build(); + var extractedJson = builtCompany.ToJson(); + extractedJson.Should().Be(jsoncollections.CommentTestExtractedJson); + } + + [Fact] + public void RatingTests() + { + SurveyBuilder companyBuilder = new SurveyBuilder(); + + companyBuilder.AddPage("Page1", + p => p + .AddRating(c => c.IsLegalPerson, + i => i.HasTitle("Rating with values") + .HasRateMin(1) + .HasRateMax(10) + .HasRateStep(1)) + .AddRating(c => c.IsLegalPerson, + i => i.HasTitle("Rating with options") + .AddRateValue("RTVal1", "Val 1") + .AddRateValue("RTVal2", "Val 2") + .AddRateValue("RTVal3", "Val 3") + .AddRateValue("RTVal4", "Val 4") + .AddRateValue("RTVal5", "Val 5") + .AddRateValue("RTVal6", "Val 6") + .AddRateValue("RTVal7", "Val 7") + .AddRateValue("RTVal8", "Val 8")) + ); + + var builtCompany = companyBuilder.Build(); + var extractedJson = builtCompany.ToJson(); + extractedJson.Should().Be(jsoncollections.RatingTestExtractedJson); + } + + [Fact] + public void Checkbox1TestWithAllWithNoneSortedAscending() + { + SurveyBuilder companyBuilder = new SurveyBuilder(); + Factory.BulderFactory.Get_1Page_CheckboxWithAllWithNoneSortedAscending(companyBuilder, "Page1"); + var builtCompany = companyBuilder.Build(); + var extractedJson = builtCompany.ToJson(); + extractedJson.Should().Be(jsoncollections.Checkbox1TestExtractedJson); + } + + [Fact] + public void Checkbox2TestWithAllSortedDescending() + { + SurveyBuilder companyBuilder = new SurveyBuilder(); + Factory.BulderFactory.Get_1Page_CheckboxWithAllSortedDescending(companyBuilder, "Page1"); + var builtCompany = companyBuilder.Build(); + var extractedJson = builtCompany.ToJson(); + extractedJson.Should().Be(jsoncollections.Checkbox2TestExtractedJson); + } + + [Fact] + public void Checkbox3TestWithAllWithNoneSortedAscending() + { + SurveyBuilder companyBuilder = new SurveyBuilder(); + Factory.BulderFactory.Get_1Page_CheckboxWithAllWithNoneSortedAscending(companyBuilder, "Checkbox 3"); + var builtCompany = companyBuilder.Build(); + var extractedJson = builtCompany.ToJson(); + extractedJson.Should().Be(jsoncollections.Checkbox3TestExtractedJson); + } + + [Fact] + public void Radiogroup1TestAscending() + { + SurveyBuilder companyBuilder = new SurveyBuilder(); + Factory.BulderFactory.Get_1Page_RadiogroupAscending(companyBuilder, "Page1"); + var builtCompany = companyBuilder.Build(); + var extractedJson = builtCompany.ToJson(); + extractedJson.Should().Be(jsoncollections.Radiogroup1TestExtractedJson); + } + + [Fact] + public void Radiogroup2TestDescending() + { + SurveyBuilder companyBuilder = new SurveyBuilder(); + Factory.BulderFactory.Get_1Page_RadiogroupDescending(companyBuilder, "Page1"); + var builtCompany = companyBuilder.Build(); + var extractedJson = builtCompany.ToJson(); + extractedJson.Should().Be(jsoncollections.Radiogroup2TestExtractedJson); + } + + [Fact] + public void Radiogroup3TestRandom() + { + SurveyBuilder companyBuilder = new SurveyBuilder(); + Factory.BulderFactory.Get_1Page_RadiogroupRandom(companyBuilder, "Page1"); + var builtCompany = companyBuilder.Build(); + var extractedJson = builtCompany.ToJson(); + extractedJson.Should().Be(jsoncollections.Radiogroup3TestExtractedJson); + } + + [Fact] + public void Dromdowm1TestAscending() + { + SurveyBuilder companyBuilder = new SurveyBuilder(); + Factory.BulderFactory.Get_1Page_DropdownAscending(companyBuilder, "Page1"); + var builtCompany = companyBuilder.Build(); + var extractedJson = builtCompany.ToJson(); + extractedJson.Should().Be(jsoncollections.Dropdown1TestExtractedJson); + } + + [Fact] + public void Dromdowm2TestDescending() + { + SurveyBuilder companyBuilder = new SurveyBuilder(); + Factory.BulderFactory.Get_1Page_DropdownDescending(companyBuilder, "Page1"); + var builtCompany = companyBuilder.Build(); + var extractedJson = builtCompany.ToJson(); + extractedJson.Should().Be(jsoncollections.Dropdown2TestExtractedJson); + } + + [Fact] + public void Dromdowm3TestRandom() + { + SurveyBuilder companyBuilder = new SurveyBuilder(); + Factory.BulderFactory.Get_1Page_DropdownRandom(companyBuilder, "Page1"); + var builtCompany = companyBuilder.Build(); + var extractedJson = builtCompany.ToJson(); + extractedJson.Should().Be(jsoncollections.Dropdown3TestExtractedJson); + } + + [Fact] + public void ImagePicker1TestAscending() + { + SurveyBuilder companyBuilder = new SurveyBuilder(); + Factory.BulderFactory.Get_1Page_ImagePickerAscending(companyBuilder, "Page1"); + var builtCompany = companyBuilder.Build(); + var extractedJson = builtCompany.ToJson(); + extractedJson.Should().Be(jsoncollections.ImagePicker1TestExtractedJson); + } + + [Fact] + public void ImagePicker2TestDescending() + { + SurveyBuilder companyBuilder = new SurveyBuilder(); + Factory.BulderFactory.Get_1Page_ImagePickerDescending(companyBuilder, "Page1"); + var builtCompany = companyBuilder.Build(); + var extractedJson = builtCompany.ToJson(); + extractedJson.Should().Be(jsoncollections.ImagePicker2TestExtractedJson); + } + + [Fact] + public void ImagePicker3TestRandom() + { + SurveyBuilder companyBuilder = new SurveyBuilder(); + Factory.BulderFactory.Get_1Page_ImagePickerRandom(companyBuilder, "Page1"); + var builtCompany = companyBuilder.Build(); + var extractedJson = builtCompany.ToJson(); + extractedJson.Should().Be(jsoncollections.ImagePicker3TestExtractedJson); + } + + [Fact] + public void BooleanTest() + { + SurveyBuilder companyBuilder = new SurveyBuilder(); + companyBuilder.AddPage("Page1", + p => p.AddBooleanInput(c => c.IsLegalPerson, + l => l.HasLabel("Boolean label") + .HasLabelTrue("True") + .HasLabelFalse("False") + )); + var builtCompany = companyBuilder.Build(); + var extractedJson = builtCompany.ToJson(); + extractedJson.Should().Be(jsoncollections.BooleanTestExtractedJson); + } + + [Fact] + public void HtmlEditornTest() + { + SurveyBuilder companyBuilder = new SurveyBuilder(); + companyBuilder.AddPage("Page1", + p => p.AddHtmlEditor(c => c.ContactData, + l => l.HasHtml("

H1 content

Paragraph

") + )); + var builtCompany = companyBuilder.Build(); + var extractedJson = builtCompany.ToJson(); + extractedJson.Should().Be(jsoncollections.HtmlEditorTestExtractedJson); + } + + [Fact] + public void FileTest() + { + SurveyBuilder companyBuilder = new SurveyBuilder(); + companyBuilder.AddPage("Page1", + p => p.AddFile(c => c.ContactData, + l => l.HasMaxSize(250) + )); + var builtCompany = companyBuilder.Build(); + var extractedJson = builtCompany.ToJson(); + extractedJson.Should().Be(jsoncollections.FileExtractedJson); + } + + [Fact] + public void MatrixSingleChoiceTest() + { + SurveyBuilder companyBuilder = new SurveyBuilder(); + companyBuilder.AddPage("Page1", + p => p.AddMatrixSingleChoice(c => c.ContactData, + m => m.HasTitle("MSC Title") + .HasDescription("MSC DEscription") + .AddColumn("0", "Bad") + .AddColumn("1", "Mid-Bad") + .AddColumn("2", "Mid") + .AddColumn("3", "Mid-Good") + .AddColumn("4", "Good") + .AddRow("R0", "Superman") + .AddRow("R1", "Batman") + .AddRow("R2", "Spiderman") + .AddRow("R3", "Jocker") + .SetIsAllRowRequired() + )); + var builtCompany = companyBuilder.Build(); + var extractedJson = builtCompany.ToJson(); + extractedJson.Should().Be(jsoncollections.MatrixSingleChoiceExtractedJson); + } - var myBuildedElements = companyBuilder.Build(); - var jsonextracted = JsonConvert.SerializeObject(myBuildedElements, new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() }); - jsonextracted.Should().Be(jsoncollections.test1); + [Fact] + public void MatrixMultipleChoiceTest() + { + SurveyBuilder companyBuilder = new SurveyBuilder(); + companyBuilder.AddPage("Page1", + p => p.AddMatrixMutipleChoice(c => c.ContactData, + m => m.HasTitle("MSC Title") + .HasDescription("MSC DEscription") + .AddColumn("0", "Bad") + .AddColumn("1", "Mid-Bad", CellTypes.Boolean) + .AddColumn("2", "Mid", CellTypes.Checkbox) + .AddColumn("3", "Mid-Good", CellTypes.Comment) + .AddColumn("4", "Good", CellTypes.Dropdown) + .AddColumn("5", "Excellent", CellTypes.Radiogroup) + .AddColumn("6", "SuperPower", CellTypes.Text) + .AddRow("R0", "Superman") + .AddRow("R1", "Batman") + .AddRow("R2", "Spiderman") + .AddRow("R3", "Jocker") + .AddChoice("C1", "Choice 1") + .AddChoice("C2", "Chice 2") + .HasCellType(CellTypes.Dropdown) + )); + var builtCompany = companyBuilder.Build(); + var extractedJson = builtCompany.ToJson(); + extractedJson.Should().Be(jsoncollections.MatrixMultipleChoiceExtractedJson); + } + + [Fact] + public void MultipleText() + { + SurveyBuilder companyBuilder = new SurveyBuilder(); + companyBuilder.AddPage("Page1", + p => p.AddMultipleText(c => c.ContactData, + l => l.AddItem("Item 1 text") + .AddItem("Item 2 text") + .AddItem("Item 3 text") + .AddItem("Item 4 text") + .HasColumnCount(2) + )); + var builtCompany = companyBuilder.Build(); + var extractedJson = builtCompany.ToJson(); + extractedJson.Should().Be(jsoncollections.MultipleTextTestExtractedJson); + } + + [Fact] + public void PanelWithelementsTest() + { + SurveyBuilder companyBuilder = new SurveyBuilder(); + companyBuilder.AddPage("Page1", + p => p.AddPanel("Panel1", pn => pn.AddFile( i=> i.ContactData, f=>f.HasMaxSize(50)))); + var builtCompany = companyBuilder.Build(); + var extractedJson = builtCompany.ToJson(); + extractedJson.Should().Be(jsoncollections.PanelWithElementsExtractedJson); } } } diff --git a/test/SurveyExtensionsTests/jsonResults/jsoncollections.Designer.cs b/test/SurveyExtensionsTests/jsonResults/jsoncollections.Designer.cs index ac16845..df561f1 100644 --- a/test/SurveyExtensionsTests/jsonResults/jsoncollections.Designer.cs +++ b/test/SurveyExtensionsTests/jsonResults/jsoncollections.Designer.cs @@ -60,6 +60,204 @@ internal jsoncollections() { } } + /// + /// Looks up a localized string similar to {"pages":[{"elements":[{"title":null,"description":null,"isRequired":false,"startWithNewLine":true,"label":"Boolean label","labelTrue":"True","labelFalse":"False","type":"boolean","visible":true,"name":"IsLegalPerson"}],"name":"Page1"}]}. + /// + internal static string BooleanTestExtractedJson { + get { + return ResourceManager.GetString("BooleanTestExtractedJson", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"pages":[{"elements":[{"title":"Choice 1 Title (asc) - All - None","description":null,"isRequired":false,"startWithNewLine":true,"choicesOrder":"asc","colCount":1,"choices":[{"value":"CB1Val1","text":"Choice 1"},{"value":"CB1Val2","text":"Choice 2"},{"value":"CB1Val3","text":"Choice 3"},{"value":"CB1Val4","text":"Choice 4"},{"value":"CB1Val5","text":"Choice 5"}],"hasOther":false,"otherText":"Other choice text","hasSelectAll":true,"selectAllText":"Select All","hasNone":true,"noneText":"Select none","type":" [rest of string was truncated]";. + /// + internal static string Checkbox1TestExtractedJson { + get { + return ResourceManager.GetString("Checkbox1TestExtractedJson", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"pages":[{"elements":[{"title":"Choice 2 Title (desc) - All","description":null,"isRequired":false,"startWithNewLine":true,"choicesOrder":"desc","colCount":2,"choices":[{"value":"CB2Val1","text":"Choice 1"},{"value":"CB2Val2","text":"Choice 2"},{"value":"CB2Val3","text":"Choice 3"},{"value":"CB2Val4","text":"Choice 4"},{"value":"CB2Val5","text":"Choice 5"}],"hasOther":false,"otherText":"Other choice text","hasSelectAll":true,"selectAllText":"Select All","hasNone":true,"noneText":null,"type":"checkbox","vis [rest of string was truncated]";. + /// + internal static string Checkbox2TestExtractedJson { + get { + return ResourceManager.GetString("Checkbox2TestExtractedJson", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"pages":[{"elements":[{"title":"Choice 1 Title (asc) - All - None","description":null,"isRequired":false,"startWithNewLine":true,"choicesOrder":"asc","colCount":1,"choices":[{"value":"CB1Val1","text":"Choice 1"},{"value":"CB1Val2","text":"Choice 2"},{"value":"CB1Val3","text":"Choice 3"},{"value":"CB1Val4","text":"Choice 4"},{"value":"CB1Val5","text":"Choice 5"}],"hasOther":false,"otherText":"Other choice text","hasSelectAll":true,"selectAllText":"Select All","hasNone":true,"noneText":"Select none","type":" [rest of string was truncated]";. + /// + internal static string Checkbox3TestExtractedJson { + get { + return ResourceManager.GetString("Checkbox3TestExtractedJson", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"pages":[{"elements":[{"title":"Datos de contacto","description":null,"isRequired":false,"startWithNewLine":true,"placeHolder":"entra los datos de contacto","rows":7,"type":"comment","visible":true,"name":"ContactData"},{"title":"Datos de contacto 2","description":null,"isRequired":false,"startWithNewLine":false,"placeHolder":"placeholder 2","rows":14,"type":"comment","visible":true,"name":"ContactData"}],"name":"Page1"}]}. + /// + internal static string CommentTestExtractedJson { + get { + return ResourceManager.GetString("CommentTestExtractedJson", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"pages":[{"elements":[{"title":"Dropdown 1 Title (asc)","description":"Dropdown 1 description","isRequired":false,"startWithNewLine":true,"choicesOrder":"asc","choices":[{"value":"DD1Val1","text":"Choice 1"},{"value":"DD1Val2","text":"Choice 2"},{"value":"DD1Val3","text":"Choice 3"},{"value":"DD1Val4","text":"Choice 4"},{"value":"DD1Val5","text":"Choice 5"}],"hasOther":true,"otherText":"Other choice text","optionCaption":null,"choicesMin":0,"choicesMax":0,"choicesStep":0,"type":"dropdown","visible":true,"n [rest of string was truncated]";. + /// + internal static string Dropdown1TestExtractedJson { + get { + return ResourceManager.GetString("Dropdown1TestExtractedJson", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"pages":[{"elements":[{"title":"Dropdown 2 Title (desc)","description":"Dropdown 2 description","isRequired":false,"startWithNewLine":true,"choicesOrder":"desc","choices":[{"value":"DD2Val1","text":"Choice 1"},{"value":"DD2Val2","text":"Choice 2"},{"value":"DD2Val3","text":"Choice 3"},{"value":"DD2Val4","text":"Choice 4"},{"value":"DD2Val5","text":"Choice 5"}],"hasOther":false,"otherText":null,"optionCaption":null,"choicesMin":0,"choicesMax":0,"choicesStep":0,"type":"dropdown","visible":true,"name":"Conta [rest of string was truncated]";. + /// + internal static string Dropdown2TestExtractedJson { + get { + return ResourceManager.GetString("Dropdown2TestExtractedJson", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"pages":[{"elements":[{"title":"Dropdown 3 Title (random)","description":"Dropdown 3 description","isRequired":false,"startWithNewLine":true,"choicesOrder":"random","choices":[{"value":"DD3Val1","text":"Choice 1"},{"value":"DD3Val2","text":"Choice 2"},{"value":"DD3Val3","text":"Choice 3"},{"value":"DD3Val4","text":"Choice 4"},{"value":"DD3Val5","text":"Choice 5"}],"hasOther":false,"otherText":null,"optionCaption":null,"choicesMin":0,"choicesMax":0,"choicesStep":0,"type":"dropdown","visible":true,"name":"C [rest of string was truncated]";. + /// + internal static string Dropdown3TestExtractedJson { + get { + return ResourceManager.GetString("Dropdown3TestExtractedJson", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"pages":[{"elements":[{"title":null,"description":null,"isRequired":false,"startWithNewLine":true,"showPreview":false,"imageHeight":0,"imageWidth":0,"storeDataAsText":false,"maxSize":250,"type":"file","visible":true,"name":"ContactData"}],"name":"Page1"}]}. + /// + internal static string FileExtractedJson { + get { + return ResourceManager.GetString("FileExtractedJson", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"pages":[{"elements":[{"startWithNewLine":true,"html":"<h1>H1 content</h1><p>Paragraph</p>","type":"html","visible":true,"name":"ContactData"}],"name":"Page1"}]}. + /// + internal static string HtmlEditorTestExtractedJson { + get { + return ResourceManager.GetString("HtmlEditorTestExtractedJson", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"pages":[{"elements":[{"title":"Image Picker 1 Title (asc)","description":null,"isRequired":false,"startWithNewLine":true,"choicesOrder":"asc","colCount":0,"choices":[{"imageLink":"https://surveyjs.io/Content/Images/examples/image-picker/lion.jpg","value":"IP1Val1","text":"Lion"},{"imageLink":"https://surveyjs.io/Content/Images/examples/image-picker/giraffe.jpg","value":"IP1Val2","text":"Giraffe"},{"imageLink":"https://surveyjs.io/Content/Images/examples/image-picker/panda.jpg","value":"IP1Val3","text":"Pa [rest of string was truncated]";. + /// + internal static string ImagePicker1TestExtractedJson { + get { + return ResourceManager.GetString("ImagePicker1TestExtractedJson", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"pages":[{"elements":[{"title":"Image Picker 1 Title (asc)","description":null,"isRequired":false,"startWithNewLine":true,"choicesOrder":"desc","colCount":2,"choices":[{"imageLink":"https://surveyjs.io/Content/Images/examples/image-picker/lion.jpg","value":"IP1Val1","text":"Lion"},{"imageLink":"https://surveyjs.io/Content/Images/examples/image-picker/giraffe.jpg","value":"IP1Val2","text":"Giraffe"},{"imageLink":"https://surveyjs.io/Content/Images/examples/image-picker/panda.jpg","value":"IP1Val3","text":"P [rest of string was truncated]";. + /// + internal static string ImagePicker2TestExtractedJson { + get { + return ResourceManager.GetString("ImagePicker2TestExtractedJson", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"pages":[{"elements":[{"title":"Image Picker 1 Title (asc)","description":null,"isRequired":false,"startWithNewLine":true,"choicesOrder":"random","colCount":0,"choices":[{"imageLink":"https://surveyjs.io/Content/Images/examples/image-picker/lion.jpg","value":"IP1Val1","text":"Lion"},{"imageLink":"https://surveyjs.io/Content/Images/examples/image-picker/giraffe.jpg","value":"IP1Val2","text":"Giraffe"},{"imageLink":"https://surveyjs.io/Content/Images/examples/image-picker/panda.jpg","value":"IP1Val3","text": [rest of string was truncated]";. + /// + internal static string ImagePicker3TestExtractedJson { + get { + return ResourceManager.GetString("ImagePicker3TestExtractedJson", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"pages":[{"elements":[{"title":"MSC Title","description":"MSC DEscription","isRequired":false,"startWithNewLine":true,"cellType":"dropdown","totalText":null,"columns":[{"cellType":null,"value":"0","text":"Bad"},{"cellType":"boolean","value":"1","text":"Mid-Bad"},{"cellType":"checkbox","value":"2","text":"Mid"},{"cellType":"comment","value":"3","text":"Mid-Good"},{"cellType":"dropdown","value":"4","text":"Good"},{"cellType":"radiogroup","value":"5","text":"Excellent"},{"cellType":"text","value":"6","t.... + /// + internal static string MatrixMultipleChoiceExtractedJson { + get { + return ResourceManager.GetString("MatrixMultipleChoiceExtractedJson", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"pages":[{"elements":[{"title":"MSC Title","description":"MSC DEscription","isRequired":false,"startWithNewLine":true,"columns":[{"value":"0","text":"Bad"},{"value":"1","text":"Mid-Bad"},{"value":"2","text":"Mid"},{"value":"3","text":"Mid-Good"},{"value":"4","text":"Good"}],"rows":[{"value":"R0","text":"Superman"},{"value":"R1","text":"Batman"},{"value":"R2","text":"Spiderman"},{"value":"R3","text":"Jocker"}],"isAllRowRequired":true,"type":"matrix","visible":true,"name":"ContactData"}],"nam.... + /// + internal static string MatrixSingleChoiceExtractedJson { + get { + return ResourceManager.GetString("MatrixSingleChoiceExtractedJson", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"pages":[{"elements":[{"title":null,"description":null,"isRequired":false,"startWithNewLine":true,"colCount":2,"items":[{"name":"Item 1 text"},{"name":"Item 2 text"},{"name":"Item 3 text"},{"name":"Item 4 text"}],"type":"multipletext","visible":true,"name":"ContactData"}],"name":"Page1"}]}. + /// + internal static string MultipleTextTestExtractedJson { + get { + return ResourceManager.GetString("MultipleTextTestExtractedJson", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"pages":[{"elements":[{"type":"panel","title":null,"elements":[{"title":null,"description":null,"isRequired":false,"startWithNewLine":true,"showPreview":false,"imageHeight":0,"imageWidth":0,"storeDataAsText":false,"maxSize":50,"type":"file","visible":true,"name":"ContactData"}],"name":"Panel1"}],"name":"Page1"}]}. + /// + internal static string PanelWithElementsExtractedJson { + get { + return ResourceManager.GetString("PanelWithElementsExtractedJson", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"pages":[{"elements":[{"title":"Radiogroup 1 Title (asc)","description":null,"isRequired":false,"startWithNewLine":true,"choicesOrder":"asc","colCount":1,"hasOther":true,"otherText":"Other choice text","choices":[{"value":"RG1Val1","text":"Choice 1"},{"value":"RG1Val2","text":"Choice 2"},{"value":"RG1Val3","text":"Choice 3"},{"value":"RG1Val4","text":"Choice 4"},{"value":"RG1Val5","text":"Choice 5"}],"type":"radiogroup","visible":true,"name":"ContactData"}],"name":"Page1"}]}. + /// + internal static string Radiogroup1TestExtractedJson { + get { + return ResourceManager.GetString("Radiogroup1TestExtractedJson", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"pages":[{"elements":[{"title":"Radiogroup 2 Title (desc)","description":null,"isRequired":false,"startWithNewLine":true,"choicesOrder":null,"colCount":2,"hasOther":false,"otherText":null,"choices":[{"value":"RG2Val1","text":"Choice 1"},{"value":"RG2Val2","text":"Choice 2"},{"value":"RG2Val3","text":"Choice 3"},{"value":"RG2Val4","text":"Choice 4"},{"value":"RG2Val5","text":"Choice 5"}],"type":"radiogroup","visible":true,"name":"ContactData"}],"name":"Page1"}]}. + /// + internal static string Radiogroup2TestExtractedJson { + get { + return ResourceManager.GetString("Radiogroup2TestExtractedJson", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"pages":[{"elements":[{"title":"Radiogroup 3 Title (random)","description":null,"isRequired":false,"startWithNewLine":true,"choicesOrder":"random","colCount":3,"hasOther":false,"otherText":null,"choices":[{"value":"RG3Val1","text":"Choice 1"},{"value":"RG3Val2","text":"Choice 2"},{"value":"RG3Val3","text":"Choice 3"},{"value":"RG3Val4","text":"Choice 4"},{"value":"RG3Val5","text":"Choice 5"}],"type":"radiogroup","visible":true,"name":"ContactData"}],"name":"Page1"}]}. + /// + internal static string Radiogroup3TestExtractedJson { + get { + return ResourceManager.GetString("Radiogroup3TestExtractedJson", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"pages":[{"elements":[{"title":"Rating with values","description":null,"isRequired":false,"startWithNewLine":true,"rateMin":1,"rateMax":10,"rateStep":1,"rateValues":[],"minRateDescription":null,"maxRateDescription":null,"type":"rating","visible":true,"name":"IsLegalPerson"},{"title":"Rating with options","description":null,"isRequired":false,"startWithNewLine":true,"rateMin":1,"rateMax":5,"rateStep":1,"rateValues":[{"value":"RTVal1","text":"Val 1"},{"value":"RTVal2","text":"Val 2"},{"value":"RTVal3","text" [rest of string was truncated]";. + /// + internal static string RatingTestExtractedJson { + get { + return ResourceManager.GetString("RatingTestExtractedJson", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"pages":[{"elements":[{"title":"Document Id Card","description":null,"isRequired":false,"startWithNewLine":true,"placeHolder":"Put Here your DNI","inputType":"text","type":"text","visible":true,"name":"DocumentId"}],"name":"Page1"}]}. + /// + internal static string SingleInputTestExtractedJson { + get { + return ResourceManager.GetString("SingleInputTestExtractedJson", resourceCulture); + } + } + /// /// Looks up a localized string similar to {"pages":[{"name":"Page1","elements":[{"placeHolder":"Put Here your DNI","inputType":"text","type":"text","title":"Document Id Card","isRequired":false,"name":"DocumentId"}]}]}. /// diff --git a/test/SurveyExtensionsTests/jsonResults/jsoncollections.resx b/test/SurveyExtensionsTests/jsonResults/jsoncollections.resx index 78c9fdd..192d77b 100644 --- a/test/SurveyExtensionsTests/jsonResults/jsoncollections.resx +++ b/test/SurveyExtensionsTests/jsonResults/jsoncollections.resx @@ -117,6 +117,72 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + {"pages":[{"elements":[{"title":null,"description":null,"isRequired":false,"startWithNewLine":true,"label":"Boolean label","labelTrue":"True","labelFalse":"False","type":"boolean","visible":true,"name":"IsLegalPerson"}],"name":"Page1"}]} + + + {"pages":[{"elements":[{"title":"Choice 1 Title (asc) - All - None","description":null,"isRequired":false,"startWithNewLine":true,"choicesOrder":"asc","colCount":1,"choices":[{"value":"CB1Val1","text":"Choice 1"},{"value":"CB1Val2","text":"Choice 2"},{"value":"CB1Val3","text":"Choice 3"},{"value":"CB1Val4","text":"Choice 4"},{"value":"CB1Val5","text":"Choice 5"}],"hasOther":false,"otherText":"Other choice text","hasSelectAll":true,"selectAllText":"Select All","hasNone":true,"noneText":"Select none","type":"checkbox","visible":true,"name":"ContactData"}],"name":"Page1"}]} + + + {"pages":[{"elements":[{"title":"Choice 2 Title (desc) - All","description":null,"isRequired":false,"startWithNewLine":true,"choicesOrder":"desc","colCount":2,"choices":[{"value":"CB2Val1","text":"Choice 1"},{"value":"CB2Val2","text":"Choice 2"},{"value":"CB2Val3","text":"Choice 3"},{"value":"CB2Val4","text":"Choice 4"},{"value":"CB2Val5","text":"Choice 5"}],"hasOther":false,"otherText":"Other choice text","hasSelectAll":true,"selectAllText":"Select All","hasNone":true,"noneText":null,"type":"checkbox","visible":true,"name":"ContactData"}],"name":"Page1"}]} + + + {"pages":[{"elements":[{"title":"Choice 1 Title (asc) - All - None","description":null,"isRequired":false,"startWithNewLine":true,"choicesOrder":"asc","colCount":1,"choices":[{"value":"CB1Val1","text":"Choice 1"},{"value":"CB1Val2","text":"Choice 2"},{"value":"CB1Val3","text":"Choice 3"},{"value":"CB1Val4","text":"Choice 4"},{"value":"CB1Val5","text":"Choice 5"}],"hasOther":false,"otherText":"Other choice text","hasSelectAll":true,"selectAllText":"Select All","hasNone":true,"noneText":"Select none","type":"checkbox","visible":true,"name":"ContactData"}],"name":"Checkbox 3"}]} + + + {"pages":[{"elements":[{"title":"Datos de contacto","description":null,"isRequired":false,"startWithNewLine":true,"placeHolder":"entra los datos de contacto","rows":7,"type":"comment","visible":true,"name":"ContactData"},{"title":"Datos de contacto 2","description":null,"isRequired":false,"startWithNewLine":false,"placeHolder":"placeholder 2","rows":14,"type":"comment","visible":true,"name":"ContactData"}],"name":"Page1"}]} + + + {"pages":[{"elements":[{"title":"Dropdown 1 Title (asc)","description":"Dropdown 1 description","isRequired":false,"startWithNewLine":true,"choicesOrder":"asc","choices":[{"value":"DD1Val1","text":"Choice 1"},{"value":"DD1Val2","text":"Choice 2"},{"value":"DD1Val3","text":"Choice 3"},{"value":"DD1Val4","text":"Choice 4"},{"value":"DD1Val5","text":"Choice 5"}],"hasOther":true,"otherText":"Other choice text","optionCaption":null,"choicesMin":0,"choicesMax":0,"choicesStep":0,"type":"dropdown","visible":true,"name":"ContactData"}],"name":"Page1"}]} + + + {"pages":[{"elements":[{"title":"Dropdown 2 Title (desc)","description":"Dropdown 2 description","isRequired":false,"startWithNewLine":true,"choicesOrder":"desc","choices":[{"value":"DD2Val1","text":"Choice 1"},{"value":"DD2Val2","text":"Choice 2"},{"value":"DD2Val3","text":"Choice 3"},{"value":"DD2Val4","text":"Choice 4"},{"value":"DD2Val5","text":"Choice 5"}],"hasOther":false,"otherText":null,"optionCaption":null,"choicesMin":0,"choicesMax":0,"choicesStep":0,"type":"dropdown","visible":true,"name":"ContactData"}],"name":"Page1"}]} + + + {"pages":[{"elements":[{"title":"Dropdown 3 Title (random)","description":"Dropdown 3 description","isRequired":false,"startWithNewLine":true,"choicesOrder":"random","choices":[{"value":"DD3Val1","text":"Choice 1"},{"value":"DD3Val2","text":"Choice 2"},{"value":"DD3Val3","text":"Choice 3"},{"value":"DD3Val4","text":"Choice 4"},{"value":"DD3Val5","text":"Choice 5"}],"hasOther":false,"otherText":null,"optionCaption":null,"choicesMin":0,"choicesMax":0,"choicesStep":0,"type":"dropdown","visible":true,"name":"ContactData"}],"name":"Page1"}]} + + + {"pages":[{"elements":[{"title":null,"description":null,"isRequired":false,"startWithNewLine":true,"showPreview":false,"imageHeight":0,"imageWidth":0,"storeDataAsText":false,"maxSize":250,"type":"file","visible":true,"name":"ContactData"}],"name":"Page1"}]} + + + {"pages":[{"elements":[{"startWithNewLine":true,"html":"<h1>H1 content</h1><p>Paragraph</p>","type":"html","visible":true,"name":"ContactData"}],"name":"Page1"}]} + + + {"pages":[{"elements":[{"title":"Image Picker 1 Title (asc)","description":null,"isRequired":false,"startWithNewLine":true,"choicesOrder":"asc","colCount":0,"choices":[{"imageLink":"https://surveyjs.io/Content/Images/examples/image-picker/lion.jpg","value":"IP1Val1","text":"Lion"},{"imageLink":"https://surveyjs.io/Content/Images/examples/image-picker/giraffe.jpg","value":"IP1Val2","text":"Giraffe"},{"imageLink":"https://surveyjs.io/Content/Images/examples/image-picker/panda.jpg","value":"IP1Val3","text":"Panda"},{"imageLink":"https://surveyjs.io/Content/Images/examples/image-picker/camel.jpg","value":"IP1Val4","text":"Camel"}],"type":"imagepicker","visible":true,"name":"ContactData"}],"name":"Page1"}]} + + + {"pages":[{"elements":[{"title":"Image Picker 1 Title (asc)","description":null,"isRequired":false,"startWithNewLine":true,"choicesOrder":"desc","colCount":2,"choices":[{"imageLink":"https://surveyjs.io/Content/Images/examples/image-picker/lion.jpg","value":"IP1Val1","text":"Lion"},{"imageLink":"https://surveyjs.io/Content/Images/examples/image-picker/giraffe.jpg","value":"IP1Val2","text":"Giraffe"},{"imageLink":"https://surveyjs.io/Content/Images/examples/image-picker/panda.jpg","value":"IP1Val3","text":"Panda"},{"imageLink":"https://surveyjs.io/Content/Images/examples/image-picker/camel.jpg","value":"IP1Val4","text":"Camel"}],"type":"imagepicker","visible":true,"name":"ContactData"}],"name":"Page1"}]} + + + {"pages":[{"elements":[{"title":"Image Picker 1 Title (asc)","description":null,"isRequired":false,"startWithNewLine":true,"choicesOrder":"random","colCount":0,"choices":[{"imageLink":"https://surveyjs.io/Content/Images/examples/image-picker/lion.jpg","value":"IP1Val1","text":"Lion"},{"imageLink":"https://surveyjs.io/Content/Images/examples/image-picker/giraffe.jpg","value":"IP1Val2","text":"Giraffe"},{"imageLink":"https://surveyjs.io/Content/Images/examples/image-picker/panda.jpg","value":"IP1Val3","text":"Panda"},{"imageLink":"https://surveyjs.io/Content/Images/examples/image-picker/camel.jpg","value":"IP1Val4","text":"Camel"}],"type":"imagepicker","visible":true,"name":"ContactData"}],"name":"Page1"}]} + + + {"pages":[{"elements":[{"title":"MSC Title","description":"MSC DEscription","isRequired":false,"startWithNewLine":true,"cellType":"dropdown","totalText":null,"columns":[{"cellType":null,"value":"0","text":"Bad"},{"cellType":"boolean","value":"1","text":"Mid-Bad"},{"cellType":"checkbox","value":"2","text":"Mid"},{"cellType":"comment","value":"3","text":"Mid-Good"},{"cellType":"dropdown","value":"4","text":"Good"},{"cellType":"radiogroup","value":"5","text":"Excellent"},{"cellType":"text","value":"6","text":"SuperPower"}],"rows":[{"value":"R0","text":"Superman"},{"value":"R1","text":"Batman"},{"value":"R2","text":"Spiderman"},{"value":"R3","text":"Jocker"}],"choices":[{"value":"C1","text":"Choice 1"},{"value":"C2","text":"Chice 2"}],"type":"matrixdropdown","visible":true,"name":"ContactData"}],"name":"Page1"}]} + + + {"pages":[{"elements":[{"title":"MSC Title","description":"MSC DEscription","isRequired":false,"startWithNewLine":true,"columns":[{"value":"0","text":"Bad"},{"value":"1","text":"Mid-Bad"},{"value":"2","text":"Mid"},{"value":"3","text":"Mid-Good"},{"value":"4","text":"Good"}],"rows":[{"value":"R0","text":"Superman"},{"value":"R1","text":"Batman"},{"value":"R2","text":"Spiderman"},{"value":"R3","text":"Jocker"}],"isAllRowRequired":true,"type":"matrix","visible":true,"name":"ContactData"}],"name":"Page1"}]} + + + {"pages":[{"elements":[{"title":null,"description":null,"isRequired":false,"startWithNewLine":true,"colCount":2,"items":[{"name":"Item 1 text"},{"name":"Item 2 text"},{"name":"Item 3 text"},{"name":"Item 4 text"}],"type":"multipletext","visible":true,"name":"ContactData"}],"name":"Page1"}]} + + + {"pages":[{"elements":[{"type":"panel","title":null,"elements":[{"title":null,"description":null,"isRequired":false,"startWithNewLine":true,"showPreview":false,"imageHeight":0,"imageWidth":0,"storeDataAsText":false,"maxSize":50,"type":"file","visible":true,"name":"ContactData"}],"name":"Panel1"}],"name":"Page1"}]} + + + {"pages":[{"elements":[{"title":"Radiogroup 1 Title (asc)","description":null,"isRequired":false,"startWithNewLine":true,"choicesOrder":"asc","colCount":1,"hasOther":true,"otherText":"Other choice text","choices":[{"value":"RG1Val1","text":"Choice 1"},{"value":"RG1Val2","text":"Choice 2"},{"value":"RG1Val3","text":"Choice 3"},{"value":"RG1Val4","text":"Choice 4"},{"value":"RG1Val5","text":"Choice 5"}],"type":"radiogroup","visible":true,"name":"ContactData"}],"name":"Page1"}]} + + + {"pages":[{"elements":[{"title":"Radiogroup 2 Title (desc)","description":null,"isRequired":false,"startWithNewLine":true,"choicesOrder":null,"colCount":2,"hasOther":false,"otherText":null,"choices":[{"value":"RG2Val1","text":"Choice 1"},{"value":"RG2Val2","text":"Choice 2"},{"value":"RG2Val3","text":"Choice 3"},{"value":"RG2Val4","text":"Choice 4"},{"value":"RG2Val5","text":"Choice 5"}],"type":"radiogroup","visible":true,"name":"ContactData"}],"name":"Page1"}]} + + + {"pages":[{"elements":[{"title":"Radiogroup 3 Title (random)","description":null,"isRequired":false,"startWithNewLine":true,"choicesOrder":"random","colCount":3,"hasOther":false,"otherText":null,"choices":[{"value":"RG3Val1","text":"Choice 1"},{"value":"RG3Val2","text":"Choice 2"},{"value":"RG3Val3","text":"Choice 3"},{"value":"RG3Val4","text":"Choice 4"},{"value":"RG3Val5","text":"Choice 5"}],"type":"radiogroup","visible":true,"name":"ContactData"}],"name":"Page1"}]} + + + {"pages":[{"elements":[{"title":"Rating with values","description":null,"isRequired":false,"startWithNewLine":true,"rateMin":1,"rateMax":10,"rateStep":1,"rateValues":[],"minRateDescription":null,"maxRateDescription":null,"type":"rating","visible":true,"name":"IsLegalPerson"},{"title":"Rating with options","description":null,"isRequired":false,"startWithNewLine":true,"rateMin":1,"rateMax":5,"rateStep":1,"rateValues":[{"value":"RTVal1","text":"Val 1"},{"value":"RTVal2","text":"Val 2"},{"value":"RTVal3","text":"Val 3"},{"value":"RTVal4","text":"Val 4"},{"value":"RTVal5","text":"Val 5"},{"value":"RTVal6","text":"Val 6"},{"value":"RTVal7","text":"Val 7"},{"value":"RTVal8","text":"Val 8"}],"minRateDescription":null,"maxRateDescription":null,"type":"rating","visible":true,"name":"IsLegalPerson"}],"name":"Page1"}]} + + + {"pages":[{"elements":[{"title":"Document Id Card","description":null,"isRequired":false,"startWithNewLine":true,"placeHolder":"Put Here your DNI","inputType":"text","type":"text","visible":true,"name":"DocumentId"}],"name":"Page1"}]} + {"pages":[{"name":"Page1","elements":[{"placeHolder":"Put Here your DNI","inputType":"text","type":"text","title":"Document Id Card","isRequired":false,"name":"DocumentId"}]}]}