예제 #1
0
        public void ToConnectionStringProducesTheConnectionStringForSharedAccessSignatures()
        {
            var properties = new ServiceBusConnectionStringProperties
            {
                Endpoint              = new Uri("sb://place.endpoint.ext"),
                EntityPath            = "HubName",
                SharedAccessSignature = "FaKe#$1324@@"
            };

            var connectionString = properties.ToConnectionString();

            Assert.That(connectionString, Is.Not.Null, "The connection string should not be null.");
            Assert.That(connectionString.Length, Is.GreaterThan(0), "The connection string should have content.");

            var parsed = ServiceBusConnectionStringProperties.Parse(connectionString);

            Assert.That(parsed, Is.Not.Null, "The connection string should be parsable.");
            Assert.That(PropertiesAreEquivalent(properties, parsed), Is.True, "The connection string should parse into the source properties.");
        }
예제 #2
0
        public void ToConnectionStringNormalizesTheEndpointScheme(string scheme)
        {
            var properties = new ServiceBusConnectionStringProperties
            {
                Endpoint            = new Uri(string.Concat(scheme, "myhub.servicebus.windows.net")),
                EntityPath          = "HubName",
                SharedAccessKey     = "FaKe#$1324@@",
                SharedAccessKeyName = "RootSharedAccessManagementKey"
            };

            var connectionString = properties.ToConnectionString();

            Assert.That(connectionString, Is.Not.Null, "The connection string should not be null.");
            Assert.That(connectionString.Length, Is.GreaterThan(0), "The connection string should have content.");

            var parsed = ServiceBusConnectionStringProperties.Parse(connectionString);

            Assert.That(parsed, Is.Not.Null, "The connection string should be parsable.");
            Assert.That(parsed.Endpoint.Host, Is.EqualTo(properties.Endpoint.Host), "The host name of the endpoints should match.");

            var expectedScheme = new Uri(string.Concat(GetServiceBusEndpointScheme(), "fake.fake.com")).Scheme;

            Assert.That(parsed.Endpoint.Scheme, Is.EqualTo(expectedScheme), "The endpoint scheme should have been overridden.");
        }
예제 #3
0
 public void ToConnectionStringValidatesProperties(ServiceBusConnectionStringProperties properties, string testDescription)
 {
     Assert.That(() => properties.ToConnectionString(), Throws.InstanceOf <ArgumentException>(), $"The case for `{ testDescription }` failed.");
 }