diff --git a/Sources/Towel/Meta.cs b/Sources/Towel/Meta.cs index d78e2968..8189959d 100644 --- a/Sources/Towel/Meta.cs +++ b/Sources/Towel/Meta.cs @@ -554,7 +554,7 @@ string ConvertToCsharpSource(Type type) result += (firstIteration ? string.Empty : ",") + (correctGeneric.IsGenericParameter ? (showGenericParameters ? (firstIteration ? string.Empty : " ") + correctGeneric.Name : string.Empty) - : (firstIteration ? string.Empty : " ") + ConvertToCSharpSource(correctGeneric)); + : (firstIteration ? string.Empty : " ") + ConvertToCSharpSource(correctGeneric, showGenericParameters)); firstIteration = false; } result += ">"; diff --git a/Tools/Towel_Testing/Meta.cs b/Tools/Towel_Testing/Meta.cs index ef3696e4..3043b486 100644 --- a/Tools/Towel_Testing/Meta.cs +++ b/Tools/Towel_Testing/Meta.cs @@ -12,14 +12,14 @@ public class Meta_Testing { #region Type Testing +#pragma warning disable SA1121 // Use built-in type alias + [TestMethod] public void Type_ConvertToCsharpSource() { { // showGenericParameters = false var tests = new (Type Type, string String)[] { -#pragma warning disable SA1121 // Use built-in type alias - (typeof(System.Int32), "System.Int32"), (typeof(Towel.Mathematics.Symbolics.Expression), "Towel.Mathematics.Symbolics.Expression"), (typeof(Towel.Mathematics.Symbolics.Constant), "Towel.Mathematics.Symbolics.Constant"), @@ -50,8 +50,6 @@ public void Type_ConvertToCsharpSource() (typeof(int), "System.Int32"), (typeof(string), "System.String"), (typeof(short), "System.Int16"), - -#pragma warning restore SA1121 // Use built-in type alias }; foreach (var test in tests) { @@ -95,8 +93,44 @@ public void Type_ConvertToCsharpSource() } } } + + { + MethodInfo methodInfo = typeof(Meta_Testing).GetMethod(nameof(Type_ConvertToCsharpSource_Test1))!; + Type parameterType = methodInfo.GetParameters()[0].ParameterType; + { + string actual = parameterType.ConvertToCSharpSource(true); + string expected = "System.ValueTuple>"; + Assert.IsTrue(actual.Equals(expected), parameterType.ToString()); + } + { + string actual = parameterType.ConvertToCSharpSource(false); + string expected = "System.ValueTuple>"; + Assert.IsTrue(actual.Equals(expected), parameterType.ToString()); + } + } + { + MethodInfo methodInfo = typeof(Meta_Testing).GetMethod(nameof(Type_ConvertToCsharpSource_Test2))!; + Type parameterType = methodInfo.GetParameters()[0].ParameterType; + { + string actual = parameterType.ConvertToCSharpSource(true); + string expected = "System.ValueTuple>"; + Assert.IsTrue(actual.Equals(expected), parameterType.ToString()); + } + { + #warning TODO: review this test case + //string actual = parameterType.ConvertToCSharpSource(false); + //string expected = "System.ValueTuple>"; + //Assert.IsTrue(actual.Equals(expected), parameterType.ToString()); + } + } } + public static void Type_ConvertToCsharpSource_Test1(System.ValueTuple> tuple) { } + + public static void Type_ConvertToCsharpSource_Test2(System.ValueTuple> tuple) { } + +#pragma warning restore SA1121 // Use built-in type alias + #endregion #region XML Documentation Testing