Пример #1
0
        static TextConverterTest()
        {
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
            Encoding = Encoding.GetEncoding(932);

            EmptyBytes    = TestBytes.Offset(Offset, Encoding.GetBytes(string.Empty.PadRight(Length, ' ')));
            ValueBytes    = TestBytes.Offset(Offset, Encoding.GetBytes(Value.PadRight(Length - (Encoding.GetByteCount(Value) - Value.Length), ' ')));
            OverflowBytes = TestBytes.Offset(Offset, Encoding.GetBytes(OverflowValue.Substring(0, Length)));
        }
 static UnicodeConverterTest()
 {
     EmptyBytes    = TestBytes.Offset(Offset, Encoding.Unicode.GetBytes(string.Empty.PadRight(Length / 2, ' ')));
     ValueBytes    = TestBytes.Offset(Offset, Encoding.Unicode.GetBytes(Value.PadRight(Length / 2, ' ')));
     OverflowBytes = TestBytes.Offset(Offset, Encoding.Unicode.GetBytes(OverflowValue.Substring(0, Length / 2)));
 }
 static BytesConverterTest()
 {
     ValueBytes      = TestBytes.Offset(Offset, Value);
     ShortValueBytes = TestBytes.Offset(Offset, ShortValue.Combine(new byte[Length - ShortValue.Length]));
     EmptyBytes      = TestBytes.Offset(Offset, new byte[Length]);
 }
 static AsciiConverterTest()
 {
     EmptyBytes    = TestBytes.Offset(Offset, Encoding.ASCII.GetBytes(string.Empty.PadRight(Length, ' ')));
     ValueBytes    = TestBytes.Offset(Offset, Encoding.ASCII.GetBytes(Value.PadRight(Length, ' ')));
     OverflowBytes = TestBytes.Offset(Offset, Encoding.ASCII.GetBytes(OverflowValue.Substring(0, Length)));
 }