public void SearchConsumerProfile_ValidateShouldReturnFieldsToCollect() { var searchRequest = new SearchConsumerProfileRequest() { AgentState = _agentState }; var exceptionList = new List <string>(); foreach (var searchCriteria in _searchCriteriaList) { searchRequest.PopulateAgentData(searchRequest.AgentState); var searchData = new SearchConsumerProfilesData(searchRequest); try { var searchResponse = _consumerOperations.SearchConsumerProfiles(searchData, searchCriteria, null); Assert.IsFalse(searchResponse.Errors.Any(), $" {Environment.NewLine}Errors: {Environment.NewLine}{searchResponse.Errors?.Log()}"); Assert.IsTrue(searchResponse.Payload.FieldsToCollect != null && searchResponse.Payload.FieldsToCollect.Count != 0); Assert.IsTrue(searchResponse.Payload.ConsumerProfileSearchInfos?.Count == 0, $"There are search results for criteria {searchCriteria.ToString()}"); } catch (Exception ex) { exceptionList.Add( $"Failed search for criteria {searchCriteria.ToString()}. Exception: {ex.Message}"); } } Assert.IsTrue(exceptionList.Count == 0, string.Join("; ", exceptionList.ToArray())); }
public SearchConsumerProfilesResponse SearchConsumerProfiles( SearchConsumerProfilesData searchConsumerProfilesData) { var agent = _agents.GetAgent(searchConsumerProfilesData.Request.AgentId, searchConsumerProfilesData.Request.AgentPos); _agentConnectConfig.DecorateRequest(searchConsumerProfilesData.SearchConsumerProfilesRequest); return(_testRunner.AgentConnect.SearchConsumerProfiles(agent, searchConsumerProfilesData.SearchConsumerProfilesRequest)); }
public SearchConsumerProfilesResponse SearchConsumerProfiles(SearchConsumerProfilesData searchConsumerProfileData, string searchCriteria, List <KeyValuePairType> searchValues) { searchConsumerProfileData.SearchConsumerProfilesRequest = SearchConsumerProfilesRequestFactory.NewSearchConsumerProfilesRequest(); searchConsumerProfileData.SearchConsumerProfilesRequest.FieldValues.Add(new KeyValuePairType() { InfoKey = InfoKeyNames.search_CriteriaName, Value = searchCriteria }); if (searchValues != null && searchValues.Count > 0) { searchConsumerProfileData.SearchConsumerProfilesRequest.FieldValues.AddRange(searchValues); } return(_acIntegration.SearchConsumerProfiles(searchConsumerProfileData)); }
public void SearchExistingConsumerProfiles() { var createRequest = new INTEGRATION.CreateOrUpdateProfileConsumerRequest() { AgentState = _agentState }; createRequest.PopulateAgentData(createRequest.AgentState); var createData = new CreateOrUpdateProfileConsumerData(createRequest); var createResponse = _consumerOperations.CreateProfileConsumer(createData); Assert.IsFalse(createResponse.Errors.Any(), $" {Environment.NewLine}Errors: {Environment.NewLine}{createResponse.Errors?.Log()}"); var searchRequest = new INTEGRATION.SearchConsumerProfileRequest() { AgentState = _agentState }; var exceptionList = new List <string>(); foreach (var searchCriteria in _searchCriteriaList) { searchRequest.PopulateAgentData(searchRequest.AgentState); var searchData = new SearchConsumerProfilesData(searchRequest); var currentProfile = GetProfileConsumer( createResponse.Payload.ConsumerProfileIDs.First().ConsumerProfileID, createResponse.Payload.ConsumerProfileIDs.First().ConsumerProfileIDType); try { var searchResponse = _consumerOperations.SearchConsumerProfiles(searchData, searchCriteria, null); Assert.IsFalse(searchResponse.Errors.Any(), $" {Environment.NewLine}Errors: {Environment.NewLine}{searchResponse.Errors?.Log()}"); Assert.IsTrue(searchResponse.Payload.FieldsToCollect != null && searchResponse.Payload.FieldsToCollect.Count != 0); Assert.IsTrue(searchResponse.Payload.ConsumerProfileSearchInfos?.Count == 0, $"There are not search results for criteria {searchCriteria.ToString()}"); var valuesToBeSearched = _consumerOperations.GetCorectSearchValues(searchResponse.Payload.FieldsToCollect, currentProfile.Payload.CurrentValues); var searchResponseWithResult = _consumerOperations.SearchConsumerProfiles(searchData, searchCriteria, valuesToBeSearched); Assert.IsFalse(searchResponseWithResult.Errors.Any(), $" {Environment.NewLine}Errors: {Environment.NewLine}{searchResponseWithResult.Errors?.Log()}"); Assert.IsTrue(searchResponseWithResult.Payload.FieldsToCollect != null && searchResponseWithResult.Payload.FieldsToCollect.Count == 0, "There are fields to collect"); Assert.IsTrue( searchResponseWithResult.Payload.ConsumerProfileSearchInfos != null && searchResponseWithResult.Payload.ConsumerProfileSearchInfos.Count != 0, $"There are not search results for criteria {searchCriteria.ToString()}"); Assert.IsTrue(searchResponseWithResult.Payload.ConsumerProfileSearchInfos.FirstOrDefault(x => x.ConsumerProfileID == createResponse.Payload.ConsumerProfileIDs.First() .ConsumerProfileID) != null, "Couldn't find profile in search results"); } catch (Exception ex) { exceptionList.Add( $"Failed search for criteria {searchCriteria.ToString()}. Exception: {ex.Message}"); } } Assert.IsTrue(exceptionList.Count == 0, string.Join("; ", exceptionList.ToArray())); }