private static TestCaseData GetTestCaseData(SearchRequest request, ResourceId resource, SearchFilterType searchType, string op, PrivateApiResponseCode expectedCode) { var testCaseData = new TestCaseData(request, resource, searchType, op, expectedCode); var nullApplicableOperators = new List <string> { "=", "!=" }; if (searchType == SearchFilterType.BoolAndOr || searchType == SearchFilterType.BoolNot) { testCaseData.Bug("39352"); } if (searchType == SearchFilterType.Subquery || searchType == SearchFilterType.FreeWord || searchType == SearchFilterType.DateMinMax || searchType == SearchFilterType.NumMinMax) { testCaseData.Bug("39354"); } if ((searchType == SearchFilterType.Text && !nullApplicableOperators.Contains(op)) || (searchType == SearchFilterType.DateIn && !nullApplicableOperators.Contains(op)) || (searchType == SearchFilterType.NumOperator && !nullApplicableOperators.Contains(op)) || (searchType == SearchFilterType.Date && !nullApplicableOperators.Contains(op))) { testCaseData.Bug("39355"); } return(testCaseData); }
private static IEnumerable <TestCaseData> BulkCreateCombineApplicationFieldTestCasesData() { var failedCases = new string[] { InputType.Date.ToString(), InputType.Age.ToString(), "Option" }; foreach (var entry in Enum.GetValues(typeof(Entries))) { foreach (ResourceId resource in Utils.Resources()) { var item = FieldsDictionary[resource]; for (var i = 0; i < ApplicationFields.Count; i++) { for (var j = i + 1; j < ApplicationFields.Count; j++) { var firstFieldName = ApplicationFields.Keys.ElementAt(i).ToString(); var secondFieldName = ApplicationFields.Keys.ElementAt(j).ToString(); var firstFieldType = BulkCombineFields.GetFieldTypeByFieldName(resource, firstFieldName); var secondFieldType = BulkCombineFields.GetFieldTypeByFieldName(resource, secondFieldName); var testCaseData = new TestCaseData(entry, resource, firstFieldName, secondFieldName).SetDescription($"Bulk create with {resource} resource and {firstFieldName},{secondFieldName} fields"); if (firstFieldType.ToString().ContainsStrings(failedCases) || secondFieldType.ToString().ContainsStrings(failedCases)) { testCaseData.Bug("45167,45169"); } if (resource == ResourceId.Contract || resource == ResourceId.Activity || resource == ResourceId.Sales) { testCaseData.Bug("45172"); } yield return(testCaseData); } } } } }
private static IEnumerable <TestCaseData> BulkCreateCombineUserFieldTestCasesData() { var fieldTypes = Enum.GetValues(typeof(InputType)).Cast <InputType>().Except(new[] { InputType.Id, InputType.SystemCandidate, InputType.SystemClient, InputType.SystemContract, InputType.SystemJob, InputType.SystemRecruiter, InputType.SystemResume, InputType.SystemUser, InputType.UserList, InputType.OptionPhase }); var failedCases = new string[] { InputType.Date.ToString(), InputType.Age.ToString(), FieldType.Option.ToString() }; foreach (var entry in Enum.GetValues(typeof(Entries))) { foreach (ResourceId resource in Utils.Resources()) { foreach (var firstFieldType in fieldTypes) { foreach (var secondFieldType in fieldTypes.Where(item => (int)item > (int)firstFieldType)) { var testCaseData = new TestCaseData(entry, resource, firstFieldType, secondFieldType).SetDescription($"Bulk create with {resource} resource and {firstFieldType},{secondFieldType} field types"); if (firstFieldType.ToString().ContainsStrings(failedCases) || secondFieldType.ToString().ContainsStrings(failedCases)) { testCaseData.Bug("45167,45169"); } if (resource == ResourceId.Contract || resource == ResourceId.Activity || resource == ResourceId.Sales) { testCaseData.Bug("45172"); } yield return(testCaseData); } } } } }
private static IEnumerable <TestCaseData> GenerateTestCaseData(List <ResourceId> resources) { foreach (var entry in Enum.GetValues(typeof(BulkHelpers.Entries))) { foreach (var resource in resources) { var item = BulkHelpers.FieldsDictionary[resource]; for (var i = 0; i < item.Count; i++) { for (var j = i + 1; j < item.Count; j++) { var firstFieldName = item.Keys.ElementAt(i).ToString(); var secondFieldName = item.Keys.ElementAt(j).ToString(); if (!((resource == ResourceId.Activity || resource == ResourceId.Sales || resource == ResourceId.Person || resource == ResourceId.Recruiter) && (firstFieldName == "P_PhaseMemo" || secondFieldName == "P_PhaseMemo"))) { var firstFieldType = BulkCombineFields.GetFieldTypeByFieldName(resource, firstFieldName); var secondFieldType = BulkCombineFields.GetFieldTypeByFieldName(resource, secondFieldName); var testCaseData = new TestCaseData(entry, resource, firstFieldName, secondFieldName).SetDescription($"Bulk create with {resource} resource and {firstFieldName},{secondFieldName} fields"); if (firstFieldType == BulkHelpers.InputType.Number || firstFieldType == BulkHelpers.InputType.Currency || secondFieldType == BulkHelpers.InputType.Number || secondFieldType == BulkHelpers.InputType.Currency) { testCaseData.Bug("45165"); } if (firstFieldName.ContainsStrings(failedOptionFields) || secondFieldName.ContainsStrings(failedOptionFields)) { testCaseData.Bug("45167"); } if (firstFieldName.ContainsStrings(failedDateFields) || secondFieldName.ContainsStrings(failedDateFields)) { testCaseData.Bug("45169"); } if (resource == ResourceId.Process && (firstFieldName.ContainsStrings(failedOwnerFields) || secondFieldName.ContainsStrings(failedOwnerFields))) { testCaseData.Bug("45170"); } if (resource == ResourceId.Contract || resource == ResourceId.Activity || resource == ResourceId.Sales) { testCaseData.Bug("45172"); } yield return(testCaseData); } } } } } }
private static IEnumerable <TestCaseData> GenerateTestDataForFileds(Func <ResourceId, ResourceId, TestCoreFramework.Enums.FieldType, string> fieldNameProvider, Func <ResourceId, ResourceId, TestCoreFramework.Enums.FieldType, bool> fieldIsApplicableDeterminator = null) { foreach (var masterResource in ResourceToPossibleReferenceResourcesMap) { foreach (var dependentResource in masterResource.Value) { foreach (var fieldTypeItem in SearchConstants.FieldTypeToSearchTypeMap) { var privateApiFieldType = fieldTypeItem.Key == TestCoreFramework.Enums.FieldType.OptionDropdown || fieldTypeItem.Key == TestCoreFramework.Enums.FieldType.OptionCheckbox ? TestCoreFramework.Enums.FieldType.Option : fieldTypeItem.Key; foreach (var searchType in fieldTypeItem.Value) { if (fieldIsApplicableDeterminator != null && !fieldIsApplicableDeterminator(masterResource.Key, dependentResource, fieldTypeItem.Key)) { continue; } var testCases = SearchLogicCases.PrepareTestCases(searchType, masterResource.Key, () => fieldNameProvider(masterResource.Key, dependentResource, fieldTypeItem.Key), fieldTypeItem.Key); foreach (var testCase in testCases) { var testCaseData = new TestCaseData(masterResource.Key, dependentResource, fieldTypeItem.Key, searchType, testCase.Key.Replace($" {SearchLogicCases.ImportantCaseMarker}", string.Empty), testCase.Value) .SetDescription($"Test case for {masterResource.Key} resource, {dependentResource} referenced resource, {fieldTypeItem.Key} referenced field type, {searchType} search type: {testCase.Key.Replace($" {SearchLogicCases.ImportantCaseMarker}", string.Empty)}"); if (searchType == SearchFilterType.NumMinMax) { testCaseData.Bug("39346"); } if (fieldTypeItem.Key == TestCoreFramework.Enums.FieldType.Age || fieldTypeItem.Key == TestCoreFramework.Enums.FieldType.Date) { testCaseData.Bug("39347"); } yield return(testCaseData); } } } } } }
private static IEnumerable <TestCaseData> GenerateTestDataForFileds(Func <ResourceId, TestCoreFramework.Enums.FieldType, string> fieldNameProvider, Func <ResourceId, TestCoreFramework.Enums.FieldType, bool> fieldIsApplicableDeterminator = null) { foreach (var resource in Enum.GetValues(typeof(ResourceId)).Cast <ResourceId>().Except(new[] { ResourceId.None })) { foreach (var fieldTypeItem in SearchConstants.FieldTypeToSearchTypeMap) { foreach (var searchType in fieldTypeItem.Value) { if (fieldIsApplicableDeterminator != null && !fieldIsApplicableDeterminator(resource, fieldTypeItem.Key)) { continue; } var testCases = SearchLogicCases.PrepareTestCases(searchType, resource, () => fieldNameProvider(resource, fieldTypeItem.Key), fieldTypeItem.Key); foreach (var testCase in testCases) { var testCaseData = new TestCaseData(resource, fieldTypeItem.Key, searchType, testCase.Key.Replace($" {SearchLogicCases.ImportantCaseMarker}", string.Empty), testCase.Value) .SetDescription($"Test case for {resource} resource, {fieldTypeItem.Key} field type, {searchType} search type: {testCase.Key.Replace($" {SearchLogicCases.ImportantCaseMarker}", string.Empty)}"); if (searchType == SearchFilterType.NumMinMax) { testCaseData.Bug("39346"); } if (fieldTypeItem.Key == TestCoreFramework.Enums.FieldType.Age || fieldTypeItem.Key == TestCoreFramework.Enums.FieldType.Date) { testCaseData.Bug("39347"); } if (testCase.Key.Contains("Period")) { testCaseData.Bug("39359"); } yield return(testCaseData); } } } } }
public static IEnumerable <TestCaseData> GenerateTestDataForUrlParameter(string paramName, int httpCodeFail = 400) { foreach (var entry in UrlParameterInputToTransformationMap) { TestCaseData testCase = new TestCaseData(paramName, entry.Key).SetProperty(ExpectedErrorCodePropertyName, GetErrorCode(paramName, entry.Key)) .SetProperty(ExpectedErrorFieldPropertyName, GetErrorField(paramName, entry.Key)) .SetProperty(ExpectedHttpCodeFailPropertyName, httpCodeFail); if (paramName.Equals("companyId") && (entry.Key == InputType.FPN || entry.Key == InputType.HEX || entry.Key == InputType.LongString || entry.Key == InputType.NewLineChar)) { testCase.Bug("40156"); } yield return(testCase); } }
public static IEnumerable <TestCaseData> GenerateTestDataForJsonParameterUISetting(string paramPath, ParameterType parameterType, int httpCodeSuccess = 200, int httpCodeFail = 400) { foreach (var entry in ParamTypeToInputMap[parameterType]) { if (!(parameterType == ParameterType.Certificate && entry.Key == InputType.Missing)) { TestCaseData testCase = new TestCaseData(paramPath, parameterType, entry.Key).SetProperty(ExpectedErrorCodePropertyName, GetErrorCode(paramPath, entry.Key)) .SetProperty(ExpectedErrorFieldPropertyName, GetErrorField(paramPath, entry.Key)) .SetProperty(ExpectedHttpCodeSuccessPropertyName, httpCodeSuccess) .SetProperty(ExpectedHttpCodeFailPropertyName, httpCodeFail); if ((paramPath.Equals("allowedRolePwdLogin") && (entry.Key == InputType.Empty || entry.Key == InputType.IntAsString || entry.Key == InputType.NewLineChar || entry.Key == InputType.WithLeadingZeroes || entry.Key == InputType.WithPlus || entry.Key == InputType.WithWhiteSpaces || entry.Key == InputType.Zero)) || (paramPath.Equals("certificate") && (entry.Key == InputType.Empty || entry.Key == InputType.Null || entry.Key == InputType.MixedFullWidth)) || (paramPath.Equals("companyId") && (entry.Key == InputType.FPN || entry.Key == InputType.HEX || entry.Key == InputType.IntAsString || entry.Key == InputType.NewLineChar || entry.Key == InputType.OutOfRange || entry.Key == InputType.WithLeadingZeroes || entry.Key == InputType.WithPlus || entry.Key == InputType.WithWhiteSpaces))) { testCase.Bug("40125"); } if ((paramPath.Equals("loginURL") && (entry.Key != InputType.Empty || entry.Key != InputType.Missing || entry.Key != InputType.Null)) || (paramPath.Equals("ssoEmabled"))) { testCase.Bug("40156"); } yield return(testCase); } } }
public static IEnumerable <TestCaseData> GenerateTestDataForJsonParameterUpdateCase(string paramPath, ParameterType parameterType, int httpCodeSuccess = 200, int httpCodeFail = 400) { foreach (var entry in ParamTypeToInputMap[parameterType]) { if (!(parameterType == ParameterType.Certificate && entry.Key == InputType.Missing)) { TestCaseData testCase = new TestCaseData(paramPath, parameterType, entry.Key).SetProperty(ExpectedErrorCodePropertyName, GetErrorCode(paramPath, entry.Key)) .SetProperty(ExpectedErrorFieldPropertyName, GetErrorField(paramPath, entry.Key)) .SetProperty(ExpectedHttpCodeSuccessPropertyName, httpCodeSuccess) .SetProperty(ExpectedHttpCodeFailPropertyName, httpCodeFail); if ((paramPath.Equals("allowedRolePwdLogin") && (entry.Key == InputType.Empty || entry.Key == InputType.IntAsString || entry.Key == InputType.NewLineChar || entry.Key == InputType.WithLeadingZeroes || entry.Key == InputType.WithPlus || entry.Key == InputType.WithWhiteSpaces || entry.Key == InputType.Zero)) || (paramPath.Equals("certificate") && (entry.Key == InputType.Empty || entry.Key == InputType.Null)) || (paramPath.Equals("companyId") && (entry.Key == InputType.FPN || entry.Key == InputType.HEX || entry.Key == InputType.IntAsString || entry.Key == InputType.NewLineChar || entry.Key == InputType.OutOfRange || entry.Key == InputType.WithLeadingZeroes || entry.Key == InputType.WithPlus || entry.Key == InputType.WithWhiteSpaces)) || (paramPath.Equals("loginURL") && (entry.Key == InputType.FileUrl || entry.Key == InputType.HtmlInjection || entry.Key == InputType.InvalidUrl || entry.Key == InputType.IPUrl || entry.Key == InputType.JavascriptInjection || entry.Key == InputType.LongString || entry.Key == InputType.MixedFullWidth || entry.Key == InputType.NewLineChar || entry.Key == InputType.NonLatinDomainName || entry.Key == InputType.NullChar || entry.Key == InputType.SqlInjection || entry.Key == InputType.UrlWithHashSign || entry.Key == InputType.UrlWithoutDomain || entry.Key == InputType.UrlWithPort || entry.Key == InputType.WithWhiteSpaces))) { testCase.Bug("40125"); } yield return(testCase); } } }
public static IEnumerable <TestCaseData> InvalidUpdateSystemFieldTestCase(FieldType fieldType) { foreach (var fieldName in FieldTypeMapper[fieldType]) { foreach (var invalid in InvalidPropertyUpdateMapper[fieldType]) { var testcase = new TestCaseData(fieldType, fieldName, invalid).SetDescription($"field name: {fieldName}, invalid property: {invalid}"); if (fieldType == FieldType.SingleLineText && invalid == InvalidProperty.OverMaxSingleLineTextLength) { testcase.Bug("46774"); } if (fieldType == FieldType.Date && invalid == InvalidProperty.DateTimeFormat) { testcase.Bug("46359"); } if (fieldType == FieldType.Option) { if (invalid == InvalidProperty.RootOptIdIsDeleted || invalid == InvalidProperty.OverMaxOptionCount) { testcase.Bug("46496"); } if (fieldName.ContainsStrings(new[] { "Person.P_Phase", "Client.P_Phase", "Process.P_Phase", "Process.P_Close", "Recruiter.P_Phase", "Sales.P_Phase", "Activity.P_EventResources", "Activity.P_Phase", }) && invalid == InvalidProperty.WrongMatch) { testcase.Bug("46775"); } } if (fieldType == FieldType.System) { if (((!fieldName.Contains("Job.P_") && !fieldName.Contains("Resume.P_")) || fieldName.Contains("P_Id")) && invalid == InvalidProperty.WrongMatch) { testcase.Bug("46775"); } if ((fieldName.Contains("P_Id") && fieldName.Contains("P_Owner")) && invalid == InvalidProperty.WrongSearch) { testcase.Bug("46776"); } if (fieldName.Split('.')[0].ContainsStrings(new[] { ResourceId.Job, ResourceId.Process, ResourceId.Sales, ResourceId.Resume, ResourceId.Activity }.Select(r => r.ToAlias()).ToArray()) && invalid == InvalidProperty.WrongSearch) { if (fieldName.Split('.')[1].ContainsStrings(new[] { "P_Recruiter", "P_Client", "P_Candidate", "P_Job", "P_Resume", "P_Contract", "P_ResourceId", "P_Resource" })) { testcase.Bug("46776"); } } } if (fieldName == "Activity.P_ToDate" || fieldName == "Activity.P_FromDate") { if (invalid == InvalidProperty.OverMinDate || invalid == InvalidProperty.OverMaxDate || invalid == InvalidProperty.WrongMonth || invalid == InvalidProperty.WrongDay || invalid == InvalidProperty.WrongLeapYear || invalid == InvalidProperty.WrongHour || invalid == InvalidProperty.WrongMinute || invalid == InvalidProperty.WrongSecond) { testcase.Bug("46779"); } } if ((fieldName.Contains("P_PhaseMemo") || fieldType == FieldType.DateTime) && invalid == InvalidProperty.WrongMatch) { testcase.Bug("46775"); } if (invalid == InvalidProperty.WrongRequire && fieldType != FieldType.Reference) { testcase.Bug("46778"); } yield return(testcase); } } }
private static IEnumerable <TestCaseData> GenerateTestCaseData(List <ResourceId> resources) { foreach (BulkHelpers.RecordTypes record in Enum.GetValues(typeof(BulkHelpers.RecordTypes))) { foreach (BulkHelpers.Filters filter in Enum.GetValues(typeof(BulkHelpers.Filters))) { foreach (var resource in resources) { var item = BulkHelpers.FieldsDictionary[resource]; for (var i = 0; i < item.Count; i++) { for (var j = i + 1; j < item.Count; j++) { var firstFieldName = item.Keys.ElementAt(i).ToString(); var secondFieldName = item.Keys.ElementAt(j).ToString(); var testCaseData = new TestCaseData(record, filter, resource, firstFieldName, secondFieldName).SetDescription($"Bulk update with {resource} resource and {firstFieldName},{secondFieldName} fields"); var firstFieldType = BulkCombineFields.GetFieldTypeByFieldName(resource, firstFieldName); var secondFieldType = BulkCombineFields.GetFieldTypeByFieldName(resource, secondFieldName); if (filter == BulkHelpers.Filters.Replace && (firstFieldType == BulkHelpers.InputType.OptionMultipleItems || secondFieldType == BulkHelpers.InputType.OptionMultipleItems)) { testCaseData.Bug("43628"); } if ((filter == BulkHelpers.Filters.Append || filter == BulkHelpers.Filters.Replace) && ((firstFieldType == BulkHelpers.InputType.SingleLineText || secondFieldType == BulkHelpers.InputType.MultiLinesText) || (firstFieldType == BulkHelpers.InputType.MultiLinesText || secondFieldType == BulkHelpers.InputType.SingleLineText))) { testCaseData.Bug("43629"); } if (filter == BulkHelpers.Filters.Append && (firstFieldType == BulkHelpers.InputType.OptionMultipleItems || secondFieldType == BulkHelpers.InputType.OptionMultipleItems)) { testCaseData.Bug("43630"); } if (filter == BulkHelpers.Filters.Replace && ((firstFieldType == BulkHelpers.InputType.Number || secondFieldType == BulkHelpers.InputType.Number) || (firstFieldType == BulkHelpers.InputType.Currency || secondFieldType == BulkHelpers.InputType.Currency))) { testCaseData.Bug("44019"); } if (filter == BulkHelpers.Filters.Merge) { testCaseData.Bug("43631"); } if (firstFieldName == "P_Id" || secondFieldName == "P_Id") { testCaseData.Bug("43632"); } if (firstFieldName == "P_PhaseMemo" || secondFieldName == "P_PhaseMemo") { testCaseData.Bug("43635"); } if ((firstFieldName == "P_Resource" || firstFieldName == "P_ResourceId") || (secondFieldName == "P_Resource" || secondFieldName == "P_ResourceId")) { testCaseData.Bug("43637"); } if (firstFieldName.Contains("Owner") || firstFieldName.Contains("Owner")) { testCaseData.Bug("44022"); } if (filter == BulkHelpers.Filters.Append && ((firstFieldType == BulkHelpers.InputType.Number || firstFieldType == BulkHelpers.InputType.Number) || (secondFieldType == BulkHelpers.InputType.Currency || secondFieldType == BulkHelpers.InputType.Currency))) { testCaseData.Bug("43642"); } yield return(testCaseData); } } } } } }