Allow Timeout.InfiniteTimeSpan for WithDelay (#746)

* Update WithDelay

* Allow Timeout.InfiniteTimeSpan for WithDelay
This commit is contained in:
Stef Heyenrath
2022-04-18 20:55:23 +02:00
committed by GitHub
parent 5da6e103ba
commit 9d54994747
4 changed files with 42 additions and 15 deletions

View File

@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using Stef.Validation;
using WireMock.Admin.Mappings;
using WireMock.Matchers.Request;
@@ -90,7 +92,7 @@ namespace WireMock.Serialization
}
else
{
mappingModel.Response.Delay = (int?)response.Delay?.TotalMilliseconds;
mappingModel.Response.Delay = (int?)(response.Delay == Timeout.InfiniteTimeSpan ? TimeSpan.MaxValue.TotalMilliseconds : response.Delay?.TotalMilliseconds);
}
if (mapping.Webhooks?.Length == 1)