Exemplo n.º 1
0
 /// <summary>
 /// Add an exception to our list of exceptions.
 /// </summary>
 /// <param name="err">The exception to add.</param>
 private void AddException(Exception err)
 {
     if (err != null)
     {
         if (ExceptionsThrown == null)
         {
             ExceptionsThrown = new List <Exception>();
         }
         ExceptionsThrown.Add(err);
     }
 }
Exemplo n.º 2
0
        protected override Response GetCachedResponseFor(Request request, string region)
        {
            var cachedResponse = base.GetCachedResponseFor(request, region);

            requestsReceived.Add(request);
            returnedCachedResponses.Add(cachedResponse);

            // WORKAROUND :
            // handler not called adding null to ExceptionsThrown here to avoid hard lookups later.

            if (cachedResponse != null)
            {
                ExceptionsThrown.Add(null);
            }

            return(cachedResponse);
        }
Exemplo n.º 3
0
 public static bool Threw <TException>()
 {
     return(ExceptionsThrown.Any(e => e != null && e.GetType() == typeof(TException)));
 }
Exemplo n.º 4
0
 public static int GetIndexOfFirstExceptionThrown <TException>()
 {
     return(ExceptionsThrown.FindIndex(e => e != null && e.GetType() == typeof(TException)));
 }
Exemplo n.º 5
0
 public static int GetIndexOfFirstExceptionThrown()
 {
     return(ExceptionsThrown.FindIndex(e => e != null));
 }
Exemplo n.º 6
0
 public Response CreateDefaultResponse()
 {
     DefaultResponseReturned++;
     ExceptionsThrown.Add(null);
     return(new Response());
 }