Esempio n. 1
0
        public void GetMetadataTest(DocumentRetrieverTheoryData theoryData)
        {
            var context = TestUtilities.WriteHeader($"{this}.GetMetadataTest", theoryData);

            try
            {
                string doc = theoryData.DocumentRetriever.GetDocumentAsync(theoryData.Address, CancellationToken.None).Result;
                Assert.NotNull(doc);
                theoryData.ExpectedException.ProcessNoException();
            }
            catch (AggregateException aex)
            {
                aex.Handle((x) =>
                {
                    if (x.Data.Count > 0)
                    {
                        if (!x.Data.Contains(HttpDocumentRetriever.StatusCode))
                        {
                            context.AddDiff("!x.Data.Contains(HttpResponseConstants.StatusCode)");
                        }
                        if (!x.Data.Contains(HttpDocumentRetriever.ResponseContent))
                        {
                            context.AddDiff("!x.Data.Contains(HttpResponseConstants.ResponseContent)");
                        }
                        IdentityComparer.AreEqual(x.Data[HttpDocumentRetriever.StatusCode], theoryData.ExpectedStatusCode, context);
                    }
                    theoryData.ExpectedException.ProcessException(x);
                    return(true);
                });
            }

            TestUtilities.AssertFailIfErrors(context);
        }
Esempio n. 2
0
 public void GetMetadataTest(DocumentRetrieverTheoryData theoryData)
 {
     TestUtilities.WriteHeader($"{this}.GetMetadataTest", theoryData);
     try
     {
         string doc = theoryData.DocumentRetriever.GetDocumentAsync(theoryData.Address, CancellationToken.None).Result;
         Assert.NotNull(doc);
         theoryData.ExpectedException.ProcessNoException();
     }
     catch (AggregateException aex)
     {
         aex.Handle((x) =>
         {
             theoryData.ExpectedException.ProcessException(x);
             return(true);
         });
     }
 }