public void Parse_UseDevelopmentCredentials_ReturnsLocalEmulatorSettings()
        {
            string connectionString = "AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;";

            var result = StorageAccountSettings.Parse(connectionString);

            Assert.IsInstanceOf <LocalEmulatorAccountSettings>(result);
        }
        public void Parse_UseDevelopmentStorage_ReturnsLocalEmulatorSettings()
        {
            string connectionString = "UseDevelopmentStorage=true";

            var result = StorageAccountSettings.Parse(connectionString);

            Assert.IsInstanceOf <LocalEmulatorAccountSettings>(result);
        }
        public void Parse_UseNonDevelopmentCredentials_ReturnsNormalSettings()
        {
            string connectionString = "AccountName=some-account-name;AccountKey=some-account-key;";

            var result = StorageAccountSettings.Parse(connectionString);

            Assert.IsInstanceOf <StorageAccountSettings>(result);
            Assert.IsNotInstanceOf <LocalEmulatorAccountSettings>(result);
        }
        public void Parse_HttpsSpecified_UsesHttps()
        {
            string connectionString = "AccountName=some-account-name;AccountKey=some-account-key;";

            var result = StorageAccountSettings.Parse(connectionString);

            Assert.IsTrue(result.BlobEndpoint.StartsWith("https://"), "BlobEndpoint should start with https");
            Assert.IsTrue(result.QueueEndpoint.StartsWith("https://"), "QueueEndpoint should start with https");
            Assert.IsTrue(result.TableEndpoint.StartsWith("https://"), "TableEndpoint should start with https");
        }
        public void Parse_UseDevelopmentStorageWithproxy_SettingsIncludeProxy()
        {
            string connectionString = "UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://PROXY-HERE";

            var result = StorageAccountSettings.Parse(connectionString);

            Assert.AreEqual("http://PROXY-HERE:10000/devstoreaccount1", result.BlobEndpoint);
            Assert.AreEqual("http://PROXY-HERE:10001/devstoreaccount1", result.QueueEndpoint);
            Assert.AreEqual("http://PROXY-HERE:10002/devstoreaccount1", result.TableEndpoint);
        }
        public void Parse_EndointSuffixSupplied_UsesProvidedSuffixForAllAddresses()
        {
            string expectedSuffix   = "core.expected.address";
            string connectionString = String.Format("AccountName=some-account-name;AccountKey=some-account-key;EndpointSuffix={0}", expectedSuffix);

            var result = StorageAccountSettings.Parse(connectionString);

            Assert.IsTrue(result.BlobEndpoint.EndsWith(expectedSuffix), String.Format("Expected suffix of '{0} but actual value was {1}", expectedSuffix, result.BlobEndpoint));
            Assert.IsTrue(result.QueueEndpoint.EndsWith(expectedSuffix), String.Format("Expected suffix of '{0} but actual value was {1}", expectedSuffix, result.QueueEndpoint));
            Assert.IsTrue(result.TableEndpoint.EndsWith(expectedSuffix), String.Format("Expected suffix of '{0} but actual value was {1}", expectedSuffix, result.TableEndpoint));
        }
        public void Parse_TableEndpointSpecified_OverridesDefaultValueForTableStorage()
        {
            string expectedEndpoint = "http://expected.endpoint.here";
            string connectionString = String.Format("AccountName=some-account-name;AccountKey=some-account-key;TableEndpoint={0}", expectedEndpoint);

            var result = StorageAccountSettings.Parse(connectionString);

            var defaultStorageSettings = new StorageAccountSettings("some-account-name", "", true);

            Assert.AreEqual(defaultStorageSettings.BlobEndpoint, result.BlobEndpoint);
            Assert.AreEqual(defaultStorageSettings.QueueEndpoint, result.QueueEndpoint);
            Assert.AreEqual(expectedEndpoint, result.TableEndpoint);
        }