Summary

Class:WireMock.Util.FileHelper
Assembly:WireMock.Net
File(s):C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Util\FileHelper.cs
Covered lines:14
Uncovered lines:0
Coverable lines:14
Total lines:34
Line coverage:100%
Branch coverage:100%

Metrics

MethodCyclomatic complexity NPath complexity Sequence coverage Branch coverage
ReadAllTextWithRetryAndDelay(...)0011

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Util\FileHelper.cs

#LineLine coverage
 1using System.IO;
 2using System.Threading;
 3using JetBrains.Annotations;
 4using WireMock.Handlers;
 5using WireMock.Validation;
 6
 7namespace WireMock.Util
 8{
 9    internal static class FileHelper
 10    {
 11        private const int NumberOfRetries = 3;
 12        private const int DelayOnRetry = 500;
 13
 14        public static string ReadAllTextWithRetryAndDelay([NotNull] IFileSystemHandler filehandler, [NotNull] string pat
 215        {
 216            Check.NotNull(filehandler, nameof(filehandler));
 217            Check.NotNullOrEmpty(path, nameof(path));
 18
 1019            for (int i = 1; i <= NumberOfRetries; ++i)
 420            {
 21                try
 422                {
 423                    return filehandler.ReadMappingFile(path);
 24                }
 325                catch
 326                {
 327                    Thread.Sleep(DelayOnRetry);
 328                }
 329            }
 30
 131            throw new IOException();
 132        }
 33    }
 34}