Ejemplo n.º 1
0
        public static FileInfo LogResponse(ITestableHttpResponse response)
        {
            var path = Path.Combine(DefaultHttpResponseLogPath, $"response-{DateTime.UtcNow:yyyyMMdd-HHmmss}-{Interlocked.Increment(ref _counter):D5}.txt");

            File.WriteAllText(path, response.DumpToString());
            return(new FileInfo(path));
        }
Ejemplo n.º 2
0
        private static string CreateTrimmedDump(ITestableHttpResponse actualResponse, int maxLength)
        {
            var dump = actualResponse.DumpToString();

            if (dump.Length > maxLength)
            {
                dump = dump.Substring(0, maxLength) + "...";
            }
            return(dump);
        }
        public static ITestableHttpResponse PrintResponseInComments(this ITestableHttpResponse response)
        {
            var comment = $"Response for: {response.Request.Method} {response.Request.Uri}:\n{response.DumpToString()}";

            StepExecution.Current.Comment(comment);
            return(response);
        }