示例#1
0
        private void TestRead()
        {
            //myMachine.ReadData( myPipeDataBlock );
            IBlockDescription dataAddress = new FacadeBlockDescription(int.MaxValue, int.MaxValue, short.MaxValue);

            myMachine.ReadData(out object data, dataAddress, myInterface);
        }
示例#2
0
        public void GoTest()
        {
            FacadeApplicationLayerMaster m_Master = new FacadeApplicationLayerMaster();
            string m_MasterToString  = m_Master.ToString();
            GuardedDataProvider m_gp = new GuardedDataProvider("GoTest", m_Master);
            string m_gpToString      = m_gp.ToString();

            Assert.AreEqual(m_gpToString, m_MasterToString, "ToString error");
            StringAddress m_address = new StringAddress("DummyAddress");

            Assert.IsFalse(m_gp.Connected, "State error");
            m_gp.ConnectReq(m_address);
            Assert.IsTrue(m_gp.Connected, "State error");
            FacadeBlockDescription m_block = new FacadeBlockDescription(int.MaxValue, 100, short.MaxValue);
            IReadValue             m_readVal;

            switch (m_gp.ReadData(m_block, int.MaxValue, out m_readVal, byte.MaxValue))
            {
            case AL_ReadData_Result.ALRes_DatTransferErrr:
            case AL_ReadData_Result.ALRes_DisInd:
                Assert.Fail("incorrect return value from ReadData");
                break;

            case AL_ReadData_Result.ALRes_Success:
                Assert.IsNotNull(m_readVal, "ReadData returned null");
                m_readVal.ReturnEmptyEnvelope();
                break;
            }
            Assert.IsTrue(m_gp.Connected, "State error");
            IWriteValue m_writeVal = m_gp.GetEmptyWriteDataBuffor(m_block, int.MaxValue);

            m_writeVal.WriteValue(int.MaxValue, 0);
            switch (m_gp.WriteData(ref m_writeVal, byte.MaxValue))
            {
            case AL_ReadData_Result.ALRes_DatTransferErrr:
            case AL_ReadData_Result.ALRes_DisInd:
                Assert.Fail("incorrect return value from ReadData");
                break;

            case AL_ReadData_Result.ALRes_Success:
                Assert.IsNull(m_writeVal, "WriteData has not returned the envelope to a pool");
                break;
            }
            Assert.IsTrue(m_gp.Connected, "State error");
            m_gp.DisReq();
            Assert.IsFalse(m_gp.Connected, "State error");
            m_gp.Dispose();
        }