public void TryDeserialize_FailTest(FastStreamReader stream, string expErr) { NetworkAddress addr = new NetworkAddress(); bool b = addr.TryDeserialize(stream, out string error); Assert.False(b); Assert.Equal(expErr, error); }
public void TryDeserialize_InvalidServiceTest() { NetworkAddress addr = new NetworkAddress(); var stream = new FastStreamReader(Helper.HexToBytes("ffffffffffffffff00000000000000000000ffffc0000233208d")); bool b = addr.TryDeserialize(stream, out string error); Assert.True(b, error); Assert.Null(error); Assert.Equal(ulong.MaxValue, (ulong)addr.NodeServices); Assert.Equal(IPAddress.Parse("192.0.2.51"), addr.NodeIP); Assert.Equal((ushort)8333, addr.NodePort); }