Пример #1
0
        public static Dictionary <string, object> GenerateProperties(
            FieldType fieldType,
            Label label             = Label.Min,
            OptionCount optionCount = OptionCount.Zero,
            string optionAlias      = "",
            Caption caption         = Caption.Missing,
            Search search           = Search.Missing,
            Match match             = Match.Missing,
            Web web             = Web.Missing,
            Highlight highlight = Highlight.Missing,
            Require require     = Require.Missing,
            SelectionDefault selectionDefault = SelectionDefault.Missing)
        {
            var optionInfos = GetOptionInfos(optionAlias);
            var properties  = new Dictionary <string, object>
            {
                [PropertyName.SType.GetEnumStringValue()] = (int)fieldType,
                [PropertyName.Label.GetEnumStringValue()] = LabelMapperValue[label],
                [PropertyName.Id.GetEnumStringValue()]    = optionInfos.FirstOrDefault().Key,
                [PropertyName.DType.GetEnumStringValue()] = (int)DTypeMapper[fieldType],
                [PropertyName.Count.GetEnumStringValue()] = (int)optionCount
            };

            CaptionMapperValue[caption](properties);
            SearchMapperValue[search](properties);
            MatchMapperValue[match](properties);
            WebMapperValue[web](properties);
            HighlightMapperValue[highlight](properties);
            RequireMapperValue[require](properties);
            SelectionDefaultMapper[selectionDefault](optionInfos.FirstOrDefault().Value, properties);
            return(properties);
        }
Пример #2
0
        public void UpdateValidOptionalParamsTests(
            ResourceId resourceId,
            Label label,
            Caption caption,
            Search search,
            Match match,
            Web web,
            Highlight highlight,
            Require require,
            SelectionDefault selectionDefault,
            FieldTestType fieldTestType)
        {
            // Generate properties
            var properties = GenerateProperties(Commons.FieldTypeAPI, label, OptionCount.Zero, string.Empty, caption, search, match, web, highlight, require, selectionDefault);
            // Get field id
            var fieldId = fieldTestType == FieldTestType.UserDefine ? PrepareUserField.Data[resourceId].FirstOrDefault() : PrepareAppField.Data[resourceId].FirstOrDefault();
            // Execute test
            var request = GenerateRequest(Parameters.Update, GenerateUpdateInfos(resourceId, fieldId, properties));

            ExecuteUpdateTest(request.ToJson(), fieldId, properties);
        }
Пример #3
0
        public void CreateValidOptionalParamsTests(
            ResourceId resourceId,
            Alias alias,
            Label label,
            Caption caption,
            Search search,
            Match match,
            Web web,
            Highlight highlight,
            Require require,
            SelectionDefault selectionDefault,
            OptionCount optionCount)
        {
            // Get option alias
            var optionAlias = GetOptionsAlias()[new Random().Next(GetOptionsAlias().Count)];
            // Generate properties
            var properties = GenerateProperties(Commons.FieldTypeAPI, label, optionCount, optionAlias, caption, search, match, web, highlight, require, selectionDefault);
            // Generate request
            var request = GenerateRequest(Parameters.Create, GenerateCreateInfos(resourceId, properties, alias));

            // Execute test
            ExecuteCreateTest(request.ToJson());
        }