| | 1 | | using ValidateLib.ErrorsAndWarnings.Errors.Specific; |
| | 2 | | using ValidateLib.Metadata.Descriptors; |
| | 3 | | using ValidateLib.TabularData.Datatypes.NumericDatatypes; |
| | 4 | |
|
| | 5 | | namespace DatatypeTests |
| | 6 | | { |
| | 7 | | public class NonNegativeIntegerTests |
| | 8 | | { |
| | 9 | |
|
| | 10 | |
|
| | 11 | | [Theory] |
| | 12 | | [InlineData("+3")] |
| | 13 | | [InlineData("122")] |
| | 14 | | [InlineData("0")] |
| | 15 | | [InlineData("00123")] |
| | 16 | | public void ValidNonNegativeIntegerWithoutPatternTest(string stringValue) |
| 1 | 17 | | { |
| 1 | 18 | | NonNegativeIntegerDT nni = new NonNegativeIntegerDT(stringValue); |
| 1 | 19 | | } |
| | 20 | |
|
| | 21 | | [Theory] |
| | 22 | | [InlineData("not a decimal")] |
| | 23 | | [InlineData("-3.0")] |
| | 24 | | [InlineData("-30")] |
| | 25 | | [InlineData("")] |
| | 26 | |
|
| | 27 | | public void NonNegativeIntegerWithoutPatternInvalidValues(string stringValue) |
| 1 | 28 | | { |
| 1 | 29 | | Assert.Throws<DatatypeValidationError>(() => new NonNegativeIntegerDT(stringValue)); |
| 1 | 30 | | } |
| | 31 | |
|
| | 32 | | [Theory] |
| | 33 | | [InlineData("+1;0;0", ";", null)] |
| | 34 | | [InlineData("+1,0,0", ",", null)] |
| | 35 | |
|
| | 36 | | public void NonNegativeIntegerWithFormatWithoutPatternValidValues(string stringValue, string? groupChar, string? |
| 1 | 37 | | { |
| 1 | 38 | | FormatDescriptor format = new FormatDescriptor |
| 1 | 39 | | { |
| 1 | 40 | | groupChar = groupChar, |
| 1 | 41 | | decimalChar = decimalChar, |
| 1 | 42 | | }; |
| | 43 | |
|
| 1 | 44 | | var shortdt = new NonNegativeIntegerDT(stringValue, format); |
| 1 | 45 | | } |
| | 46 | |
|
| | 47 | | } |
| | 48 | | } |