public void TestGetNewLeaseResponseConstructor() { Byte[] testArray = new Byte[14]; // First 4 bytes are for RequestId; testArray[0] = 0x00; testArray[1] = 0x00; testArray[2] = 0x17; // decimal 23 * 256 = 5888 testArray[3] = 0x70; // decimal 112 * 1 = 112, total of 6000 // Next comes the variable-length KLV Status Response, 1 byte for the Key, 4 bytes for length, and variable bytes for the message testArray[4] = 0x07; // Recoverable error message testArray[5] = 0x83; testArray[6] = 0x00; testArray[7] = 0x00; testArray[8] = 0x05; testArray[9] = 0x48; // "H" testArray[10] = 0x65; // "e" testArray[11] = 0x6C; // "l" testArray[12] = 0x6C; // "l" testArray[13] = 0x6F; // "o" AcspGetNewLeaseResponse leaseResponse = new AcspGetNewLeaseResponse(testArray); Assert.AreEqual((UInt32)6000, leaseResponse.RequestId); Assert.AreEqual(GeneralStatusResponseKey.RecoverableError, leaseResponse.StatusResponseKey); Assert.AreEqual("RecoverableError", leaseResponse.StatusResponseKeyString); Assert.AreEqual("Hello", leaseResponse.StatusResponseMessage); }
public void TestGetStatusResponseConstructor() { byte[] testArray = GetTestArrayForGenericResponse(); AcspGetNewLeaseResponse statusResponse = new AcspGetNewLeaseResponse(testArray); Assert.AreEqual((UInt32)6000, statusResponse.RequestId); Assert.AreEqual(GeneralStatusResponseKey.RecoverableError, statusResponse.StatusResponseKey); Assert.AreEqual("RecoverableError", statusResponse.StatusResponseKeyString); Assert.AreEqual("Hello", statusResponse.StatusResponseMessage); }