Exemplo n.º 1
0
        private static List <TestCaseData> SystemFieldGenerateTestCases(SpecialCommonInvalidInput specialCommon)
        {
            List <TestCaseData> result = new List <TestCaseData>();

            foreach (var resourceId in Enum.GetValues(typeof(Enums.ResourceType)).Cast <Enums.ResourceType>())
            {
                if (resourceId != Enums.ResourceType.Contract)
                {
                    result.Add(new TestCaseData(resourceId, DateTimeSystemField.PhaseDate, DateTimeValidator.Eq, specialCommon).SetDescription($"Search: {Util.GetEnumDescription(specialCommon)}"));
                }
            }

            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Read search failed by special common
        /// </summary>
        /// <param name="resourceType">Resource type</param>
        /// <param name="fieldName">Field name</param>
        /// <param name="condition">Condition</param>
        /// <param name="inputType">SpecialCommonInvalidInput</param>
        /// <param name="fieldType">False: System/Application field type, True: User field type</param>
        private void ReadFailSpecialCommon(Enums.ResourceType resourceType, string fieldName, string condition, SpecialCommonInvalidInput inputType, bool fieldType = false)
        {
            string fieldValue = null;

            Enums.ResourceType resourceTypeTemp = resourceType;

            switch (inputType)
            {
            case SpecialCommonInvalidInput.WrongResource:
                fieldValue   = Util.ToString(DateTime.Now);
                resourceType = SearchHelper.GetResourceFromExceptList(resourceType).Random();
                if (fieldType)
                {
                    fieldName = customFields.Data[$"{resourceTypeTemp}-{FieldType.Date}-0"].Field.ToAlias();
                }
                break;

            case SpecialCommonInvalidInput.WrongDate:
                fieldValue = Util.ToString(DateTime.Now);
                if (fieldType)
                {
                    fieldName = customFields.Data[$"{resourceType}-{FieldType.Date}-0"].Field.ToAlias();
                }
                break;

            case SpecialCommonInvalidInput.WrongAge:
                fieldValue = Util.ToString(DateTime.Now);
                if (fieldType)
                {
                    fieldName = customFields.Data[$"{resourceType}-{FieldType.Age}-0"].Field.ToAlias();
                }
                break;

            case SpecialCommonInvalidInput.WrongDateTime:
                fieldValue = DateTime.Now.ToString("yyyy-MM-dd");
                if (fieldType)
                {
                    fieldName = customFields.Data[$"{resourceType}-{FieldType.DateTime}-0"].Field.ToAlias();
                }
                break;

            case SpecialCommonInvalidInput.DeletedField:
                fieldValue = DateTime.Now.ToString("yyyy-MM-dd");
                if (fieldType)     //User field
                {
                    fieldName = deletedUserFields.Data[$"{resourceType}-{FieldType.Date}-0"].Field.ToAlias();
                }
                break;
            }

            string fieldAlias = string.Empty;

            if (fieldType)
            {
                fieldAlias = fieldName;
            }
            else
            {
                fieldAlias = $"{resourceTypeTemp.ToResourceName()}.{fieldName}";
            }

            string conditionFormat = $"{fieldAlias}:{condition.ToLowerString()}={fieldValue}";

            SearchHelper.ReadFailed(resourceType, fieldAlias, conditionFormat);
        }
Exemplo n.º 3
0
 public void TestSearchSpecialCommonApplicationField(Enums.ResourceType resourceType, string fieldName, string condition, SpecialCommonInvalidInput inputType)
 {
     ReadFailSpecialCommon(resourceType, fieldName, condition, inputType);
 }
Exemplo n.º 4
0
 public void TestSearchSpecialCommonUserField(Enums.ResourceType resourceType, string condition, SpecialCommonInvalidInput inputType)
 {
     ReadFailSpecialCommon(resourceType, null, condition, inputType, true);
 }