Exemplo n.º 1
0
        public void Valid_URI_can_be_cast_to_EndpointAddress(NamedPipeEndpointAddress testAddress)
        {
            var testUri = testAddress.ToUri();

            NamedPipeEndpointAddress address = testUri;

            Assert.That(address.Path, Is.EqualTo(testAddress.Path).IgnoreCase);
        }
Exemplo n.º 2
0
        public void ParseFromUri_returns_EndpointAddress(NamedPipeEndpointAddress testAddress)
        {
            var testUri = testAddress.ToUri();

            var address = NamedPipeEndpointAddress.ParseFromUri(testUri);

            Assert.That(address.Path, Is.EqualTo(testAddress.Path).IgnoreCase);
        }
Exemplo n.º 3
0
 public static IEndpoint AddNamedPipeEndpoint(this IServiceHostConfigurator configurator, Type contract, NamedPipeEndpointAddress address, Action <NetNamedPipeBinding> configureBinding = null) => configurator.AddEndpoint(contract, address, configureBinding);
Exemplo n.º 4
0
        public void ParseFromUri_throws_if_invalid_host(NamedPipeEndpointAddress testAddress, string invalidHost)
        {
            var testUri = new UriBuilder(Uri.UriSchemeNetPipe, invalidHost, -1, testAddress.Path).Uri;

            Assert.Throws <ArgumentException>(() => NamedPipeEndpointAddress.ParseFromUri(testUri));
        }
Exemplo n.º 5
0
 public void ParseFromUri_throws_if_uri_is_null(NamedPipeEndpointAddress _)
 {
     Assert.Throws <ArgumentNullException>(() => NamedPipeEndpointAddress.ParseFromUri(null));
 }
Exemplo n.º 6
0
        public void ParseFromUri_throws_if_invalid_scheme(NamedPipeEndpointAddress testAddress, string invalidScheme)
        {
            var testUri = new UriBuilder(invalidScheme, "localhost", -1, testAddress.Path).Uri;

            Assert.Throws <ArgumentException>(() => NamedPipeEndpointAddress.ParseFromUri(testUri));
        }
Exemplo n.º 7
0
 public void ToString_returns_formed_Uri(NamedPipeEndpointAddress testAddress)
 {
     Assert.That(testAddress.ToString(), Is.EqualTo($"Address: {testAddress.ToUri()}"));
 }
Exemplo n.º 8
0
        public void ParseFromUri_throws_if_invalid_port(NamedPipeEndpointAddress testAddress, int invalidPort)
        {
            var testUri = new UriBuilder(Uri.UriSchemeNetPipe, "localhost", invalidPort, testAddress.Path).Uri;

            Assert.Throws <ArgumentException>(() => NamedPipeEndpointAddress.ParseFromUri(testUri));
        }
Exemplo n.º 9
0
        public void GetNamedPipeEndpointAddress_can_return_endpoint(ConfigurationBuilder builder, NamedPipeEndpointAddress testAddress)
        {
            var configuration = builder.AddInMemoryCollection(new Dictionary <string, string>()
            {
                ["Path"] = testAddress.Path
            }).Build();

            Uri result = ConfigurationExtensions.GetNamedPipeEndpointAddress(configuration);

            Assert.That(result.Scheme, Is.EqualTo(Uri.UriSchemeNetPipe));
            Assert.That(result.Host, Is.EqualTo("localhost"));
            Assert.That(result.IsDefaultPort, Is.True);
            Assert.That(result.AbsolutePath, Is.EqualTo("/" + testAddress.Path).IgnoreCase);
        }
Exemplo n.º 10
0
        public void AddNamedPipeEndpoint_forwards_to_configurator(IServiceHostConfigurator configurator, Action <NetNamedPipeBinding> testDelegate, NamedPipeEndpointAddress address)
        {
            configurator.AddNamedPipeEndpoint(typeof(ITestService), address, testDelegate);

            Mock.Get(configurator).Verify(p => p.AddEndpoint <NetNamedPipeBinding>(typeof(ITestService), address, testDelegate));
        }