示例#1
0
        public static void FromDNS()
        {
            var endpoint = new DnsEndPoint("localhost", 3262);
            var id       = ClusterMemberId.FromEndPoint(endpoint).ToString();

            True(ClusterMemberId.TryParse(id, out var actual));
            Equal(ClusterMemberId.FromEndPoint(endpoint), actual);
        }
示例#2
0
        public static void FromUDS()
        {
            var endpoint = new UnixDomainSocketEndPoint("/path");
            var id       = ClusterMemberId.FromEndPoint(endpoint).ToString();

            True(ClusterMemberId.TryParse(id, out var actual));
            Equal(ClusterMemberId.FromEndPoint(endpoint), actual);
        }
示例#3
0
        public static void FromIP()
        {
            var endpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 3262);
            var id       = ClusterMemberId.FromEndPoint(endpoint).ToString();

            True(ClusterMemberId.TryParse(id, out var actual));
            Equal(ClusterMemberId.FromEndPoint(endpoint), actual);
        }
示例#4
0
        public static void Parsing()
        {
            var expected = new Random().Next <ClusterMemberId>();

            True(ClusterMemberId.TryParse(expected.ToString().AsSpan(), out var actual));
            Equal(expected, actual);
            var invalidHex = "AB142244";

            False(ClusterMemberId.TryParse(invalidHex.AsSpan(), out _));
        }