Improve coverage for CommandOptionInputConverter

This commit is contained in:
Alexey Golub
2019-08-18 01:35:48 +03:00
parent 5a696c181b
commit fa82f892e4

View File

@@ -89,18 +89,78 @@ namespace CliFx.Tests
true 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( yield return new TestCaseData(
new CommandOptionInput("option", "123"), new CommandOptionInput("option", "123"),
typeof(int), typeof(int),
123 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( yield return new TestCaseData(
new CommandOptionInput("option", "123.45"), new CommandOptionInput("option", "123.45"),
typeof(double), typeof(double),
123.45 123.45
); );
yield return new TestCaseData(
new CommandOptionInput("option", "123.45"),
typeof(decimal),
123.45m
);
yield return new TestCaseData( yield return new TestCaseData(
new CommandOptionInput("option", "28 Apr 1995"), new CommandOptionInput("option", "28 Apr 1995"),
typeof(DateTime), typeof(DateTime),