public void GetSecondaryUriFromPrimaryStorage() { Uri secondaryEndpoint = TableConnectionString.GetSecondaryUriFromPrimary(new Uri($"https://{AccountName}.table.core.windows.net/")); Assert.That(secondaryEndpoint, Is.Not.Null.Or.Empty, "Secondary endpoint should not be null or empty"); Assert.That(secondaryEndpoint.AbsoluteUri, Is.EqualTo(new Uri($"https://{AccountName}{TableConstants.ConnectionStrings.SecondaryLocationAccountSuffix}.table.core.windows.net/"))); }
public void GetSecondaryUriFromPrimaryAzurite() { Uri secondaryEndpoint = TableConnectionString.GetSecondaryUriFromPrimary(new Uri($"https://127.0.0.1:10002/{AccountName}/")); Assert.That(secondaryEndpoint, Is.Not.Null.Or.Empty, "Secondary endpoint should not be null or empty"); Assert.That(secondaryEndpoint.AbsoluteUri, Is.EqualTo(new Uri($"https://127.0.0.1:10002/{AccountName}{TableConstants.ConnectionStrings.SecondaryLocationAccountSuffix}/"))); }
public void ParsesCosmos(string connString) { Assert.That(TableConnectionString.TryParse(connString, out TableConnectionString tcs), "Parsing should have been successful"); Assert.That(tcs.Credentials, Is.Not.Null); Assert.That(GetCredString(tcs.Credentials), Is.EqualTo(GetExpectedHash(_expectedCred)), "The Credentials should have matched."); Assert.That(tcs.TableStorageUri.PrimaryUri, Is.EqualTo(new Uri($"https://{AccountName}.table.cosmos.azure.com:443/")), "The PrimaryUri should have matched."); }
public void TryParsesStorage(string connString) { Assert.That(TableConnectionString.TryParse(connString, out TableConnectionString tcs), "Parsing should have been successful"); Assert.That(tcs.Credentials, Is.Not.Null); Assert.That(GetCredString(tcs.Credentials), Is.EqualTo(GetExpectedHash(_expectedCred)), "The Credentials should have matched."); Assert.That(tcs.TableStorageUri.PrimaryUri, Is.EqualTo(new Uri($"https://{AccountName}.table.core.windows.net/")), "The PrimaryUri should have matched."); Assert.That(tcs.TableStorageUri.SecondaryUri, Is.EqualTo(new Uri($"https://{AccountName}{TableConstants.ConnectionStrings.SecondaryLocationAccountSuffix}.table.core.windows.net/")), "The SecondaryUri should have matched."); }
public void ParsesSaSCosmos(string connString) { Assert.That(TableConnectionString.TryParse(connString, out TableConnectionString tcs), "Parsing should have been successful"); Assert.That(tcs.Credentials, Is.Not.Null); Assert.That(GetCredString(tcs.Credentials), Is.EqualTo(SasToken), "The Credentials should have matched."); Assert.That(tcs.TableStorageUri.PrimaryUri, Is.EqualTo(new Uri($"https://{AccountName}.table.cosmos.azure.com/?{SasToken}")), "The PrimaryUri should have matched."); Assert.That(tcs.TableStorageUri.SecondaryUri, Is.EqualTo(new Uri($"https://{AccountName}{TableConstants.ConnectionStrings.SecondaryLocationAccountSuffix}.table.cosmos.azure.com/?{SasToken}")), "The SecondaryUri should have matched."); }
public void ParseCosmosEmulatorConnString() { var uri = "DefaultEndpointsProtocol=http;AccountName=localhost;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==;TableEndpoint=http://localhost:8902/;"; var result = TableConnectionString.Parse(uri); Assert.AreEqual("localhost", result._accountName); }
public void ParseAzuriteConnString() { var uri = "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;"; var result = TableConnectionString.Parse(uri); Assert.AreEqual("devstoreaccount1", result._accountName); }
public void ParsesDevStorage() { var connString = $"UseDevelopmentStorage=true"; Assert.That(TableConnectionString.TryParse(connString, out TableConnectionString tcs), "Parsing should have been successful"); Assert.That(tcs.Credentials, Is.Not.Null); Assert.That(GetCredString(tcs.Credentials), Is.EqualTo(GetExpectedHash(_expectedDevStoraageCred)), "The Credentials should have matched."); Assert.That(tcs.TableStorageUri.PrimaryUri, Is.EqualTo(new Uri($"http://{TableConstants.ConnectionStrings.Localhost}:{TableConstants.ConnectionStrings.TableEndpointPortNumber}/{TableConstants.ConnectionStrings.DevStoreAccountName}")), "The PrimaryUri should have matched."); }
public void ParsesSaS() { var connString = $"BlobEndpoint=https://{AccountName}.blob.core.windows.net/;QueueEndpoint=https://{AccountName}.queue.core.windows.net/;FileEndpoint=https://{AccountName}.file.core.windows.net/;TableEndpoint=https://{AccountName}.table.core.windows.net/;SharedAccessSignature={SasToken}"; Assert.That(TableConnectionString.TryParse(connString, out TableConnectionString tcs), "Parsing should have been successful"); Assert.That(tcs.Credentials, Is.Not.Null); Assert.That(GetCredString(tcs.Credentials), Is.EqualTo(SasToken), "The Credentials should have matched."); Assert.That(tcs.TableStorageUri.PrimaryUri, Is.EqualTo(new Uri($"https://{AccountName}.table.core.windows.net/?{SasToken}")), "The PrimaryUri should have matched."); }
public void ParsesInvalid(string connString) { Assert.Throws <InvalidOperationException>(() => TableConnectionString.Parse(connString), "Parsing should not have been successful"); }
public void TryParsesInvalid(string connString) { Assert.That(!TableConnectionString.TryParse(connString, out TableConnectionString tcs), "Parsing should not have been successful"); }
public void GetTableNameFromUri(Uri uri) { string expectedTableName = TableConnectionString.GetTableNameFromUri(uri); Assert.That(expectedTableName, Is.EqualTo(TableName)); }
public void ParseFailsWithInvalidConnString(string connString) { Assert.That(TableConnectionString.TryParse(connString, out TableConnectionString tcs), Is.False, "Parsing should not have been successful"); }
public void GetTableNameFromUri(Uri uri, string expectedAccountName, string expectedTableName) { string actualTableName = TableConnectionString.GetTableNameFromUri(uri); Assert.That(actualTableName, Is.EqualTo(expectedTableName)); }