Ejemplo n.º 1
0
        public void ReadState()
        {
            var amsTestSocket = new AmsSocketTest();
            amsTestSocket.SendMessage = new byte[] {
                    0,0,32,0,0,0,5,1,204,123,1,1,33,3,10,0,0,120,
                    1,1,137,128,4,0,4,0,0,0,0,0,0,0,0,0,1,0,0,0};

            amsTestSocket.ReceiveMessage = new byte[] { 
                    0,0,40,0,0,0,10,0,0,120,1,1,137,128,5,1,204,123,1,1,
                    33,3,4,0,5,0,8,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,5,0,0,0};

            using (AdsClient client = new AdsClient(
                    amsNetIdSource: "10.0.0.120.1.1",
                    amsSocket: amsTestSocket,
                    amsNetIdTarget: "5.1.204.123.1.1"))
            {
                var state = client.ReadState();
                Assert.AreEqual(state.ToString(), "Ads state: 5 (Run) Device state: 0");
            }
        }