Encode() public method

Encodes a C# object to a byte array using EBCDIC format. Main method.
 if the object to encode is not of the expected type  if the type field is unknown or unsupported
public Encode ( object field, Summer.Batch.Extra.Copybook.FieldFormat fieldFormat ) : byte[]
field object the object to encode
fieldFormat Summer.Batch.Extra.Copybook.FieldFormat the format of the field
return byte[]
Exemplo n.º 1
0
        public void EbcdicTestsTest()
        {
            FieldFormat binary = new FieldFormat
            {
                Decimal = 0,
                Size = "6",
                Type = "B"
            };
            EbcdicEncoder encoder = new EbcdicEncoder("ascii");
            EbcdicDecoder decoder = new EbcdicDecoder("ascii");

            decimal value1 = -1937m;
            decimal value2 = 1937m;
            Assert.AreEqual(value1, decoder.Decode(encoder.Encode(value1, binary), binary));
            Assert.AreEqual(value2, decoder.Decode(encoder.Encode(value2, binary), binary));
        }