Example #1
0
        public void ConnectionInformationForProtocolWithNonSupportedVersion()
        {
            var info = new[]
            {
                new ProtocolInformation(
                    new Version(3, 0, 0, 0),
                    new Uri("http://localhost/invalid/v3")),
                new ProtocolInformation(
                    new Version(1, 0, 0, 0),
                    new Uri("http://localhost/invalid/v1")),
                new ProtocolInformation(
                    new Version(2, 0, 0, 0),
                    new Uri("http://localhost/invalid/v2")),
            };

            var endpoint = new InformationEndpoint(info);

            Assert.IsNull(endpoint.ConnectionInformationForProtocol(new Version(4, 0, 0, 0)));
            Assert.IsNull(endpoint.ConnectionInformationForProtocol(new Version(1, 1, 0, 0)));
            Assert.IsNull(endpoint.ConnectionInformationForProtocol(new Version(1, 0, 1, 0)));
            Assert.IsNull(endpoint.ConnectionInformationForProtocol(new Version(1, 0, 0, 1)));
        }
Example #2
0
        public void ConnectionInformationForProtocol()
        {
            var info = new[]
            {
                new ProtocolInformation(
                    new Version(3, 0, 0, 0),
                    new Uri("http://localhost/invalid/v3")),
                new ProtocolInformation(
                    new Version(1, 0, 0, 0),
                    new Uri("http://localhost/invalid/v1")),
                new ProtocolInformation(
                    new Version(2, 0, 0, 0),
                    new Uri("http://localhost/invalid/v2")),
            };

            var endpoint = new InformationEndpoint(info);
            var output   = endpoint.ConnectionInformationForProtocol(new Version(2, 0, 0, 0));

            Assert.IsNotNull(output);
            Assert.AreSame(info[2].Version, output.ProtocolVersion);
            Assert.AreSame(info[2].MessageAddress, output.Address);
        }