| | 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 LongTests |
| | 8 | | { |
| | 9 | |
|
| | 10 | |
|
| | 11 | | [Theory] |
| | 12 | | [InlineData("+122")] |
| | 13 | | [InlineData("00122")] |
| | 14 | | [InlineData("0")] |
| | 15 | | [InlineData("-1231235555")] |
| | 16 | | public void ValidLongnWithoutPatternTest(string stringValue) |
| 1 | 17 | | { |
| 1 | 18 | | LongDT longdt = new LongDT(stringValue); |
| 1 | 19 | | } |
| | 20 | |
|
| | 21 | | [Theory] |
| | 22 | | [InlineData("not a decimal")] |
| | 23 | | [InlineData("9223372036854775810")] |
| | 24 | | [InlineData("3.0")] |
| | 25 | | [InlineData("")] |
| | 26 | |
|
| | 27 | | public void LongWithoutPatternInvalidValues(string stringValue) |
| 1 | 28 | | { |
| 1 | 29 | | Assert.Throws<DatatypeValidationError>(() => new LongDT(stringValue)); |
| 1 | 30 | | } |
| | 31 | |
|
| | 32 | | [Theory] |
| | 33 | | [InlineData("+10;00;00", ";", null)] |
| | 34 | | [InlineData("+10,000,000", ",", null)] |
| | 35 | |
|
| | 36 | | public void LongWithFormatWithoutPatternValidValues(string stringValue, string? groupChar, string? decimalChar) |
| 1 | 37 | | { |
| 1 | 38 | | FormatDescriptor format = new FormatDescriptor |
| 1 | 39 | | { |
| 1 | 40 | | groupChar = groupChar, |
| 1 | 41 | | decimalChar = decimalChar, |
| 1 | 42 | | }; |
| | 43 | |
|
| 1 | 44 | | var integerdt = new LongDT(stringValue, format); |
| 1 | 45 | | } |
| | 46 | |
|
| | 47 | | } |
| | 48 | | } |