Exemple #1
0
        protected void RunTest(TextTestData <T> test, ValueConverter <T> converter = null)
        {
            switch (test.Type)
            {
            case TestType.FailRead:
                Assert.Throws <SerializationException>(() => _serializer.ReadUtf16 <T>(test.String, converter));
                break;

            case TestType.FailWrite:
                Assert.Throws <SerializationException>(() => _serializer.WriteUtf16String(test.Value, converter));
                break;

            case TestType.Read:
                Assert.Equal(test.Value, _serializer.ReadUtf16 <T>(test.String, converter), _comparer);
                break;

            case TestType.Write:
                Assert.Equal(test.String, _serializer.WriteUtf16String(test.Value, converter));
                break;

            case TestType.ReadWrite:
                Assert.Equal(test.Value, _serializer.ReadUtf16 <T>(test.String, converter), _comparer);
                Assert.Equal(test.String, _serializer.WriteUtf16String(test.Value, converter));
                break;
            }
        }
 public void Format_G(TextTestData <DateTimeOffset> data) => RunTest(data);
Exemple #3
0
 public void Format_X(TextTestData <sbyte> data) => RunTest(data, new SByteUtf8Converter('X'));
Exemple #4
0
 public void Format_X(TextTestData <long> data) => RunTest(data, new Int64Utf8Converter('X'));
Exemple #5
0
 public void Format_X(TextTestData <int> data) => RunTest(data, new Int32Utf8Converter('X'));
 public void Format_N(TextTestData <ushort> data) => RunTest(data, new UInt16Utf8Converter('N'));
 public void Format_N(TextTestData <ulong> data) => RunTest(data, new UInt64Utf8Converter('N'));
 public void Format_N(TextTestData <Guid> data) => RunTest(data, new GuidUtf8Converter('N'));
Exemple #9
0
 public void Format_LittleE(TextTestData <float> data) => RunTest(data, new SingleUtf8Converter('e'));
Exemple #10
0
 public void Format_G(TextTestData <float> data) => RunTest(data);
 public void Test(TextTestData <string> data) => RunTest(data);
 public void Test(TextTestData <char> data) => RunTest(data);
 public void Format_LittleG(TextTestData <TimeSpan> data) => RunTest(data, new TimeSpanUtf8Converter('g'));
 public void Format_LittleC(TextTestData <TimeSpan> data) => RunTest(data);
 public void Format_O(TextTestData <DateTimeOffset> data) => RunTest(data, new DateTimeOffsetUtf8Converter('O'));
 public void Format_LittleL(TextTestData <bool> data) => RunTest(data, new BooleanUtf8Converter('l'));
 public void Format_D(TextTestData <Guid> data) => RunTest(data);
Exemple #18
0
 public void Format_G(TextTestData <double> data) => RunTest(data);
 public void Format_N(TextTestData <uint> data) => RunTest(data, new UInt32Utf8Converter('N'));
Exemple #20
0
 public void Format_F(TextTestData <double> data) => RunTest(data, new DoubleUtf8Converter('F'));
 public void Format_N(TextTestData <byte> data) => RunTest(data, new ByteUtf8Converter('N'));
Exemple #22
0
 public void Format_LittleE(TextTestData <double> data) => RunTest(data, new DoubleUtf8Converter('e'));
Exemple #23
0
 public void Format_X(TextTestData <short> data) => RunTest(data, new Int16Utf8Converter('X'));
Exemple #24
0
 public void Format_G(TextTestData <decimal> data) => RunTest(data);
Exemple #25
0
 public void Format_D(TextTestData <long> data) => RunTest(data);
Exemple #26
0
 public void Format_LittleE(TextTestData <decimal> data) => RunTest(data, new DecimalUtf8Converter('e'));
Exemple #27
0
 public void Format_D(TextTestData <sbyte> data) => RunTest(data);
 public void Format_G(TextTestData <bool> data) => RunTest(data);
Exemple #29
0
 public void Format_D(TextTestData <short> data) => RunTest(data);
 public void Format_LittleL(TextTestData <DateTime> data) => RunTest(data, new DateTimeUtf8Converter('l'));