public void StripHeaderShouldReturnCorrectHeaderStruct() { // create a data list with enough bytes List <byte> data = new List <byte> (); data.Insert(0, UpdateManager.PROTOCOL_VERSION); //insert the valid protocol type data.Insert(1, UpdateManager.PLAYER); // insert any update identifier // strip the header into a struct HeaderManager.Header result = HeaderManager.StripHeader(data); // shold return the right header struct for these bytes HeaderManager.Header expected = new HeaderManager.Header(UpdateManager.PROTOCOL_VERSION, UpdateManager.PLAYER); Assert.AreEqual(expected, result); }
public void StripHeaderShouldLookAtFirstTwoBytes() { // create a data list with enough bytes List <byte> data = new List <byte> (); data.Insert(0, (byte)0); // this byte should end up being the protocol data.Insert(1, (byte)1); // this byte should end up being the type data.Insert(2, (byte)2); // this byte should not end up in the header // strip the header into a struct HeaderManager.Header result = HeaderManager.StripHeader(data); // shold return the right header struct for these bytes HeaderManager.Header expected = new HeaderManager.Header(0, 1); Assert.AreEqual(expected, result); }