public void TestSearchField(Enums.ResourceType resourceType, string fieldName, string condition) { string resourceName = resourceType.ToResourceName(); string fieldAlias = $"{resourceName}.{fieldName}"; string id1 = SystemFieldTypeHelper.GetRandomResourceId(resourceType, records, recordNum - 1); string id2 = SystemFieldTypeHelper.GetRandomResourceId(resourceType, records, recordNum - 1); Dictionary <string, string> parameters = GetDefaultParameters(fieldAlias, condition); if (SystemTypeField.Id == fieldName) { parameters[DateTimeValidator.ConditionValue1] = id1; parameters[DateTimeValidator.ConditionValue1] = id2; } //Read & verify the field's value SystemFieldTypeHelper.VerifySingleSearchSystemField(resourceType.ToString(), parameters); }
public void TestSearchFieldPhase(string fieldName, string condition) { Enums.ResourceType resourceType = Enums.ResourceType.Client; Dictionary <string, string> resourceIds = new Dictionary <string, string>(); //Get resource ids for (int i = 1; i <= 6; i++) { resourceIds[$"id{i}"] = GetResourceId(resourceType, i - 1); } var phaseList = new Dictionary <int, string> { { 0, resourceIds["id1"] }, { 1, resourceIds["id2"] }, { 2, resourceIds["id3"] }, { 3, resourceIds["id4"] }, { 4, resourceIds["id5"] }, { 5, resourceIds["id6"] } }.Select(item => { var phase = FieldHelper.CreatePhaseInstance(resourceType, item.Value); if (SystemTypeField.Id.Substring(2) != fieldName) { phase.DictionaryValues[fieldName] = ResourceHelper.DefaultUser; } return(phase); }).ToList(); List <string> ids = PublicApiAdapter.CreateAdapterForDefaultConnection().WriteSuccess(phaseList); Assume.That(ids, Is.Not.Null.And.Not.Empty, string.Format(Enums.Message.CREATE_RESOURCE_ENTRY_FAILED, resourceType)); Assume.That(ids, Is.All.Not.Null.And.Not.Empty, string.Format(Enums.Message.CREATE_RESOURCE_ENTRY_FAILED, resourceType)); Dictionary <string, string> parameters = GetDefaultParameters(fieldName, condition); if (SystemTypeField.Id == fieldName) { //Choose different ids to make sure searching better (ex: if choose conditionValue1 = conditionValue1 = id1 so when using 'and' condition, we will not see the best searching) parameters[DateTimeValidator.ConditionValue1] = resourceIds.Random(); parameters[DateTimeValidator.ConditionValue1] = resourceIds.Random(); } //Read & verify the field's value SystemFieldTypeHelper.VerifySingleSearchSystemField(nameof(Phase), parameters, new Dictionary <string, object>() { { "resource", (int)resourceType } }); }