Summary

Class:WireMock.Util.FileHelper
Assembly:WireMock.Net
File(s):C:\Users\azureuser\Documents\Github\WireMock.Net\src\WireMock.Net\Util\FileHelper.cs
Covered lines:6
Uncovered lines:6
Coverable lines:12
Total lines:29
Line coverage:50%
Branch coverage:50%

Metrics

MethodCyclomatic complexity  NPath complexity  Sequence coverage  Branch coverage  
ReadAllText(...)225066.67

File(s)

C:\Users\azureuser\Documents\Github\WireMock.Net\src\WireMock.Net\Util\FileHelper.cs

#LineLine coverage
 1using System.IO;
 2using System.Threading;
 3
 4namespace WireMock.Util
 5{
 6    internal static class FileHelper
 7    {
 8        private const int NumberOfRetries = 3;
 9        private const int DelayOnRetry = 500;
 10
 11        public static string ReadAllText(string path)
 412        {
 813             for (int i = 1; i <= NumberOfRetries; ++i)
 414            {
 15                try
 416                {
 417                    return File.ReadAllText(path);
 18                }
 019                catch
 020                {
 21                    // You may check error code to filter some exceptions, not every error can be recovered.
 022                    Thread.Sleep(DelayOnRetry);
 023                }
 024            }
 25
 026            throw new IOException();
 427        }
 28    }
 29}

Methods/Properties

ReadAllText(System.String)