From fa82f892e44a58dbdf490efce32125a1c74f6505 Mon Sep 17 00:00:00 2001 From: Alexey Golub Date: Sun, 18 Aug 2019 01:35:48 +0300 Subject: [PATCH] Improve coverage for CommandOptionInputConverter --- .../CommandOptionInputConverterTests.cs | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/CliFx.Tests/CommandOptionInputConverterTests.cs b/CliFx.Tests/CommandOptionInputConverterTests.cs index feabaf9..725bd2f 100644 --- a/CliFx.Tests/CommandOptionInputConverterTests.cs +++ b/CliFx.Tests/CommandOptionInputConverterTests.cs @@ -89,18 +89,78 @@ namespace CliFx.Tests true ); + yield return new TestCaseData( + new CommandOptionInput("option", "a"), + typeof(char), + 'a' + ); + + yield return new TestCaseData( + new CommandOptionInput("option", "15"), + typeof(sbyte), + (sbyte) 15 + ); + + yield return new TestCaseData( + new CommandOptionInput("option", "15"), + typeof(byte), + (byte) 15 + ); + + yield return new TestCaseData( + new CommandOptionInput("option", "15"), + typeof(short), + (short) 15 + ); + + yield return new TestCaseData( + new CommandOptionInput("option", "15"), + typeof(ushort), + (ushort) 15 + ); + yield return new TestCaseData( new CommandOptionInput("option", "123"), typeof(int), 123 ); + yield return new TestCaseData( + new CommandOptionInput("option", "123"), + typeof(uint), + 123u + ); + + yield return new TestCaseData( + new CommandOptionInput("option", "123"), + typeof(long), + 123L + ); + + yield return new TestCaseData( + new CommandOptionInput("option", "123"), + typeof(ulong), + 123UL + ); + + yield return new TestCaseData( + new CommandOptionInput("option", "123.45"), + typeof(float), + 123.45f + ); + yield return new TestCaseData( new CommandOptionInput("option", "123.45"), typeof(double), 123.45 ); + yield return new TestCaseData( + new CommandOptionInput("option", "123.45"), + typeof(decimal), + 123.45m + ); + yield return new TestCaseData( new CommandOptionInput("option", "28 Apr 1995"), typeof(DateTime),