Пример #1
0
 /// <summary>
 /// Creates an instance of <see cref="AssertException"/>.
 /// </summary>
 /// <param name="response">The client response.</param>
 /// <param name="message">The message that describes the error.</param>
 /// <param name="innerException">The inner exception.</param>
 /// <returns>An assert exception.</returns>
 public static AssertException Create(ClientResponse response, string message, Exception innerException)
 {
     message = ExtendMessage(response, message);
     return new AssertException(message, innerException);
 }
Пример #2
0
        private static string ExtendMessage(ClientResponse response, string message)
        {
            using (var writer = new StringWriter())
            {
                writer.WriteLine(message + Environment.NewLine);
                writer.WriteLine("Raw HTTP request:" + Environment.NewLine);
                writer.WriteLine(response.RawHttpRequest);
                writer.WriteLine("Raw HTTP response:" + Environment.NewLine);
                writer.WriteLine(response.RawHttpResponse);

                return writer.ToString();
            }
        }
Пример #3
0
 /// <summary>
 /// Creates an instance of <see cref="AssertException"/>.
 /// </summary>
 /// <param name="response">The client response.</param>
 /// <param name="message">The message that describes the error.</param>
 /// <param name="args">An object array that contains zero or more object to format.</param>
 /// <returns>An assert exception.</returns>
 public static AssertException Create(ClientResponse response, string message, params object[] args)
 {
     message = ExtendMessage(response, string.Format(message, args));
     return new AssertException(message);
 }