| | 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 ByteTests |
| | 8 | | { |
| | 9 | |
|
| | 10 | |
|
| | 11 | | [Theory] |
| | 12 | | [InlineData("+122")] |
| | 13 | | [InlineData("-3")] |
| | 14 | | [InlineData("015")] |
| | 15 | | [InlineData("127")] |
| | 16 | | [InlineData("-128")] |
| | 17 | | public void ValidByteWithoutPatternTest(string stringValue) |
| 1 | 18 | | { |
| 1 | 19 | | ByteDT bytedt = new ByteDT(stringValue); |
| 1 | 20 | | } |
| | 21 | |
|
| | 22 | | [Theory] |
| | 23 | | [InlineData("not a decimal")] |
| | 24 | | [InlineData("128")] |
| | 25 | | [InlineData("-129")] |
| | 26 | | [InlineData("3.0")] |
| | 27 | | [InlineData("")] |
| | 28 | |
|
| | 29 | | public void ByteWithoutPatternInvalidValues(string stringValue) |
| 1 | 30 | | { |
| 1 | 31 | | Assert.Throws<DatatypeValidationError>(() => new ByteDT(stringValue)); |
| 1 | 32 | | } |
| | 33 | |
|
| | 34 | | [Theory] |
| | 35 | | [InlineData("+1;0;0", ";", null)] |
| | 36 | | [InlineData("+1,0,0", ",", null)] |
| | 37 | |
|
| | 38 | | public void ByteWithFormatWithoutPatternValidValues(string stringValue, string? groupChar, string? decimalChar) |
| 1 | 39 | | { |
| 1 | 40 | | FormatDescriptor format = new FormatDescriptor |
| 1 | 41 | | { |
| 1 | 42 | | groupChar = groupChar, |
| 1 | 43 | | decimalChar = decimalChar, |
| 1 | 44 | | }; |
| | 45 | |
|
| 1 | 46 | | var bytedt = new ByteDT(stringValue, format); |
| 1 | 47 | | } |
| | 48 | |
|
| | 49 | | } |
| | 50 | | } |