public void ReadStateAsync() { 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 task = client.ReadStateAsync(); task.Wait(5000); var state = task.Result; Assert.AreEqual(state.ToString(), "Ads state: 5 (Run) Device state: 0"); } }
public void ReadStateAsync() { 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 task = client.ReadStateAsync(); task.Wait(5000); var state = task.Result; Assert.AreEqual(state.ToString(), "Ads state: 5 (Run) Device state: 0"); } }