IPropertyBagDataExtensions
Extensions to IPropertyBag.
using NUnit.Framework.Interfaces;
using System;
using System.Runtime.CompilerServices;
namespace NUnit.Framework.Internal.Extensions
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
internal static class IPropertyBagDataExtensions
{
internal static void AddIgnoreUntilReason(this IPropertyBag properties, DateTimeOffset untilDate, [System.Runtime.CompilerServices.Nullable(2)] string reason)
{
string value = (reason == null) ? $"""{untilDate:""}""" : $"""{untilDate:""}""{reason}";
properties.Set("_SKIPREASON", value);
}
internal static T TryGet<[System.Runtime.CompilerServices.Nullable(2)] T>(this IPropertyBag properties, string key, T defaultValue)
{
object obj = properties.Get(key);
if (obj != null)
return (T)obj;
return defaultValue;
}
}
}