예제 #1
0
        public void ConnectionInformationForProtocolWithNullVersion()
        {
            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(null));
        }
예제 #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);
        }
예제 #3
0
        public void ProtocolVersions()
        {
            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 versions = endpoint.ProtocolVersions();

            Assert.That(
                versions,
                Is.EquivalentTo(
                    info.Select(i => i.Version)
                    .OrderBy(v => v)));
        }
예제 #4
0
        public void Version()
        {
            var endpoint = new InformationEndpoint(new ProtocolInformation[0]);

            Assert.AreEqual(new Version(1, 0, 0, 0), endpoint.Version());
        }