From 29fcdd87458c2dd14d3e58e4c89a239b23d1793d Mon Sep 17 00:00:00 2001 From: John Douglas Leitch Date: Mon, 9 Feb 2026 23:54:23 -0500 Subject: [PATCH] Updated ValuesUtilities.GetValuesFor to support all primitives. --- src/Xunit.Combinatorial/ValuesUtilities.cs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/Xunit.Combinatorial/ValuesUtilities.cs b/src/Xunit.Combinatorial/ValuesUtilities.cs index 82552e4..3176858 100644 --- a/src/Xunit.Combinatorial/ValuesUtilities.cs +++ b/src/Xunit.Combinatorial/ValuesUtilities.cs @@ -38,23 +38,20 @@ internal static class ValuesUtilities { Requires.NotNull(dataType, nameof(dataType)); - if (dataType == typeof(bool)) - { - yield return true; - yield return false; - } - else if (dataType == typeof(int)) - { - yield return 0; - yield return 1; - } - else if (dataType.GetTypeInfo().IsEnum) + if (dataType.GetTypeInfo().IsEnum) { foreach (string name in Enum.GetNames(dataType)) { yield return Enum.Parse(dataType, name); } } + else if (dataType.IsPrimitive) + { + foreach (var i in new[] { 0, 1 }) + { + yield return Convert.ChangeType(i, dataType); + } + } else if (IsNullable(dataType, out Type? innerDataType)) { yield return null;