Example #1
0
    public void testSetGetOperations()
    {
        byte[] buff1 = new byte[4096];
        byte[] buff2 = new byte[4096];
        byte   t     = 0;
        int    i;

        Console.WriteLine("[executing test (testSetGetOperations)(TP_3.3.5.1)]");

        // verifying setMessageID/getMessageID reciprocity"
        m_MsgIn1.getHeader().getHeaderRec().setMessageID(5);
        Assert.AreEqual(5, m_MsgIn1.getHeader().getHeaderRec().getMessageID());
        m_MsgIn1.getHeader().getHeaderRec().setMessageID(1);
        Assert.AreEqual(1, m_MsgIn1.getHeader().getHeaderRec().getMessageID());

        // verifying set/getData reciprocity and getLength consistency"
        for (i = 0, t = 51; i < 4000; i++)
        {
            buff1[i] = t;
            t        = (byte)((t * 71) + 13);
            buff2[i] = t;
            t        = (byte)((t * 71) + 13);
        }
        m_MsgIn1.getBody8().getRecord8().setField1(-128);
        m_MsgIn1.getBody8().getRecord8().getVariableLengthField1().set(4000, buff1);
        m_MsgIn2.getBody8().getRecord8().setField1(127);
        m_MsgIn2.getBody8().getRecord8().getVariableLengthField1().set(4000, buff2);

        Assert.AreEqual(-128, m_MsgIn1.getBody8().getRecord8().getField1());
        Assert.AreEqual(4000, m_MsgIn1.getBody8().getRecord8().getVariableLengthField1().getLength());
        Assert.AreEqual(127, m_MsgIn2.getBody8().getRecord8().getField1());
        Assert.AreEqual(4000, m_MsgIn2.getBody8().getRecord8().getVariableLengthField1().getLength());

        for (i = 0; i < 4000; i++)
        {
            Assert.AreEqual(buff1[i], m_MsgIn1.getBody8().getRecord8().getVariableLengthField1().getData()[i]);
            Assert.AreEqual(buff2[i], m_MsgIn2.getBody8().getRecord8().getVariableLengthField1().getData()[i]);
        }
    }