Пример #1
0
    public void testSetGetOperations()
    {
        byte[] data = new byte[10] {
            0, 1, 2, 3, 4, 5, 6, 7, 8, 9
        };
        Console.WriteLine("[executing test (testSetGetOperations)(TP_3.3.5.1)]");

        Assert.AreEqual(0, m_MsgIn1.getBody9().getRecord9().getPresenceVector());

        // Set the first entry in the record.
        // verifying optional fixed field handling"
        Assert.AreEqual(false, m_MsgIn1.getBody9().getRecord9().isField1Valid());
        m_MsgIn1.getBody9().getRecord9().setField1(5);
        Assert.AreEqual(true, m_MsgIn1.getBody9().getRecord9().isField1Valid());
        Assert.AreEqual(1, m_MsgIn1.getBody9().getRecord9().getPresenceVector());

        // verifying optional variable length field handling"
        Assert.AreEqual(false, m_MsgIn1.getBody9().getRecord9().isVariableLengthField1Valid());
        MsgIn.Body9.Record9.VariableLengthField1 vl1 = new MsgIn.Body9.Record9.VariableLengthField1();
        vl1.set(10, data);
        m_MsgIn1.getBody9().getRecord9().setVariableLengthField1(vl1);
        Assert.AreEqual(true, m_MsgIn1.getBody9().getRecord9().isVariableLengthField1Valid());
        Assert.AreEqual(3, m_MsgIn1.getBody9().getRecord9().getPresenceVector());

        // verifying optional array handling"
        Assert.AreEqual(false, m_MsgIn1.getBody9().getRecord9().isArray1Valid());
        MsgIn.Body9.Record9.Array1 array1 = new MsgIn.Body9.Record9.Array1();
        array1.setElement1(0, 0);
        m_MsgIn1.getBody9().getRecord9().setArray1(array1);
        Assert.AreEqual(true, m_MsgIn1.getBody9().getRecord9().isArray1Valid());
        Assert.AreEqual(7, m_MsgIn1.getBody9().getRecord9().getPresenceVector());

        // verifying optional bitfield handling"
        Assert.AreEqual(false, m_MsgIn1.getBody9().getRecord9().isBitField1Valid());
        MsgIn.Body9.Record9.BitField1 bf1 = new MsgIn.Body9.Record9.BitField1();
        bf1.setSubfield1(1);
        m_MsgIn1.getBody9().getRecord9().setBitField1(bf1);
        Assert.AreEqual(true, m_MsgIn1.getBody9().getRecord9().isBitField1Valid());
        Assert.AreEqual(15, m_MsgIn1.getBody9().getRecord9().getPresenceVector());

        // verifying optional fixed length string handling"
        Assert.AreEqual(false, m_MsgIn1.getBody9().getRecord9().isFixedLengthString1Valid());
        m_MsgIn1.getBody9().getRecord9().setFixedLengthString1("wtf");
        Assert.AreEqual(true, m_MsgIn1.getBody9().getRecord9().isFixedLengthString1Valid());
        Assert.AreEqual(31, m_MsgIn1.getBody9().getRecord9().getPresenceVector());

        // verifying optional variable field handling"
        Assert.AreEqual(false, m_MsgIn1.getBody9().getRecord9().isVariableField1Valid());
        MsgIn.Body9.Record9.VariableField1 vf1 = new MsgIn.Body9.Record9.VariableField1();
        vf1.setOneAsUnsignedByteAt0(1);
        m_MsgIn1.getBody9().getRecord9().setVariableField1(vf1);
        Assert.AreEqual(true, m_MsgIn1.getBody9().getRecord9().isVariableField1Valid());
        Assert.AreEqual(63, m_MsgIn1.getBody9().getRecord9().getPresenceVector());

        // verifying optional variable length string handling"
        Assert.AreEqual(false, m_MsgIn1.getBody9().getRecord9().isVariableLengthString1Valid());
        m_MsgIn1.getBody9().getRecord9().setVariableLengthString1("jts");
        Assert.AreEqual(true, m_MsgIn1.getBody9().getRecord9().isVariableLengthString1Valid());
        Assert.AreEqual(127, m_MsgIn1.getBody9().getRecord9().getPresenceVector());

        // verifying optional variable format field handling"
        Assert.AreEqual(false, m_MsgIn1.getBody9().getRecord9().isVariableFormatField1Valid());
        MsgIn.Body9.Record9.VariableFormatField1 vff1 = new MsgIn.Body9.Record9.VariableFormatField1();
        vff1.set(0, 10, data);
        m_MsgIn1.getBody9().getRecord9().setVariableFormatField1(vff1);
        Assert.AreEqual(true, m_MsgIn1.getBody9().getRecord9().isVariableFormatField1Valid());
        Assert.AreEqual(255, m_MsgIn1.getBody9().getRecord9().getPresenceVector());
    }