public void ToBytesHelperTest() { var tag = new ILTagILInt(23); var bytes = TagHelpers.ToBytesHelper((s) => s.EncodeILInt(23)); Assert.IsNotNull(bytes); Assert.That(tag.EncodedBytes, Is.EquivalentTo(bytes)); var e = Assert.Throws <ArgumentException>(() => TagHelpers.ToBytesHelper(null)); Assert.AreEqual("serialize", e.ParamName); }
public void DecodeArrayOfTagsWithNulls() { var expectedBytes = new byte[] { 21, 6, 3, 10, 1, 0, 10, 3 }; var array = new ILTagILInt[] { new ILTagILInt(1), null, new ILTagILInt(3) }; var compound = new ILTagArrayOfILTag <ILTagILInt>(array); byte[] encodedBytes = compound.EncodedBytes; Assert.AreEqual(expectedBytes, encodedBytes); using var ms = new MemoryStream(encodedBytes); var value = ms.DecodeTagArray <ILTagILInt>(); Assert.AreEqual(array, value); }
public bool Equals(ILTagILInt other) => other != null && Value == other.Value;