public async Task CmdStnSoftwareVersionReqResponseTestMethod() { const string expectedMessage = "Version: 6.9"; byte[] responseMessageBytes = new byte[] { 0x63, 0x21, 0x69, 0x01, 0x2a }; var reqStream = new MemoryStream(); var respStream = new MemoryStream(responseMessageBytes); var msgReq = new CmdStnSoftwareVersionReqMessage(); var response = msgReq.WriteAsync(reqStream, true); await PacketHandler.ReadPacketAsync(respStream); var result = string.Empty; var resp = response.Result as CmdStnSoftwareVersionResp; if (resp != null) { var newResponse = resp; result = string.Format("Version: {0}.{1}", newResponse.Major, newResponse.Minor); } Assert.AreEqual(expectedMessage, result); }
public async Task CmdStnSoftwareVersionReqValidTestMethod() { var expectedMessageBytes = new byte[] { 0x21, 0x21, 0x00}; var testStream = new MemoryStream(); var msgReq = new CmdStnSoftwareVersionReqMessage(); await msgReq.WriteAsync(testStream); var actualMessageBytes = ReadStream(testStream); CollectionAssert.AreEqual(expectedMessageBytes, actualMessageBytes, string.Format("message not valid, expected {0}, received {1}", ByteArrayToString(expectedMessageBytes), ByteArrayToString(actualMessageBytes))); }