コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }