Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Apr 4, 2024
1 parent 0c99d8e commit 2334ecc
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 37 deletions.
20 changes: 11 additions & 9 deletions src/Verify/Counter_Date.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,19 @@ internal static void AddNamed(Date value, string name)

return dateCache.GetOrAdd(
input,
_ =>
{
var value = Interlocked.Increment(ref currentDate);
_ => BuildDateValue());
}

(int intValue, string stringValue) BuildDateValue()
{
var value = Interlocked.Increment(ref currentDate);

if (dateCounting)
{
return (value, $"Date_{value}");
}
if (dateCounting)
{
return (value, $"Date_{value}");
}

return (value, "{Scrubbed}");
});
return (value, "{Scrubbed}");
}
}
#endif
20 changes: 11 additions & 9 deletions src/Verify/Counter_DateTime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,18 @@ internal static void AddNamed(DateTime value, string name)

return dateTimeCache.GetOrAdd(
input,
_ =>
{
var value = Interlocked.Increment(ref currentDateTime);
_ => BuildDateTimeValue());
}

(int intValue, string stringValue) BuildDateTimeValue()
{
var value = Interlocked.Increment(ref currentDateTime);

if (dateCounting)
{
return (value, $"DateTime_{value}");
}
if (dateCounting)
{
return (value, $"DateTime_{value}");
}

return (value, "{Scrubbed}");
});
return (value, "{Scrubbed}");
}
}
20 changes: 11 additions & 9 deletions src/Verify/Counter_DateTimeOffset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,18 @@ internal static void AddNamed(DateTimeOffset value, string name)

return dateTimeOffsetCache.GetOrAdd(
input,
_ =>
{
var value = Interlocked.Increment(ref currentDateTimeOffset);
_ => BuildDateTimeOffsetValue());
}

(int intValue, string stringValue) BuildDateTimeOffsetValue()
{
var value = Interlocked.Increment(ref currentDateTimeOffset);

if (dateCounting)
{
return (value, $"DateTimeOffset_{value}");
}
if (dateCounting)
{
return (value, $"DateTimeOffset_{value}");
}

return (value, "{Scrubbed}");
});
return (value, "{Scrubbed}");
}
}
12 changes: 7 additions & 5 deletions src/Verify/Counter_Guid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ internal static void AddNamed(Guid value, string name)

return guidCache.GetOrAdd(
input,
_ =>
{
var value = Interlocked.Increment(ref currentGuid);
return (value, $"Guid_{value}");
});
_ => BuildGuidValue());
}

(int intValue, string stringValue) BuildGuidValue()
{
var value = Interlocked.Increment(ref currentGuid);
return (value, $"Guid_{value}");
}
}
12 changes: 7 additions & 5 deletions src/Verify/Counter_Time.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ internal static void AddNamed(Time time, string name)

return timeCache.GetOrAdd(
input,
_ =>
{
var value = Interlocked.Increment(ref currentTime);
return (value, $"Time_{value}");
});
_ => BuildTimeValue());
}

(int intValue, string stringValue) BuildTimeValue()
{
var value = Interlocked.Increment(ref currentTime);
return (value, $"Time_{value}");
}
}
#endif

0 comments on commit 2334ecc

Please sign in to comment.