示例#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);
示例#3
0
 public void Format_X(TextTestData <sbyte> data) => RunTest(data, new SByteUtf8Converter('X'));
示例#4
0
 public void Format_X(TextTestData <long> data) => RunTest(data, new Int64Utf8Converter('X'));
示例#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'));
示例#8
0
 public void Format_N(TextTestData <Guid> data) => RunTest(data, new GuidUtf8Converter('N'));
示例#9
0
 public void Format_LittleE(TextTestData <float> data) => RunTest(data, new SingleUtf8Converter('e'));
示例#10
0
 public void Format_G(TextTestData <float> data) => RunTest(data);
示例#11
0
 public void Test(TextTestData <string> data) => RunTest(data);
示例#12
0
 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'));
示例#17
0
 public void Format_D(TextTestData <Guid> data) => RunTest(data);
示例#18
0
 public void Format_G(TextTestData <double> data) => RunTest(data);
 public void Format_N(TextTestData <uint> data) => RunTest(data, new UInt32Utf8Converter('N'));
示例#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'));
示例#22
0
 public void Format_LittleE(TextTestData <double> data) => RunTest(data, new DoubleUtf8Converter('e'));
示例#23
0
 public void Format_X(TextTestData <short> data) => RunTest(data, new Int16Utf8Converter('X'));
示例#24
0
 public void Format_G(TextTestData <decimal> data) => RunTest(data);
示例#25
0
 public void Format_D(TextTestData <long> data) => RunTest(data);
示例#26
0
 public void Format_LittleE(TextTestData <decimal> data) => RunTest(data, new DecimalUtf8Converter('e'));
示例#27
0
 public void Format_D(TextTestData <sbyte> data) => RunTest(data);
 public void Format_G(TextTestData <bool> data) => RunTest(data);
示例#29
0
 public void Format_D(TextTestData <short> data) => RunTest(data);
 public void Format_LittleL(TextTestData <DateTime> data) => RunTest(data, new DateTimeUtf8Converter('l'));