Esempio n. 1
0
        public void TestSearchMultipleMailForEachField(QueryLogic logic, FieldQueryParameters field, Operations op)
        {
            var handler  = new DefaultManager();
            var request  = GenerateSearchMailForEachFieldRequest(logic, field, op, DateListMultipleMail.ElementAt(NumberOfMail / 2), 1);
            var response = handler.Send <Dictionary <string, object> >(SearchEndPoint, JsonConvert.SerializeObject(request), HttpMethod.POST);

            VerifyDataForEachField(response, field, 1, op, true);
        }
Esempio n. 2
0
 private static void VerifyDataForEachField(PrivateApiResponse <Dictionary <string, object> > response, FieldQueryParameters field, int index, Operations op, bool searchMail = false)
 {
     if (BadRequestCases.Contains($"{field.ToString()}.{op.ToString()}"))
     {
         PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest));
     }
     else
     if (IgnoredTempCases.Contains($"{field.ToString()}.{op.ToString()}"))
     {
         //Nothing to do, b/c the response does not contain for this parameters
         PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK));
     }
     else
     {
         PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK));
         PrAssert.That(response.Result["totalHits"], PrIs.GreaterThan(0), "The response is empty.");
         foreach (var result in JsonConvert.DeserializeObject <List <Dictionary <string, object> > >(response.Result["hits"].ToString()))
         {
             var fieldName = field.GetEnumStringValue();
             if (field == FieldQueryParameters.Body)
             {
                 fieldName = "preview";
             }
             Assertions[op](result[fieldName].ToString(), MappingValues[field](index, searchMail ? DateListMultipleMail.ElementAt(NumberOfMail / 2) : DateListSingleMail.ElementAt(NumberOfMail / 2)).ToString());
         }
     }
 }
Esempio n. 3
0
 public static Dictionary <string, object> GenerateSearchMailForEachFieldRequest(QueryLogic queryLogic, FieldQueryParameters field, Operations op, string date, int index)
 {
     return(new Dictionary <string, object>
     {
         [QueryParameters.Query.GetEnumStringValue()] = new Dictionary <string, object>
         {
             [QueryParameters.QueryLogic.GetEnumStringValue()] = queryLogic.ToString().ToLower(),
             [QueryParameters.Query.GetEnumStringValue()] = new Dictionary <string, object>
             {
                 [field.GetEnumStringValue()] = Conditions(op.ToString().ToLower(), MappingValues[field](index, date))
             }
         }
     });
 }