From 69f25da98b5210f1b850fb079f48916787aca3e9 Mon Sep 17 00:00:00 2001 From: Kamil Sobol <61715331+kasobol-msft@users.noreply.github.com> Date: Wed, 27 Jan 2021 15:20:23 -0800 Subject: [PATCH] [Storage] Make Storage clients mockable again. (#18243) * this fixes webjobs. * queues. * shares. * datalake. * blobs. * batch. * fix tests. --- .../tests/BlobBatchClientTests.cs | 12 +++++++++++ .../CanMockClientConstructors.json | 6 ++++++ .../CanMockClientConstructorsAsync.json | 6 ++++++ .../tests/AppendBlobClientTests.cs | 13 ++++++++++++ .../tests/BlobBaseClientTests.cs | 12 +++++++++++ .../tests/BlobClientTests.cs | 13 ++++++++++++ .../tests/BlockBlobClientTests.cs | 13 ++++++++++++ .../tests/ContainerClientTests.cs | 12 +++++++++++ .../tests/PageBlobClientTests.cs | 13 ++++++++++++ .../tests/ServiceClientTests.cs | 13 ++++++++++++ .../CanMockClientConstructors.json | 7 +++++++ .../CanMockClientConstructorsAsync.json | 7 +++++++ .../CanMockClientConstructors.json | 7 +++++++ .../CanMockClientConstructorsAsync.json | 7 +++++++ .../CanMockClientConstructors.json | 7 +++++++ .../CanMockClientConstructorsAsync.json | 7 +++++++ .../CanMockClientConstructors.json | 7 +++++++ .../CanMockClientConstructorsAsync.json | 7 +++++++ .../CanMockClientConstructors.json | 7 +++++++ .../CanMockClientConstructorsAsync.json | 7 +++++++ .../CanMockClientConstructors.json | 7 +++++++ .../CanMockClientConstructorsAsync.json | 7 +++++++ .../CanMockClientConstructors.json | 7 +++++++ .../CanMockClientConstructorsAsync.json | 7 +++++++ .../src/DataLakeFileSystemClient.cs | 6 +++--- .../src/DataLakePathClient.cs | 8 ++++---- .../src/DataLakeServiceClient.cs | 4 ++-- .../tests/DirectoryClientTests.cs | 13 ++++++++++++ .../tests/FileClientTests.cs | 13 ++++++++++++ .../tests/FileSystemClientTests.cs | 13 ++++++++++++ .../tests/PathClientTests.cs | 13 ++++++++++++ .../tests/ServiceClientTests.cs | 13 ++++++++++++ .../CanMockClientConstructors.json | 7 +++++++ .../CanMockClientConstructorsAsync.json | 7 +++++++ .../CanMockClientConstructors.json | 7 +++++++ .../CanMockClientConstructorsAsync.json | 7 +++++++ .../CanMockClientConstructors.json | 7 +++++++ .../CanMockClientConstructorsAsync.json | 7 +++++++ .../CanMockClientConstructors.json | 7 +++++++ .../CanMockClientConstructorsAsync.json | 7 +++++++ .../CanMockClientConstructors.json | 7 +++++++ .../CanMockClientConstructorsAsync.json | 7 +++++++ .../src/ShareClient.cs | 15 +++++++------- .../src/ShareDirectoryClient.cs | 6 +++--- .../src/ShareFileClient.cs | 6 +++--- .../src/ShareServiceClient.cs | 8 ++++---- .../tests/DirectoryClientTests.cs | 12 +++++++++++ .../tests/FileClientTests.cs | 12 +++++++++++ .../tests/ServiceClientTests.cs | 12 +++++++++++ .../CanMockClientConstructors.json | 6 ++++++ .../CanMockClientConstructorsAsync.json | 6 ++++++ .../CanMockClientConstructors.json | 6 ++++++ .../CanMockClientConstructorsAsync.json | 6 ++++++ .../CanMockClientConstructors.json | 6 ++++++ .../CanMockClientConstructorsAsync.json | 6 ++++++ .../CanMockClientConstructors.json | 6 ++++++ .../CanMockClientConstructorsAsync.json | 6 ++++++ .../tests/ShareClientTests.cs | 12 +++++++++++ .../Azure.Storage.Queues/src/QueueClient.cs | 20 +++++++++---------- .../src/QueueServiceClient.cs | 8 ++++---- .../tests/QueueClientTests.cs | 13 ++++++++++++ .../tests/ServiceClientTests.cs | 13 ++++++++++++ .../CanMockClientConstructors.json | 7 +++++++ .../CanMockClientConstructorsAsync.json | 7 +++++++ .../CanMockClientConstructors.json | 7 +++++++ .../CanMockClientConstructorsAsync.json | 7 +++++++ .../tests/QueueListenerTests.cs | 2 +- 67 files changed, 537 insertions(+), 42 deletions(-) create mode 100644 sdk/storage/Azure.Storage.Blobs.Batch/tests/SessionRecords/BlobBatchClientTests/CanMockClientConstructors.json create mode 100644 sdk/storage/Azure.Storage.Blobs.Batch/tests/SessionRecords/BlobBatchClientTests/CanMockClientConstructorsAsync.json create mode 100644 sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/AppendBlobClientTests/CanMockClientConstructors.json create mode 100644 sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/AppendBlobClientTests/CanMockClientConstructorsAsync.json create mode 100644 sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/BlobBaseClientTests/CanMockClientConstructors.json create mode 100644 sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/BlobBaseClientTests/CanMockClientConstructorsAsync.json create mode 100644 sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/BlobClientTests/CanMockClientConstructors.json create mode 100644 sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/BlobClientTests/CanMockClientConstructorsAsync.json create mode 100644 sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/BlockBlobClientTests/CanMockClientConstructors.json create mode 100644 sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/BlockBlobClientTests/CanMockClientConstructorsAsync.json create mode 100644 sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/ContainerClientTests/CanMockClientConstructors.json create mode 100644 sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/ContainerClientTests/CanMockClientConstructorsAsync.json create mode 100644 sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/PageBlobClientTests/CanMockClientConstructors.json create mode 100644 sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/PageBlobClientTests/CanMockClientConstructorsAsync.json create mode 100644 sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/ServiceClientTests/CanMockClientConstructors.json create mode 100644 sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/ServiceClientTests/CanMockClientConstructorsAsync.json create mode 100644 sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/DirectoryClientTests/CanMockClientConstructors.json create mode 100644 sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/DirectoryClientTests/CanMockClientConstructorsAsync.json create mode 100644 sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/FileClientTests/CanMockClientConstructors.json create mode 100644 sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/FileClientTests/CanMockClientConstructorsAsync.json create mode 100644 sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/FileSystemClientTests/CanMockClientConstructors.json create mode 100644 sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/FileSystemClientTests/CanMockClientConstructorsAsync.json create mode 100644 sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/PathClientTests/CanMockClientConstructors.json create mode 100644 sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/PathClientTests/CanMockClientConstructorsAsync.json create mode 100644 sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/ServiceClientTests/CanMockClientConstructors.json create mode 100644 sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/ServiceClientTests/CanMockClientConstructorsAsync.json create mode 100644 sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/DirectoryClientTests/CanMockClientConstructors.json create mode 100644 sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/DirectoryClientTests/CanMockClientConstructorsAsync.json create mode 100644 sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/FileClientTests/CanMockClientConstructors.json create mode 100644 sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/FileClientTests/CanMockClientConstructorsAsync.json create mode 100644 sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/ServiceClientTests/CanMockClientConstructors.json create mode 100644 sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/ServiceClientTests/CanMockClientConstructorsAsync.json create mode 100644 sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/ShareClientTests/CanMockClientConstructors.json create mode 100644 sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/ShareClientTests/CanMockClientConstructorsAsync.json create mode 100644 sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanMockClientConstructors.json create mode 100644 sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanMockClientConstructorsAsync.json create mode 100644 sdk/storage/Azure.Storage.Queues/tests/SessionRecords/ServiceClientTests/CanMockClientConstructors.json create mode 100644 sdk/storage/Azure.Storage.Queues/tests/SessionRecords/ServiceClientTests/CanMockClientConstructorsAsync.json diff --git a/sdk/storage/Azure.Storage.Blobs.Batch/tests/BlobBatchClientTests.cs b/sdk/storage/Azure.Storage.Blobs.Batch/tests/BlobBatchClientTests.cs index 4a7c13577248d..1f66b82ba5d34 100644 --- a/sdk/storage/Azure.Storage.Blobs.Batch/tests/BlobBatchClientTests.cs +++ b/sdk/storage/Azure.Storage.Blobs.Batch/tests/BlobBatchClientTests.cs @@ -11,6 +11,7 @@ using Azure.Storage.Blobs.Specialized; using Azure.Storage.Test; using Azure.Storage.Test.Shared; +using Moq; using NUnit.Framework; namespace Azure.Storage.Blobs.Test @@ -773,5 +774,16 @@ public async ValueTask DisposeAsync() } } #endregion Scenario helper + + [Test] + public void CanMockClientConstructors() + { + var blobServiceClientMock = new Mock(TestConfigDefault.ConnectionString) + { + CallBase = true + }; + // One has to call .Object to trigger constructor. It's lazy. + var mock = new Mock(blobServiceClientMock.Object).Object; + } } } diff --git a/sdk/storage/Azure.Storage.Blobs.Batch/tests/SessionRecords/BlobBatchClientTests/CanMockClientConstructors.json b/sdk/storage/Azure.Storage.Blobs.Batch/tests/SessionRecords/BlobBatchClientTests/CanMockClientConstructors.json new file mode 100644 index 0000000000000..9a97b60fda957 --- /dev/null +++ b/sdk/storage/Azure.Storage.Blobs.Batch/tests/SessionRecords/BlobBatchClientTests/CanMockClientConstructors.json @@ -0,0 +1,6 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Blobs.Batch/tests/SessionRecords/BlobBatchClientTests/CanMockClientConstructorsAsync.json b/sdk/storage/Azure.Storage.Blobs.Batch/tests/SessionRecords/BlobBatchClientTests/CanMockClientConstructorsAsync.json new file mode 100644 index 0000000000000..9a97b60fda957 --- /dev/null +++ b/sdk/storage/Azure.Storage.Blobs.Batch/tests/SessionRecords/BlobBatchClientTests/CanMockClientConstructorsAsync.json @@ -0,0 +1,6 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Blobs/tests/AppendBlobClientTests.cs b/sdk/storage/Azure.Storage.Blobs/tests/AppendBlobClientTests.cs index ebbe623496f5d..4ae348713a62b 100644 --- a/sdk/storage/Azure.Storage.Blobs/tests/AppendBlobClientTests.cs +++ b/sdk/storage/Azure.Storage.Blobs/tests/AppendBlobClientTests.cs @@ -15,6 +15,7 @@ using Azure.Storage.Sas; using Azure.Storage.Test; using Azure.Storage.Test.Shared; +using Moq; using NUnit.Framework; namespace Azure.Storage.Blobs.Test @@ -1835,6 +1836,18 @@ await TestHelper.CatchAsync( } } + [Test] + public void CanMockClientConstructors() + { + // One has to call .Object to trigger constructor. It's lazy. + var mock = new Mock(TestConfigDefault.ConnectionString, "name", "name", new BlobClientOptions()).Object; + mock = new Mock(TestConfigDefault.ConnectionString, "name", "name").Object; + mock = new Mock(new Uri("https://test/test"), new BlobClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), GetNewSharedKeyCredentials(), new BlobClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), new AzureSasCredential("foo"), new BlobClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), GetOAuthCredential(TestConfigHierarchicalNamespace), new BlobClientOptions()).Object; + } + private AppendBlobRequestConditions BuildDestinationAccessConditions( AccessConditionParameters parameters, bool lease = false, diff --git a/sdk/storage/Azure.Storage.Blobs/tests/BlobBaseClientTests.cs b/sdk/storage/Azure.Storage.Blobs/tests/BlobBaseClientTests.cs index b05a0e79de64e..955df322ba208 100644 --- a/sdk/storage/Azure.Storage.Blobs/tests/BlobBaseClientTests.cs +++ b/sdk/storage/Azure.Storage.Blobs/tests/BlobBaseClientTests.cs @@ -6496,6 +6496,18 @@ public void CanMockParentContainerClientRetrieval() Assert.AreSame(blobContainerClientMock.Object, blobContainerClient); } + [Test] + public void CanMockClientConstructors() + { + // One has to call .Object to trigger constructor. It's lazy. + var mock = new Mock(TestConfigDefault.ConnectionString, "name", "name", new BlobClientOptions()).Object; + mock = new Mock(TestConfigDefault.ConnectionString, "name", "name").Object; + mock = new Mock(new Uri("https://test/test"), new BlobClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), GetNewSharedKeyCredentials(), new BlobClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), new AzureSasCredential("foo"), new BlobClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), GetOAuthCredential(TestConfigHierarchicalNamespace), new BlobClientOptions()).Object; + } + public IEnumerable AccessConditions_Data => new[] { diff --git a/sdk/storage/Azure.Storage.Blobs/tests/BlobClientTests.cs b/sdk/storage/Azure.Storage.Blobs/tests/BlobClientTests.cs index 99e21d86a820f..1b3050a07bef9 100644 --- a/sdk/storage/Azure.Storage.Blobs/tests/BlobClientTests.cs +++ b/sdk/storage/Azure.Storage.Blobs/tests/BlobClientTests.cs @@ -15,6 +15,7 @@ using Azure.Storage.Test.Shared; using Azure.Storage.Tests; using Azure.Storage.Tests.Shared; +using Moq; using NUnit.Framework; namespace Azure.Storage.Blobs.Test @@ -1206,5 +1207,17 @@ public void WithVersion() Assert.AreEqual(versionId, blobUriBuilder.VersionId); Assert.AreEqual(versionUri, blobUriBuilder.ToUri()); } + + [Test] + public void CanMockClientConstructors() + { + // One has to call .Object to trigger constructor. It's lazy. + var mock = new Mock(TestConfigDefault.ConnectionString, "name", "name", new BlobClientOptions()).Object; + mock = new Mock(TestConfigDefault.ConnectionString, "name", "name").Object; + mock = new Mock(new Uri("https://test/test"), new BlobClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), GetNewSharedKeyCredentials(), new BlobClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), new AzureSasCredential("foo"), new BlobClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), GetOAuthCredential(TestConfigHierarchicalNamespace), new BlobClientOptions()).Object; + } } } diff --git a/sdk/storage/Azure.Storage.Blobs/tests/BlockBlobClientTests.cs b/sdk/storage/Azure.Storage.Blobs/tests/BlockBlobClientTests.cs index 132a1587d7298..24cd85238abb7 100644 --- a/sdk/storage/Azure.Storage.Blobs/tests/BlockBlobClientTests.cs +++ b/sdk/storage/Azure.Storage.Blobs/tests/BlockBlobClientTests.cs @@ -14,6 +14,7 @@ using Azure.Storage.Sas; using Azure.Storage.Test; using Azure.Storage.Test.Shared; +using Moq; using NUnit.Framework; using Metadata = System.Collections.Generic.IDictionary; using Tags = System.Collections.Generic.IDictionary; @@ -3370,6 +3371,18 @@ await TestHelper.AssertExpectedExceptionAsync( e => Assert.AreEqual(BlobErrorCode.BlobAlreadyExists.ToString(), e.ErrorCode)); } + [Test] + public void CanMockClientConstructors() + { + // One has to call .Object to trigger constructor. It's lazy. + var mock = new Mock(TestConfigDefault.ConnectionString, "name", "name", new BlobClientOptions()).Object; + mock = new Mock(TestConfigDefault.ConnectionString, "name", "name").Object; + mock = new Mock(new Uri("https://test/test"), new BlobClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), GetNewSharedKeyCredentials(), new BlobClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), new AzureSasCredential("foo"), new BlobClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), GetOAuthCredential(TestConfigHierarchicalNamespace), new BlobClientOptions()).Object; + } + private RequestConditions BuildRequestConditions(AccessConditionParameters parameters) => new RequestConditions { diff --git a/sdk/storage/Azure.Storage.Blobs/tests/ContainerClientTests.cs b/sdk/storage/Azure.Storage.Blobs/tests/ContainerClientTests.cs index 7333c3109b654..f3144fa9ca690 100644 --- a/sdk/storage/Azure.Storage.Blobs/tests/ContainerClientTests.cs +++ b/sdk/storage/Azure.Storage.Blobs/tests/ContainerClientTests.cs @@ -2959,6 +2959,18 @@ public async Task CanGetParentBlobServiceClient_WithAccountSAS() await container.DeleteIfExistsAsync(); } + [Test] + public void CanMockClientConstructors() + { + // One has to call .Object to trigger constructor. It's lazy. + var mock = new Mock(TestConfigDefault.ConnectionString, "name", new BlobClientOptions()).Object; + mock = new Mock(TestConfigDefault.ConnectionString, "name").Object; + mock = new Mock(new Uri("https://test/test"), new BlobClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), GetNewSharedKeyCredentials(), new BlobClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), new AzureSasCredential("foo"), new BlobClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), GetOAuthCredential(TestConfigHierarchicalNamespace), new BlobClientOptions()).Object; + } + #region Secondary Storage [Test] public async Task ListContainersSegmentAsync_SecondaryStorageFirstRetrySuccessful() diff --git a/sdk/storage/Azure.Storage.Blobs/tests/PageBlobClientTests.cs b/sdk/storage/Azure.Storage.Blobs/tests/PageBlobClientTests.cs index 5347001c64fe7..9755bec486426 100644 --- a/sdk/storage/Azure.Storage.Blobs/tests/PageBlobClientTests.cs +++ b/sdk/storage/Azure.Storage.Blobs/tests/PageBlobClientTests.cs @@ -18,6 +18,7 @@ using Azure.Storage.Test; using Azure.Storage.Test.Shared; using Azure.Storage.Tests; +using Moq; using NUnit.Framework; namespace Azure.Storage.Blobs.Test @@ -3485,6 +3486,18 @@ public async Task OpenWriteAsync_Position() TestHelper.AssertSequenceEqual(expectedData, dataResult.ToArray()); } + [Test] + public void CanMockClientConstructors() + { + // One has to call .Object to trigger constructor. It's lazy. + var mock = new Mock(TestConfigDefault.ConnectionString, "name", "name", new BlobClientOptions()).Object; + mock = new Mock(TestConfigDefault.ConnectionString, "name", "name").Object; + mock = new Mock(new Uri("https://test/test"), new BlobClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), GetNewSharedKeyCredentials(), new BlobClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), new AzureSasCredential("foo"), new BlobClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), GetOAuthCredential(TestConfigHierarchicalNamespace), new BlobClientOptions()).Object; + } + private PageBlobRequestConditions BuildAccessConditions( AccessConditionParameters parameters, bool lease = false, diff --git a/sdk/storage/Azure.Storage.Blobs/tests/ServiceClientTests.cs b/sdk/storage/Azure.Storage.Blobs/tests/ServiceClientTests.cs index 9fb2e4fa7eae1..4b71e7fbb403a 100644 --- a/sdk/storage/Azure.Storage.Blobs/tests/ServiceClientTests.cs +++ b/sdk/storage/Azure.Storage.Blobs/tests/ServiceClientTests.cs @@ -12,6 +12,7 @@ using Azure.Storage.Sas; using Azure.Storage.Test; using Azure.Storage.Test.Shared; +using Moq; using NUnit.Framework; namespace Azure.Storage.Blobs.Test @@ -932,5 +933,17 @@ public void GenerateAccountSas_WrongService_Service() } } #endregion + + [Test] + public void CanMockClientConstructors() + { + // One has to call .Object to trigger constructor. It's lazy. + var mock = new Mock(TestConfigDefault.ConnectionString, new BlobClientOptions()).Object; + mock = new Mock(TestConfigDefault.ConnectionString).Object; + mock = new Mock(new Uri("https://test/test"), new BlobClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), GetNewSharedKeyCredentials(), new BlobClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), new AzureSasCredential("foo"), new BlobClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), GetOAuthCredential(TestConfigHierarchicalNamespace), new BlobClientOptions()).Object; + } } } diff --git a/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/AppendBlobClientTests/CanMockClientConstructors.json b/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/AppendBlobClientTests/CanMockClientConstructors.json new file mode 100644 index 0000000000000..e62d82ef43e64 --- /dev/null +++ b/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/AppendBlobClientTests/CanMockClientConstructors.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope", + "Storage_TestConfigHierarchicalNamespace": "NamespaceTenant\nkasobolcanaryhns\nU2FuaXRpemVk\nhttps://kasobolcanaryhns.blob.core.windows.net\nhttps://kasobolcanaryhns.file.core.windows.net\nhttps://kasobolcanaryhns.queue.core.windows.net\nhttps://kasobolcanaryhns.table.core.windows.net\n\n\n\n\nhttps://kasobolcanaryhns-secondary.blob.core.windows.net\nhttps://kasobolcanaryhns-secondary.file.core.windows.net\nhttps://kasobolcanaryhns-secondary.queue.core.windows.net\nhttps://kasobolcanaryhns-secondary.table.core.windows.net\nc6b5fe1a-9b59-4975-92c4-d9f728c3c371\nSanitized\n72f988bf-86f1-41af-91ab-2d7cd011db47\nhttps://login.microsoftonline.com/\nCloud\nBlobEndpoint=https://kasobolcanaryhns.blob.core.windows.net/;QueueEndpoint=https://kasobolcanaryhns.queue.core.windows.net/;FileEndpoint=https://kasobolcanaryhns.file.core.windows.net/;BlobSecondaryEndpoint=https://kasobolcanaryhns-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasobolcanaryhns-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasobolcanaryhns-secondary.file.core.windows.net/;AccountName=kasobolcanaryhns;AccountKey=Sanitized\n" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/AppendBlobClientTests/CanMockClientConstructorsAsync.json b/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/AppendBlobClientTests/CanMockClientConstructorsAsync.json new file mode 100644 index 0000000000000..e62d82ef43e64 --- /dev/null +++ b/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/AppendBlobClientTests/CanMockClientConstructorsAsync.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope", + "Storage_TestConfigHierarchicalNamespace": "NamespaceTenant\nkasobolcanaryhns\nU2FuaXRpemVk\nhttps://kasobolcanaryhns.blob.core.windows.net\nhttps://kasobolcanaryhns.file.core.windows.net\nhttps://kasobolcanaryhns.queue.core.windows.net\nhttps://kasobolcanaryhns.table.core.windows.net\n\n\n\n\nhttps://kasobolcanaryhns-secondary.blob.core.windows.net\nhttps://kasobolcanaryhns-secondary.file.core.windows.net\nhttps://kasobolcanaryhns-secondary.queue.core.windows.net\nhttps://kasobolcanaryhns-secondary.table.core.windows.net\nc6b5fe1a-9b59-4975-92c4-d9f728c3c371\nSanitized\n72f988bf-86f1-41af-91ab-2d7cd011db47\nhttps://login.microsoftonline.com/\nCloud\nBlobEndpoint=https://kasobolcanaryhns.blob.core.windows.net/;QueueEndpoint=https://kasobolcanaryhns.queue.core.windows.net/;FileEndpoint=https://kasobolcanaryhns.file.core.windows.net/;BlobSecondaryEndpoint=https://kasobolcanaryhns-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasobolcanaryhns-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasobolcanaryhns-secondary.file.core.windows.net/;AccountName=kasobolcanaryhns;AccountKey=Sanitized\n" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/BlobBaseClientTests/CanMockClientConstructors.json b/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/BlobBaseClientTests/CanMockClientConstructors.json new file mode 100644 index 0000000000000..e62d82ef43e64 --- /dev/null +++ b/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/BlobBaseClientTests/CanMockClientConstructors.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope", + "Storage_TestConfigHierarchicalNamespace": "NamespaceTenant\nkasobolcanaryhns\nU2FuaXRpemVk\nhttps://kasobolcanaryhns.blob.core.windows.net\nhttps://kasobolcanaryhns.file.core.windows.net\nhttps://kasobolcanaryhns.queue.core.windows.net\nhttps://kasobolcanaryhns.table.core.windows.net\n\n\n\n\nhttps://kasobolcanaryhns-secondary.blob.core.windows.net\nhttps://kasobolcanaryhns-secondary.file.core.windows.net\nhttps://kasobolcanaryhns-secondary.queue.core.windows.net\nhttps://kasobolcanaryhns-secondary.table.core.windows.net\nc6b5fe1a-9b59-4975-92c4-d9f728c3c371\nSanitized\n72f988bf-86f1-41af-91ab-2d7cd011db47\nhttps://login.microsoftonline.com/\nCloud\nBlobEndpoint=https://kasobolcanaryhns.blob.core.windows.net/;QueueEndpoint=https://kasobolcanaryhns.queue.core.windows.net/;FileEndpoint=https://kasobolcanaryhns.file.core.windows.net/;BlobSecondaryEndpoint=https://kasobolcanaryhns-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasobolcanaryhns-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasobolcanaryhns-secondary.file.core.windows.net/;AccountName=kasobolcanaryhns;AccountKey=Sanitized\n" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/BlobBaseClientTests/CanMockClientConstructorsAsync.json b/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/BlobBaseClientTests/CanMockClientConstructorsAsync.json new file mode 100644 index 0000000000000..e62d82ef43e64 --- /dev/null +++ b/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/BlobBaseClientTests/CanMockClientConstructorsAsync.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope", + "Storage_TestConfigHierarchicalNamespace": "NamespaceTenant\nkasobolcanaryhns\nU2FuaXRpemVk\nhttps://kasobolcanaryhns.blob.core.windows.net\nhttps://kasobolcanaryhns.file.core.windows.net\nhttps://kasobolcanaryhns.queue.core.windows.net\nhttps://kasobolcanaryhns.table.core.windows.net\n\n\n\n\nhttps://kasobolcanaryhns-secondary.blob.core.windows.net\nhttps://kasobolcanaryhns-secondary.file.core.windows.net\nhttps://kasobolcanaryhns-secondary.queue.core.windows.net\nhttps://kasobolcanaryhns-secondary.table.core.windows.net\nc6b5fe1a-9b59-4975-92c4-d9f728c3c371\nSanitized\n72f988bf-86f1-41af-91ab-2d7cd011db47\nhttps://login.microsoftonline.com/\nCloud\nBlobEndpoint=https://kasobolcanaryhns.blob.core.windows.net/;QueueEndpoint=https://kasobolcanaryhns.queue.core.windows.net/;FileEndpoint=https://kasobolcanaryhns.file.core.windows.net/;BlobSecondaryEndpoint=https://kasobolcanaryhns-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasobolcanaryhns-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasobolcanaryhns-secondary.file.core.windows.net/;AccountName=kasobolcanaryhns;AccountKey=Sanitized\n" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/BlobClientTests/CanMockClientConstructors.json b/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/BlobClientTests/CanMockClientConstructors.json new file mode 100644 index 0000000000000..e62d82ef43e64 --- /dev/null +++ b/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/BlobClientTests/CanMockClientConstructors.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope", + "Storage_TestConfigHierarchicalNamespace": "NamespaceTenant\nkasobolcanaryhns\nU2FuaXRpemVk\nhttps://kasobolcanaryhns.blob.core.windows.net\nhttps://kasobolcanaryhns.file.core.windows.net\nhttps://kasobolcanaryhns.queue.core.windows.net\nhttps://kasobolcanaryhns.table.core.windows.net\n\n\n\n\nhttps://kasobolcanaryhns-secondary.blob.core.windows.net\nhttps://kasobolcanaryhns-secondary.file.core.windows.net\nhttps://kasobolcanaryhns-secondary.queue.core.windows.net\nhttps://kasobolcanaryhns-secondary.table.core.windows.net\nc6b5fe1a-9b59-4975-92c4-d9f728c3c371\nSanitized\n72f988bf-86f1-41af-91ab-2d7cd011db47\nhttps://login.microsoftonline.com/\nCloud\nBlobEndpoint=https://kasobolcanaryhns.blob.core.windows.net/;QueueEndpoint=https://kasobolcanaryhns.queue.core.windows.net/;FileEndpoint=https://kasobolcanaryhns.file.core.windows.net/;BlobSecondaryEndpoint=https://kasobolcanaryhns-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasobolcanaryhns-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasobolcanaryhns-secondary.file.core.windows.net/;AccountName=kasobolcanaryhns;AccountKey=Sanitized\n" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/BlobClientTests/CanMockClientConstructorsAsync.json b/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/BlobClientTests/CanMockClientConstructorsAsync.json new file mode 100644 index 0000000000000..e62d82ef43e64 --- /dev/null +++ b/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/BlobClientTests/CanMockClientConstructorsAsync.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope", + "Storage_TestConfigHierarchicalNamespace": "NamespaceTenant\nkasobolcanaryhns\nU2FuaXRpemVk\nhttps://kasobolcanaryhns.blob.core.windows.net\nhttps://kasobolcanaryhns.file.core.windows.net\nhttps://kasobolcanaryhns.queue.core.windows.net\nhttps://kasobolcanaryhns.table.core.windows.net\n\n\n\n\nhttps://kasobolcanaryhns-secondary.blob.core.windows.net\nhttps://kasobolcanaryhns-secondary.file.core.windows.net\nhttps://kasobolcanaryhns-secondary.queue.core.windows.net\nhttps://kasobolcanaryhns-secondary.table.core.windows.net\nc6b5fe1a-9b59-4975-92c4-d9f728c3c371\nSanitized\n72f988bf-86f1-41af-91ab-2d7cd011db47\nhttps://login.microsoftonline.com/\nCloud\nBlobEndpoint=https://kasobolcanaryhns.blob.core.windows.net/;QueueEndpoint=https://kasobolcanaryhns.queue.core.windows.net/;FileEndpoint=https://kasobolcanaryhns.file.core.windows.net/;BlobSecondaryEndpoint=https://kasobolcanaryhns-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasobolcanaryhns-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasobolcanaryhns-secondary.file.core.windows.net/;AccountName=kasobolcanaryhns;AccountKey=Sanitized\n" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/BlockBlobClientTests/CanMockClientConstructors.json b/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/BlockBlobClientTests/CanMockClientConstructors.json new file mode 100644 index 0000000000000..e62d82ef43e64 --- /dev/null +++ b/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/BlockBlobClientTests/CanMockClientConstructors.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope", + "Storage_TestConfigHierarchicalNamespace": "NamespaceTenant\nkasobolcanaryhns\nU2FuaXRpemVk\nhttps://kasobolcanaryhns.blob.core.windows.net\nhttps://kasobolcanaryhns.file.core.windows.net\nhttps://kasobolcanaryhns.queue.core.windows.net\nhttps://kasobolcanaryhns.table.core.windows.net\n\n\n\n\nhttps://kasobolcanaryhns-secondary.blob.core.windows.net\nhttps://kasobolcanaryhns-secondary.file.core.windows.net\nhttps://kasobolcanaryhns-secondary.queue.core.windows.net\nhttps://kasobolcanaryhns-secondary.table.core.windows.net\nc6b5fe1a-9b59-4975-92c4-d9f728c3c371\nSanitized\n72f988bf-86f1-41af-91ab-2d7cd011db47\nhttps://login.microsoftonline.com/\nCloud\nBlobEndpoint=https://kasobolcanaryhns.blob.core.windows.net/;QueueEndpoint=https://kasobolcanaryhns.queue.core.windows.net/;FileEndpoint=https://kasobolcanaryhns.file.core.windows.net/;BlobSecondaryEndpoint=https://kasobolcanaryhns-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasobolcanaryhns-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasobolcanaryhns-secondary.file.core.windows.net/;AccountName=kasobolcanaryhns;AccountKey=Sanitized\n" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/BlockBlobClientTests/CanMockClientConstructorsAsync.json b/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/BlockBlobClientTests/CanMockClientConstructorsAsync.json new file mode 100644 index 0000000000000..e62d82ef43e64 --- /dev/null +++ b/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/BlockBlobClientTests/CanMockClientConstructorsAsync.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope", + "Storage_TestConfigHierarchicalNamespace": "NamespaceTenant\nkasobolcanaryhns\nU2FuaXRpemVk\nhttps://kasobolcanaryhns.blob.core.windows.net\nhttps://kasobolcanaryhns.file.core.windows.net\nhttps://kasobolcanaryhns.queue.core.windows.net\nhttps://kasobolcanaryhns.table.core.windows.net\n\n\n\n\nhttps://kasobolcanaryhns-secondary.blob.core.windows.net\nhttps://kasobolcanaryhns-secondary.file.core.windows.net\nhttps://kasobolcanaryhns-secondary.queue.core.windows.net\nhttps://kasobolcanaryhns-secondary.table.core.windows.net\nc6b5fe1a-9b59-4975-92c4-d9f728c3c371\nSanitized\n72f988bf-86f1-41af-91ab-2d7cd011db47\nhttps://login.microsoftonline.com/\nCloud\nBlobEndpoint=https://kasobolcanaryhns.blob.core.windows.net/;QueueEndpoint=https://kasobolcanaryhns.queue.core.windows.net/;FileEndpoint=https://kasobolcanaryhns.file.core.windows.net/;BlobSecondaryEndpoint=https://kasobolcanaryhns-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasobolcanaryhns-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasobolcanaryhns-secondary.file.core.windows.net/;AccountName=kasobolcanaryhns;AccountKey=Sanitized\n" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/ContainerClientTests/CanMockClientConstructors.json b/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/ContainerClientTests/CanMockClientConstructors.json new file mode 100644 index 0000000000000..e62d82ef43e64 --- /dev/null +++ b/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/ContainerClientTests/CanMockClientConstructors.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope", + "Storage_TestConfigHierarchicalNamespace": "NamespaceTenant\nkasobolcanaryhns\nU2FuaXRpemVk\nhttps://kasobolcanaryhns.blob.core.windows.net\nhttps://kasobolcanaryhns.file.core.windows.net\nhttps://kasobolcanaryhns.queue.core.windows.net\nhttps://kasobolcanaryhns.table.core.windows.net\n\n\n\n\nhttps://kasobolcanaryhns-secondary.blob.core.windows.net\nhttps://kasobolcanaryhns-secondary.file.core.windows.net\nhttps://kasobolcanaryhns-secondary.queue.core.windows.net\nhttps://kasobolcanaryhns-secondary.table.core.windows.net\nc6b5fe1a-9b59-4975-92c4-d9f728c3c371\nSanitized\n72f988bf-86f1-41af-91ab-2d7cd011db47\nhttps://login.microsoftonline.com/\nCloud\nBlobEndpoint=https://kasobolcanaryhns.blob.core.windows.net/;QueueEndpoint=https://kasobolcanaryhns.queue.core.windows.net/;FileEndpoint=https://kasobolcanaryhns.file.core.windows.net/;BlobSecondaryEndpoint=https://kasobolcanaryhns-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasobolcanaryhns-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasobolcanaryhns-secondary.file.core.windows.net/;AccountName=kasobolcanaryhns;AccountKey=Sanitized\n" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/ContainerClientTests/CanMockClientConstructorsAsync.json b/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/ContainerClientTests/CanMockClientConstructorsAsync.json new file mode 100644 index 0000000000000..e62d82ef43e64 --- /dev/null +++ b/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/ContainerClientTests/CanMockClientConstructorsAsync.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope", + "Storage_TestConfigHierarchicalNamespace": "NamespaceTenant\nkasobolcanaryhns\nU2FuaXRpemVk\nhttps://kasobolcanaryhns.blob.core.windows.net\nhttps://kasobolcanaryhns.file.core.windows.net\nhttps://kasobolcanaryhns.queue.core.windows.net\nhttps://kasobolcanaryhns.table.core.windows.net\n\n\n\n\nhttps://kasobolcanaryhns-secondary.blob.core.windows.net\nhttps://kasobolcanaryhns-secondary.file.core.windows.net\nhttps://kasobolcanaryhns-secondary.queue.core.windows.net\nhttps://kasobolcanaryhns-secondary.table.core.windows.net\nc6b5fe1a-9b59-4975-92c4-d9f728c3c371\nSanitized\n72f988bf-86f1-41af-91ab-2d7cd011db47\nhttps://login.microsoftonline.com/\nCloud\nBlobEndpoint=https://kasobolcanaryhns.blob.core.windows.net/;QueueEndpoint=https://kasobolcanaryhns.queue.core.windows.net/;FileEndpoint=https://kasobolcanaryhns.file.core.windows.net/;BlobSecondaryEndpoint=https://kasobolcanaryhns-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasobolcanaryhns-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasobolcanaryhns-secondary.file.core.windows.net/;AccountName=kasobolcanaryhns;AccountKey=Sanitized\n" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/PageBlobClientTests/CanMockClientConstructors.json b/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/PageBlobClientTests/CanMockClientConstructors.json new file mode 100644 index 0000000000000..e62d82ef43e64 --- /dev/null +++ b/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/PageBlobClientTests/CanMockClientConstructors.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope", + "Storage_TestConfigHierarchicalNamespace": "NamespaceTenant\nkasobolcanaryhns\nU2FuaXRpemVk\nhttps://kasobolcanaryhns.blob.core.windows.net\nhttps://kasobolcanaryhns.file.core.windows.net\nhttps://kasobolcanaryhns.queue.core.windows.net\nhttps://kasobolcanaryhns.table.core.windows.net\n\n\n\n\nhttps://kasobolcanaryhns-secondary.blob.core.windows.net\nhttps://kasobolcanaryhns-secondary.file.core.windows.net\nhttps://kasobolcanaryhns-secondary.queue.core.windows.net\nhttps://kasobolcanaryhns-secondary.table.core.windows.net\nc6b5fe1a-9b59-4975-92c4-d9f728c3c371\nSanitized\n72f988bf-86f1-41af-91ab-2d7cd011db47\nhttps://login.microsoftonline.com/\nCloud\nBlobEndpoint=https://kasobolcanaryhns.blob.core.windows.net/;QueueEndpoint=https://kasobolcanaryhns.queue.core.windows.net/;FileEndpoint=https://kasobolcanaryhns.file.core.windows.net/;BlobSecondaryEndpoint=https://kasobolcanaryhns-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasobolcanaryhns-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasobolcanaryhns-secondary.file.core.windows.net/;AccountName=kasobolcanaryhns;AccountKey=Sanitized\n" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/PageBlobClientTests/CanMockClientConstructorsAsync.json b/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/PageBlobClientTests/CanMockClientConstructorsAsync.json new file mode 100644 index 0000000000000..e62d82ef43e64 --- /dev/null +++ b/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/PageBlobClientTests/CanMockClientConstructorsAsync.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope", + "Storage_TestConfigHierarchicalNamespace": "NamespaceTenant\nkasobolcanaryhns\nU2FuaXRpemVk\nhttps://kasobolcanaryhns.blob.core.windows.net\nhttps://kasobolcanaryhns.file.core.windows.net\nhttps://kasobolcanaryhns.queue.core.windows.net\nhttps://kasobolcanaryhns.table.core.windows.net\n\n\n\n\nhttps://kasobolcanaryhns-secondary.blob.core.windows.net\nhttps://kasobolcanaryhns-secondary.file.core.windows.net\nhttps://kasobolcanaryhns-secondary.queue.core.windows.net\nhttps://kasobolcanaryhns-secondary.table.core.windows.net\nc6b5fe1a-9b59-4975-92c4-d9f728c3c371\nSanitized\n72f988bf-86f1-41af-91ab-2d7cd011db47\nhttps://login.microsoftonline.com/\nCloud\nBlobEndpoint=https://kasobolcanaryhns.blob.core.windows.net/;QueueEndpoint=https://kasobolcanaryhns.queue.core.windows.net/;FileEndpoint=https://kasobolcanaryhns.file.core.windows.net/;BlobSecondaryEndpoint=https://kasobolcanaryhns-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasobolcanaryhns-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasobolcanaryhns-secondary.file.core.windows.net/;AccountName=kasobolcanaryhns;AccountKey=Sanitized\n" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/ServiceClientTests/CanMockClientConstructors.json b/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/ServiceClientTests/CanMockClientConstructors.json new file mode 100644 index 0000000000000..e62d82ef43e64 --- /dev/null +++ b/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/ServiceClientTests/CanMockClientConstructors.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope", + "Storage_TestConfigHierarchicalNamespace": "NamespaceTenant\nkasobolcanaryhns\nU2FuaXRpemVk\nhttps://kasobolcanaryhns.blob.core.windows.net\nhttps://kasobolcanaryhns.file.core.windows.net\nhttps://kasobolcanaryhns.queue.core.windows.net\nhttps://kasobolcanaryhns.table.core.windows.net\n\n\n\n\nhttps://kasobolcanaryhns-secondary.blob.core.windows.net\nhttps://kasobolcanaryhns-secondary.file.core.windows.net\nhttps://kasobolcanaryhns-secondary.queue.core.windows.net\nhttps://kasobolcanaryhns-secondary.table.core.windows.net\nc6b5fe1a-9b59-4975-92c4-d9f728c3c371\nSanitized\n72f988bf-86f1-41af-91ab-2d7cd011db47\nhttps://login.microsoftonline.com/\nCloud\nBlobEndpoint=https://kasobolcanaryhns.blob.core.windows.net/;QueueEndpoint=https://kasobolcanaryhns.queue.core.windows.net/;FileEndpoint=https://kasobolcanaryhns.file.core.windows.net/;BlobSecondaryEndpoint=https://kasobolcanaryhns-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasobolcanaryhns-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasobolcanaryhns-secondary.file.core.windows.net/;AccountName=kasobolcanaryhns;AccountKey=Sanitized\n" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/ServiceClientTests/CanMockClientConstructorsAsync.json b/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/ServiceClientTests/CanMockClientConstructorsAsync.json new file mode 100644 index 0000000000000..e62d82ef43e64 --- /dev/null +++ b/sdk/storage/Azure.Storage.Blobs/tests/SessionRecords/ServiceClientTests/CanMockClientConstructorsAsync.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope", + "Storage_TestConfigHierarchicalNamespace": "NamespaceTenant\nkasobolcanaryhns\nU2FuaXRpemVk\nhttps://kasobolcanaryhns.blob.core.windows.net\nhttps://kasobolcanaryhns.file.core.windows.net\nhttps://kasobolcanaryhns.queue.core.windows.net\nhttps://kasobolcanaryhns.table.core.windows.net\n\n\n\n\nhttps://kasobolcanaryhns-secondary.blob.core.windows.net\nhttps://kasobolcanaryhns-secondary.file.core.windows.net\nhttps://kasobolcanaryhns-secondary.queue.core.windows.net\nhttps://kasobolcanaryhns-secondary.table.core.windows.net\nc6b5fe1a-9b59-4975-92c4-d9f728c3c371\nSanitized\n72f988bf-86f1-41af-91ab-2d7cd011db47\nhttps://login.microsoftonline.com/\nCloud\nBlobEndpoint=https://kasobolcanaryhns.blob.core.windows.net/;QueueEndpoint=https://kasobolcanaryhns.queue.core.windows.net/;FileEndpoint=https://kasobolcanaryhns.file.core.windows.net/;BlobSecondaryEndpoint=https://kasobolcanaryhns-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasobolcanaryhns-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasobolcanaryhns-secondary.file.core.windows.net/;AccountName=kasobolcanaryhns;AccountKey=Sanitized\n" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Files.DataLake/src/DataLakeFileSystemClient.cs b/sdk/storage/Azure.Storage.Files.DataLake/src/DataLakeFileSystemClient.cs index b15d4a8063cc7..d29fe655d2231 100644 --- a/sdk/storage/Azure.Storage.Files.DataLake/src/DataLakeFileSystemClient.cs +++ b/sdk/storage/Azure.Storage.Files.DataLake/src/DataLakeFileSystemClient.cs @@ -238,7 +238,7 @@ public DataLakeFileSystemClient(string connectionString, string fileSystemName, _storageSharedKeyCredential = sharedKeyCredential; _version = options.Version; _clientDiagnostics = new ClientDiagnostics(options); - _containerClient = BlobContainerClientInternals.Create(_blobUri, _pipeline, Version.AsBlobsVersion(), _clientDiagnostics); + _containerClient = BlobContainerClientInternals.Create(_blobUri, _pipeline, _version.AsBlobsVersion(), _clientDiagnostics); } /// @@ -397,7 +397,7 @@ internal DataLakeFileSystemClient( _version = options.Version; _clientDiagnostics = new ClientDiagnostics(options); _storageSharedKeyCredential = storageSharedKeyCredential; - _containerClient = BlobContainerClientInternals.Create(_blobUri, _pipeline, Version.AsBlobsVersion(), _clientDiagnostics); + _containerClient = BlobContainerClientInternals.Create(_blobUri, _pipeline, _version.AsBlobsVersion(), _clientDiagnostics); } /// @@ -436,7 +436,7 @@ internal DataLakeFileSystemClient( _storageSharedKeyCredential = storageSharedKeyCredential; _version = version; _clientDiagnostics = clientDiagnostics; - _containerClient = BlobContainerClientInternals.Create(_blobUri, pipeline, Version.AsBlobsVersion(), _clientDiagnostics); + _containerClient = BlobContainerClientInternals.Create(_blobUri, pipeline, _version.AsBlobsVersion(), _clientDiagnostics); } /// diff --git a/sdk/storage/Azure.Storage.Files.DataLake/src/DataLakePathClient.cs b/sdk/storage/Azure.Storage.Files.DataLake/src/DataLakePathClient.cs index 6dbd3b0c051e7..53c0441913fd2 100644 --- a/sdk/storage/Azure.Storage.Files.DataLake/src/DataLakePathClient.cs +++ b/sdk/storage/Azure.Storage.Files.DataLake/src/DataLakePathClient.cs @@ -302,7 +302,7 @@ public DataLakePathClient( _version = options.Version; _clientDiagnostics = new ClientDiagnostics(options); _storageSharedKeyCredential = sharedKeyCredential; - _blockBlobClient = BlockBlobClientInternals.Create(_blobUri, _pipeline, Version.AsBlobsVersion(), _clientDiagnostics); + _blockBlobClient = BlockBlobClientInternals.Create(_blobUri, _pipeline, _version.AsBlobsVersion(), _clientDiagnostics); } /// @@ -482,15 +482,15 @@ internal DataLakePathClient( _version = options.Version; _clientDiagnostics = new ClientDiagnostics(options); _storageSharedKeyCredential = storageSharedKeyCredential; - _blockBlobClient = BlockBlobClientInternals.Create(_blobUri, _pipeline, Version.AsBlobsVersion(), _clientDiagnostics); + _blockBlobClient = BlockBlobClientInternals.Create(_blobUri, _pipeline, _version.AsBlobsVersion(), _clientDiagnostics); uriBuilder.DirectoryOrFilePath = null; _fileSystemClient = new DataLakeFileSystemClient( uriBuilder.ToDfsUri(), _pipeline, storageSharedKeyCredential, - Version, - ClientDiagnostics); + _version, + _clientDiagnostics); } /// diff --git a/sdk/storage/Azure.Storage.Files.DataLake/src/DataLakeServiceClient.cs b/sdk/storage/Azure.Storage.Files.DataLake/src/DataLakeServiceClient.cs index e7b58c8d65200..6d6e390621137 100644 --- a/sdk/storage/Azure.Storage.Files.DataLake/src/DataLakeServiceClient.cs +++ b/sdk/storage/Azure.Storage.Files.DataLake/src/DataLakeServiceClient.cs @@ -199,7 +199,7 @@ public DataLakeServiceClient(string connectionString, DataLakeClientOptions opti _blobUri, _pipeline, authPolicy, - Version.AsBlobsVersion(), + _version.AsBlobsVersion(), _clientDiagnostics); } @@ -383,7 +383,7 @@ internal DataLakeServiceClient( _blobUri, _pipeline, authentication, - Version.AsBlobsVersion(), + _version.AsBlobsVersion(), _clientDiagnostics); } diff --git a/sdk/storage/Azure.Storage.Files.DataLake/tests/DirectoryClientTests.cs b/sdk/storage/Azure.Storage.Files.DataLake/tests/DirectoryClientTests.cs index 91bb6386383f9..85db68d33ab43 100644 --- a/sdk/storage/Azure.Storage.Files.DataLake/tests/DirectoryClientTests.cs +++ b/sdk/storage/Azure.Storage.Files.DataLake/tests/DirectoryClientTests.cs @@ -13,6 +13,7 @@ using Azure.Storage.Files.DataLake.Models; using Azure.Storage.Sas; using Azure.Storage.Test; +using Moq; using NUnit.Framework; using TestConstants = Azure.Storage.Test.TestConstants; @@ -5265,5 +5266,17 @@ public void GenerateSas_BuilderIsDirectoryError() } } #endregion + + [Test] + public void CanMockClientConstructors() + { + // One has to call .Object to trigger constructor. It's lazy. + var mock = new Mock(TestConfigDefault.ConnectionString, "name", "name", new DataLakeClientOptions()).Object; + mock = new Mock(TestConfigDefault.ConnectionString, "name", "name").Object; + mock = new Mock(new Uri("https://test/test"), new DataLakeClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), GetNewSharedKeyCredentials(), new DataLakeClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), new AzureSasCredential("foo"), new DataLakeClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), GetOAuthCredential(TestConfigHierarchicalNamespace), new DataLakeClientOptions()).Object; + } } } diff --git a/sdk/storage/Azure.Storage.Files.DataLake/tests/FileClientTests.cs b/sdk/storage/Azure.Storage.Files.DataLake/tests/FileClientTests.cs index 52bd573e9ee16..6611ff455ed57 100644 --- a/sdk/storage/Azure.Storage.Files.DataLake/tests/FileClientTests.cs +++ b/sdk/storage/Azure.Storage.Files.DataLake/tests/FileClientTests.cs @@ -15,6 +15,7 @@ using Azure.Storage.Files.DataLake.Models; using Azure.Storage.Sas; using Azure.Storage.Test; +using Moq; using NUnit.Framework; namespace Azure.Storage.Files.DataLake.Tests @@ -4974,5 +4975,17 @@ public void GenerateSas_BuilderIsDirectoryError() } } #endregion + + [Test] + public void CanMockClientConstructors() + { + // One has to call .Object to trigger constructor. It's lazy. + var mock = new Mock(TestConfigDefault.ConnectionString, "name", "name", new DataLakeClientOptions()).Object; + mock = new Mock(TestConfigDefault.ConnectionString, "name", "name").Object; + mock = new Mock(new Uri("https://test/test"), new DataLakeClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), GetNewSharedKeyCredentials(), new DataLakeClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), new AzureSasCredential("foo"), new DataLakeClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), GetOAuthCredential(TestConfigHierarchicalNamespace), new DataLakeClientOptions()).Object; + } } } diff --git a/sdk/storage/Azure.Storage.Files.DataLake/tests/FileSystemClientTests.cs b/sdk/storage/Azure.Storage.Files.DataLake/tests/FileSystemClientTests.cs index d3e349cc92f52..014bf1ce4f171 100644 --- a/sdk/storage/Azure.Storage.Files.DataLake/tests/FileSystemClientTests.cs +++ b/sdk/storage/Azure.Storage.Files.DataLake/tests/FileSystemClientTests.cs @@ -12,6 +12,7 @@ using Azure.Storage.Files.DataLake.Models; using Azure.Storage.Sas; using Azure.Storage.Test; +using Moq; using NUnit.Framework; namespace Azure.Storage.Files.DataLake.Tests @@ -2260,6 +2261,18 @@ public void GenerateSas_BuilderWrongName() } #endregion + [Test] + public void CanMockClientConstructors() + { + // One has to call .Object to trigger constructor. It's lazy. + var mock = new Mock(TestConfigDefault.ConnectionString, "name", new DataLakeClientOptions()).Object; + mock = new Mock(TestConfigDefault.ConnectionString, "name").Object; + mock = new Mock(new Uri("https://test/test"), new DataLakeClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), GetNewSharedKeyCredentials(), new DataLakeClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), new AzureSasCredential("foo"), new DataLakeClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), GetOAuthCredential(TestConfigHierarchicalNamespace), new DataLakeClientOptions()).Object; + } + private IEnumerable Conditions_Data => new[] { diff --git a/sdk/storage/Azure.Storage.Files.DataLake/tests/PathClientTests.cs b/sdk/storage/Azure.Storage.Files.DataLake/tests/PathClientTests.cs index 0a3237025850f..c83d2149ef319 100644 --- a/sdk/storage/Azure.Storage.Files.DataLake/tests/PathClientTests.cs +++ b/sdk/storage/Azure.Storage.Files.DataLake/tests/PathClientTests.cs @@ -8,6 +8,7 @@ using Azure.Storage.Files.DataLake.Models; using Azure.Storage.Sas; using Azure.Storage.Test; +using Moq; using NUnit.Framework; namespace Azure.Storage.Files.DataLake.Tests @@ -366,5 +367,17 @@ public void GenerateSas_BuilderIsDirectoryError() } } #endregion + + [Test] + public void CanMockClientConstructors() + { + // One has to call .Object to trigger constructor. It's lazy. + var mock = new Mock(TestConfigDefault.ConnectionString, "name", "name", new DataLakeClientOptions()).Object; + mock = new Mock(TestConfigDefault.ConnectionString, "name", "name").Object; + mock = new Mock(new Uri("https://test/test"), new DataLakeClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), GetNewSharedKeyCredentials(), new DataLakeClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), new AzureSasCredential("foo"), new DataLakeClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), GetOAuthCredential(TestConfigHierarchicalNamespace), new DataLakeClientOptions()).Object; + } } } diff --git a/sdk/storage/Azure.Storage.Files.DataLake/tests/ServiceClientTests.cs b/sdk/storage/Azure.Storage.Files.DataLake/tests/ServiceClientTests.cs index 9feed2a0f92ea..b554dad72cd53 100644 --- a/sdk/storage/Azure.Storage.Files.DataLake/tests/ServiceClientTests.cs +++ b/sdk/storage/Azure.Storage.Files.DataLake/tests/ServiceClientTests.cs @@ -12,6 +12,7 @@ using Azure.Storage.Files.DataLake.Models; using Azure.Storage.Sas; using Azure.Storage.Test; +using Moq; using NUnit.Framework; namespace Azure.Storage.Files.DataLake.Tests @@ -506,5 +507,17 @@ public void GenerateAccountSas_WrongService_Service() } } #endregion + + [Test] + public void CanMockClientConstructors() + { + // One has to call .Object to trigger constructor. It's lazy. + var mock = new Mock(TestConfigDefault.ConnectionString, new DataLakeClientOptions()).Object; + mock = new Mock(TestConfigDefault.ConnectionString).Object; + mock = new Mock(new Uri("https://test/test"), new DataLakeClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), GetNewSharedKeyCredentials(), new DataLakeClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), new AzureSasCredential("foo"), new DataLakeClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), GetOAuthCredential(TestConfigHierarchicalNamespace), new DataLakeClientOptions()).Object; + } } } diff --git a/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/DirectoryClientTests/CanMockClientConstructors.json b/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/DirectoryClientTests/CanMockClientConstructors.json new file mode 100644 index 0000000000000..e62d82ef43e64 --- /dev/null +++ b/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/DirectoryClientTests/CanMockClientConstructors.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope", + "Storage_TestConfigHierarchicalNamespace": "NamespaceTenant\nkasobolcanaryhns\nU2FuaXRpemVk\nhttps://kasobolcanaryhns.blob.core.windows.net\nhttps://kasobolcanaryhns.file.core.windows.net\nhttps://kasobolcanaryhns.queue.core.windows.net\nhttps://kasobolcanaryhns.table.core.windows.net\n\n\n\n\nhttps://kasobolcanaryhns-secondary.blob.core.windows.net\nhttps://kasobolcanaryhns-secondary.file.core.windows.net\nhttps://kasobolcanaryhns-secondary.queue.core.windows.net\nhttps://kasobolcanaryhns-secondary.table.core.windows.net\nc6b5fe1a-9b59-4975-92c4-d9f728c3c371\nSanitized\n72f988bf-86f1-41af-91ab-2d7cd011db47\nhttps://login.microsoftonline.com/\nCloud\nBlobEndpoint=https://kasobolcanaryhns.blob.core.windows.net/;QueueEndpoint=https://kasobolcanaryhns.queue.core.windows.net/;FileEndpoint=https://kasobolcanaryhns.file.core.windows.net/;BlobSecondaryEndpoint=https://kasobolcanaryhns-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasobolcanaryhns-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasobolcanaryhns-secondary.file.core.windows.net/;AccountName=kasobolcanaryhns;AccountKey=Sanitized\n" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/DirectoryClientTests/CanMockClientConstructorsAsync.json b/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/DirectoryClientTests/CanMockClientConstructorsAsync.json new file mode 100644 index 0000000000000..e62d82ef43e64 --- /dev/null +++ b/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/DirectoryClientTests/CanMockClientConstructorsAsync.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope", + "Storage_TestConfigHierarchicalNamespace": "NamespaceTenant\nkasobolcanaryhns\nU2FuaXRpemVk\nhttps://kasobolcanaryhns.blob.core.windows.net\nhttps://kasobolcanaryhns.file.core.windows.net\nhttps://kasobolcanaryhns.queue.core.windows.net\nhttps://kasobolcanaryhns.table.core.windows.net\n\n\n\n\nhttps://kasobolcanaryhns-secondary.blob.core.windows.net\nhttps://kasobolcanaryhns-secondary.file.core.windows.net\nhttps://kasobolcanaryhns-secondary.queue.core.windows.net\nhttps://kasobolcanaryhns-secondary.table.core.windows.net\nc6b5fe1a-9b59-4975-92c4-d9f728c3c371\nSanitized\n72f988bf-86f1-41af-91ab-2d7cd011db47\nhttps://login.microsoftonline.com/\nCloud\nBlobEndpoint=https://kasobolcanaryhns.blob.core.windows.net/;QueueEndpoint=https://kasobolcanaryhns.queue.core.windows.net/;FileEndpoint=https://kasobolcanaryhns.file.core.windows.net/;BlobSecondaryEndpoint=https://kasobolcanaryhns-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasobolcanaryhns-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasobolcanaryhns-secondary.file.core.windows.net/;AccountName=kasobolcanaryhns;AccountKey=Sanitized\n" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/FileClientTests/CanMockClientConstructors.json b/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/FileClientTests/CanMockClientConstructors.json new file mode 100644 index 0000000000000..e62d82ef43e64 --- /dev/null +++ b/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/FileClientTests/CanMockClientConstructors.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope", + "Storage_TestConfigHierarchicalNamespace": "NamespaceTenant\nkasobolcanaryhns\nU2FuaXRpemVk\nhttps://kasobolcanaryhns.blob.core.windows.net\nhttps://kasobolcanaryhns.file.core.windows.net\nhttps://kasobolcanaryhns.queue.core.windows.net\nhttps://kasobolcanaryhns.table.core.windows.net\n\n\n\n\nhttps://kasobolcanaryhns-secondary.blob.core.windows.net\nhttps://kasobolcanaryhns-secondary.file.core.windows.net\nhttps://kasobolcanaryhns-secondary.queue.core.windows.net\nhttps://kasobolcanaryhns-secondary.table.core.windows.net\nc6b5fe1a-9b59-4975-92c4-d9f728c3c371\nSanitized\n72f988bf-86f1-41af-91ab-2d7cd011db47\nhttps://login.microsoftonline.com/\nCloud\nBlobEndpoint=https://kasobolcanaryhns.blob.core.windows.net/;QueueEndpoint=https://kasobolcanaryhns.queue.core.windows.net/;FileEndpoint=https://kasobolcanaryhns.file.core.windows.net/;BlobSecondaryEndpoint=https://kasobolcanaryhns-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasobolcanaryhns-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasobolcanaryhns-secondary.file.core.windows.net/;AccountName=kasobolcanaryhns;AccountKey=Sanitized\n" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/FileClientTests/CanMockClientConstructorsAsync.json b/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/FileClientTests/CanMockClientConstructorsAsync.json new file mode 100644 index 0000000000000..e62d82ef43e64 --- /dev/null +++ b/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/FileClientTests/CanMockClientConstructorsAsync.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope", + "Storage_TestConfigHierarchicalNamespace": "NamespaceTenant\nkasobolcanaryhns\nU2FuaXRpemVk\nhttps://kasobolcanaryhns.blob.core.windows.net\nhttps://kasobolcanaryhns.file.core.windows.net\nhttps://kasobolcanaryhns.queue.core.windows.net\nhttps://kasobolcanaryhns.table.core.windows.net\n\n\n\n\nhttps://kasobolcanaryhns-secondary.blob.core.windows.net\nhttps://kasobolcanaryhns-secondary.file.core.windows.net\nhttps://kasobolcanaryhns-secondary.queue.core.windows.net\nhttps://kasobolcanaryhns-secondary.table.core.windows.net\nc6b5fe1a-9b59-4975-92c4-d9f728c3c371\nSanitized\n72f988bf-86f1-41af-91ab-2d7cd011db47\nhttps://login.microsoftonline.com/\nCloud\nBlobEndpoint=https://kasobolcanaryhns.blob.core.windows.net/;QueueEndpoint=https://kasobolcanaryhns.queue.core.windows.net/;FileEndpoint=https://kasobolcanaryhns.file.core.windows.net/;BlobSecondaryEndpoint=https://kasobolcanaryhns-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasobolcanaryhns-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasobolcanaryhns-secondary.file.core.windows.net/;AccountName=kasobolcanaryhns;AccountKey=Sanitized\n" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/FileSystemClientTests/CanMockClientConstructors.json b/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/FileSystemClientTests/CanMockClientConstructors.json new file mode 100644 index 0000000000000..e62d82ef43e64 --- /dev/null +++ b/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/FileSystemClientTests/CanMockClientConstructors.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope", + "Storage_TestConfigHierarchicalNamespace": "NamespaceTenant\nkasobolcanaryhns\nU2FuaXRpemVk\nhttps://kasobolcanaryhns.blob.core.windows.net\nhttps://kasobolcanaryhns.file.core.windows.net\nhttps://kasobolcanaryhns.queue.core.windows.net\nhttps://kasobolcanaryhns.table.core.windows.net\n\n\n\n\nhttps://kasobolcanaryhns-secondary.blob.core.windows.net\nhttps://kasobolcanaryhns-secondary.file.core.windows.net\nhttps://kasobolcanaryhns-secondary.queue.core.windows.net\nhttps://kasobolcanaryhns-secondary.table.core.windows.net\nc6b5fe1a-9b59-4975-92c4-d9f728c3c371\nSanitized\n72f988bf-86f1-41af-91ab-2d7cd011db47\nhttps://login.microsoftonline.com/\nCloud\nBlobEndpoint=https://kasobolcanaryhns.blob.core.windows.net/;QueueEndpoint=https://kasobolcanaryhns.queue.core.windows.net/;FileEndpoint=https://kasobolcanaryhns.file.core.windows.net/;BlobSecondaryEndpoint=https://kasobolcanaryhns-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasobolcanaryhns-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasobolcanaryhns-secondary.file.core.windows.net/;AccountName=kasobolcanaryhns;AccountKey=Sanitized\n" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/FileSystemClientTests/CanMockClientConstructorsAsync.json b/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/FileSystemClientTests/CanMockClientConstructorsAsync.json new file mode 100644 index 0000000000000..e62d82ef43e64 --- /dev/null +++ b/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/FileSystemClientTests/CanMockClientConstructorsAsync.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope", + "Storage_TestConfigHierarchicalNamespace": "NamespaceTenant\nkasobolcanaryhns\nU2FuaXRpemVk\nhttps://kasobolcanaryhns.blob.core.windows.net\nhttps://kasobolcanaryhns.file.core.windows.net\nhttps://kasobolcanaryhns.queue.core.windows.net\nhttps://kasobolcanaryhns.table.core.windows.net\n\n\n\n\nhttps://kasobolcanaryhns-secondary.blob.core.windows.net\nhttps://kasobolcanaryhns-secondary.file.core.windows.net\nhttps://kasobolcanaryhns-secondary.queue.core.windows.net\nhttps://kasobolcanaryhns-secondary.table.core.windows.net\nc6b5fe1a-9b59-4975-92c4-d9f728c3c371\nSanitized\n72f988bf-86f1-41af-91ab-2d7cd011db47\nhttps://login.microsoftonline.com/\nCloud\nBlobEndpoint=https://kasobolcanaryhns.blob.core.windows.net/;QueueEndpoint=https://kasobolcanaryhns.queue.core.windows.net/;FileEndpoint=https://kasobolcanaryhns.file.core.windows.net/;BlobSecondaryEndpoint=https://kasobolcanaryhns-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasobolcanaryhns-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasobolcanaryhns-secondary.file.core.windows.net/;AccountName=kasobolcanaryhns;AccountKey=Sanitized\n" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/PathClientTests/CanMockClientConstructors.json b/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/PathClientTests/CanMockClientConstructors.json new file mode 100644 index 0000000000000..e62d82ef43e64 --- /dev/null +++ b/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/PathClientTests/CanMockClientConstructors.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope", + "Storage_TestConfigHierarchicalNamespace": "NamespaceTenant\nkasobolcanaryhns\nU2FuaXRpemVk\nhttps://kasobolcanaryhns.blob.core.windows.net\nhttps://kasobolcanaryhns.file.core.windows.net\nhttps://kasobolcanaryhns.queue.core.windows.net\nhttps://kasobolcanaryhns.table.core.windows.net\n\n\n\n\nhttps://kasobolcanaryhns-secondary.blob.core.windows.net\nhttps://kasobolcanaryhns-secondary.file.core.windows.net\nhttps://kasobolcanaryhns-secondary.queue.core.windows.net\nhttps://kasobolcanaryhns-secondary.table.core.windows.net\nc6b5fe1a-9b59-4975-92c4-d9f728c3c371\nSanitized\n72f988bf-86f1-41af-91ab-2d7cd011db47\nhttps://login.microsoftonline.com/\nCloud\nBlobEndpoint=https://kasobolcanaryhns.blob.core.windows.net/;QueueEndpoint=https://kasobolcanaryhns.queue.core.windows.net/;FileEndpoint=https://kasobolcanaryhns.file.core.windows.net/;BlobSecondaryEndpoint=https://kasobolcanaryhns-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasobolcanaryhns-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasobolcanaryhns-secondary.file.core.windows.net/;AccountName=kasobolcanaryhns;AccountKey=Sanitized\n" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/PathClientTests/CanMockClientConstructorsAsync.json b/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/PathClientTests/CanMockClientConstructorsAsync.json new file mode 100644 index 0000000000000..e62d82ef43e64 --- /dev/null +++ b/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/PathClientTests/CanMockClientConstructorsAsync.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope", + "Storage_TestConfigHierarchicalNamespace": "NamespaceTenant\nkasobolcanaryhns\nU2FuaXRpemVk\nhttps://kasobolcanaryhns.blob.core.windows.net\nhttps://kasobolcanaryhns.file.core.windows.net\nhttps://kasobolcanaryhns.queue.core.windows.net\nhttps://kasobolcanaryhns.table.core.windows.net\n\n\n\n\nhttps://kasobolcanaryhns-secondary.blob.core.windows.net\nhttps://kasobolcanaryhns-secondary.file.core.windows.net\nhttps://kasobolcanaryhns-secondary.queue.core.windows.net\nhttps://kasobolcanaryhns-secondary.table.core.windows.net\nc6b5fe1a-9b59-4975-92c4-d9f728c3c371\nSanitized\n72f988bf-86f1-41af-91ab-2d7cd011db47\nhttps://login.microsoftonline.com/\nCloud\nBlobEndpoint=https://kasobolcanaryhns.blob.core.windows.net/;QueueEndpoint=https://kasobolcanaryhns.queue.core.windows.net/;FileEndpoint=https://kasobolcanaryhns.file.core.windows.net/;BlobSecondaryEndpoint=https://kasobolcanaryhns-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasobolcanaryhns-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasobolcanaryhns-secondary.file.core.windows.net/;AccountName=kasobolcanaryhns;AccountKey=Sanitized\n" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/ServiceClientTests/CanMockClientConstructors.json b/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/ServiceClientTests/CanMockClientConstructors.json new file mode 100644 index 0000000000000..e62d82ef43e64 --- /dev/null +++ b/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/ServiceClientTests/CanMockClientConstructors.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope", + "Storage_TestConfigHierarchicalNamespace": "NamespaceTenant\nkasobolcanaryhns\nU2FuaXRpemVk\nhttps://kasobolcanaryhns.blob.core.windows.net\nhttps://kasobolcanaryhns.file.core.windows.net\nhttps://kasobolcanaryhns.queue.core.windows.net\nhttps://kasobolcanaryhns.table.core.windows.net\n\n\n\n\nhttps://kasobolcanaryhns-secondary.blob.core.windows.net\nhttps://kasobolcanaryhns-secondary.file.core.windows.net\nhttps://kasobolcanaryhns-secondary.queue.core.windows.net\nhttps://kasobolcanaryhns-secondary.table.core.windows.net\nc6b5fe1a-9b59-4975-92c4-d9f728c3c371\nSanitized\n72f988bf-86f1-41af-91ab-2d7cd011db47\nhttps://login.microsoftonline.com/\nCloud\nBlobEndpoint=https://kasobolcanaryhns.blob.core.windows.net/;QueueEndpoint=https://kasobolcanaryhns.queue.core.windows.net/;FileEndpoint=https://kasobolcanaryhns.file.core.windows.net/;BlobSecondaryEndpoint=https://kasobolcanaryhns-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasobolcanaryhns-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasobolcanaryhns-secondary.file.core.windows.net/;AccountName=kasobolcanaryhns;AccountKey=Sanitized\n" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/ServiceClientTests/CanMockClientConstructorsAsync.json b/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/ServiceClientTests/CanMockClientConstructorsAsync.json new file mode 100644 index 0000000000000..e62d82ef43e64 --- /dev/null +++ b/sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/ServiceClientTests/CanMockClientConstructorsAsync.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope", + "Storage_TestConfigHierarchicalNamespace": "NamespaceTenant\nkasobolcanaryhns\nU2FuaXRpemVk\nhttps://kasobolcanaryhns.blob.core.windows.net\nhttps://kasobolcanaryhns.file.core.windows.net\nhttps://kasobolcanaryhns.queue.core.windows.net\nhttps://kasobolcanaryhns.table.core.windows.net\n\n\n\n\nhttps://kasobolcanaryhns-secondary.blob.core.windows.net\nhttps://kasobolcanaryhns-secondary.file.core.windows.net\nhttps://kasobolcanaryhns-secondary.queue.core.windows.net\nhttps://kasobolcanaryhns-secondary.table.core.windows.net\nc6b5fe1a-9b59-4975-92c4-d9f728c3c371\nSanitized\n72f988bf-86f1-41af-91ab-2d7cd011db47\nhttps://login.microsoftonline.com/\nCloud\nBlobEndpoint=https://kasobolcanaryhns.blob.core.windows.net/;QueueEndpoint=https://kasobolcanaryhns.queue.core.windows.net/;FileEndpoint=https://kasobolcanaryhns.file.core.windows.net/;BlobSecondaryEndpoint=https://kasobolcanaryhns-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasobolcanaryhns-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasobolcanaryhns-secondary.file.core.windows.net/;AccountName=kasobolcanaryhns;AccountKey=Sanitized\n" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Files.Shares/src/ShareClient.cs b/sdk/storage/Azure.Storage.Files.Shares/src/ShareClient.cs index 56fc8184e1626..2aee0f03259d4 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/src/ShareClient.cs +++ b/sdk/storage/Azure.Storage.Files.Shares/src/ShareClient.cs @@ -281,16 +281,15 @@ internal ShareClient( private ShareRestClient BuildShareRestClient(Uri uri) { - ShareUriBuilder uriBuilder = new ShareUriBuilder(uri) - { - ShareName = null - }; + ShareUriBuilder uriBuilder = new ShareUriBuilder(uri); + _name = uriBuilder.ShareName; + uriBuilder.ShareName = null; return new ShareRestClient( - ClientConfiguration.ClientDiagnostics, - ClientConfiguration.Pipeline, + _clientConfiguration.ClientDiagnostics, + _clientConfiguration.Pipeline, uriBuilder.ToUri().ToString(), - path: Name, - ClientConfiguration.Version.ToVersionString()); + path: _name, + _clientConfiguration.Version.ToVersionString()); } #endregion ctors diff --git a/sdk/storage/Azure.Storage.Files.Shares/src/ShareDirectoryClient.cs b/sdk/storage/Azure.Storage.Files.Shares/src/ShareDirectoryClient.cs index e1972108d7f56..17e93e0a8c737 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/src/ShareDirectoryClient.cs +++ b/sdk/storage/Azure.Storage.Files.Shares/src/ShareDirectoryClient.cs @@ -331,11 +331,11 @@ private DirectoryRestClient BuildDirectoryRestClient(Uri uri) DirectoryOrFilePath = null }; return new DirectoryRestClient( - ClientConfiguration.ClientDiagnostics, - ClientConfiguration.Pipeline, + _clientConfiguration.ClientDiagnostics, + _clientConfiguration.Pipeline, uriBuilder.ToUri().ToString(), path: $"{ShareName}/{Path.EscapePath()}", - ClientConfiguration.Version.ToVersionString()); + _clientConfiguration.Version.ToVersionString()); } #endregion ctors diff --git a/sdk/storage/Azure.Storage.Files.Shares/src/ShareFileClient.cs b/sdk/storage/Azure.Storage.Files.Shares/src/ShareFileClient.cs index 332a7195ffb98..8d4b74c4beba7 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/src/ShareFileClient.cs +++ b/sdk/storage/Azure.Storage.Files.Shares/src/ShareFileClient.cs @@ -340,11 +340,11 @@ private FileRestClient BuildFileRestClient(Uri uri) DirectoryOrFilePath = null }; return new FileRestClient( - ClientConfiguration.ClientDiagnostics, - ClientConfiguration.Pipeline, + _clientConfiguration.ClientDiagnostics, + _clientConfiguration.Pipeline, uriBuilder.ToUri().ToString(), path: $"{ShareName}/{Path.EscapePath()}", - ClientConfiguration.Version.ToVersionString()); + _clientConfiguration.Version.ToVersionString()); } #endregion ctors diff --git a/sdk/storage/Azure.Storage.Files.Shares/src/ShareServiceClient.cs b/sdk/storage/Azure.Storage.Files.Shares/src/ShareServiceClient.cs index 113cdae924b40..ee08bebad4809 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/src/ShareServiceClient.cs +++ b/sdk/storage/Azure.Storage.Files.Shares/src/ShareServiceClient.cs @@ -233,10 +233,10 @@ internal ShareServiceClient( private ServiceRestClient BuildServiceRestClient() => new ServiceRestClient( - ClientConfiguration.ClientDiagnostics, - ClientConfiguration.Pipeline, - Uri.ToString(), - ClientConfiguration.Version.ToVersionString()); + _clientConfiguration.ClientDiagnostics, + _clientConfiguration.Pipeline, + _uri.ToString(), + _clientConfiguration.Version.ToVersionString()); #endregion ctors /// diff --git a/sdk/storage/Azure.Storage.Files.Shares/tests/DirectoryClientTests.cs b/sdk/storage/Azure.Storage.Files.Shares/tests/DirectoryClientTests.cs index 67a2bc1543b43..5c6e4f37e0e85 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/tests/DirectoryClientTests.cs +++ b/sdk/storage/Azure.Storage.Files.Shares/tests/DirectoryClientTests.cs @@ -11,6 +11,7 @@ using Azure.Storage.Files.Shares.Models; using Azure.Storage.Sas; using Azure.Storage.Test; +using Moq; using NUnit.Framework; namespace Azure.Storage.Files.Shares.Tests @@ -1424,5 +1425,16 @@ public void GenerateSas_BuilderWrongDirectoryName() } } #endregion + + [Test] + public void CanMockClientConstructors() + { + // One has to call .Object to trigger constructor. It's lazy. + var mock = new Mock(TestConfigDefault.ConnectionString, "name", "name", new ShareClientOptions()).Object; + mock = new Mock(TestConfigDefault.ConnectionString, "name", "name").Object; + mock = new Mock(new Uri("https://test/test/test"), new ShareClientOptions()).Object; + mock = new Mock(new Uri("https://test/test/test"), GetNewSharedKeyCredentials(), new ShareClientOptions()).Object; + mock = new Mock(new Uri("https://test/test/test"), new AzureSasCredential("foo"), new ShareClientOptions()).Object; + } } } diff --git a/sdk/storage/Azure.Storage.Files.Shares/tests/FileClientTests.cs b/sdk/storage/Azure.Storage.Files.Shares/tests/FileClientTests.cs index 84cc56c29df55..b3255377ef9ff 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/tests/FileClientTests.cs +++ b/sdk/storage/Azure.Storage.Files.Shares/tests/FileClientTests.cs @@ -16,6 +16,7 @@ using Azure.Storage.Test; using Azure.Storage.Test.Shared; using BenchmarkDotNet.Toolchains.Roslyn; +using Moq; using NUnit.Framework; namespace Azure.Storage.Files.Shares.Tests @@ -4194,6 +4195,17 @@ public void GenerateSas_BuilderWrongFileName() } #endregion + [Test] + public void CanMockClientConstructors() + { + // One has to call .Object to trigger constructor. It's lazy. + var mock = new Mock(TestConfigDefault.ConnectionString, "name", "name", new ShareClientOptions()).Object; + mock = new Mock(TestConfigDefault.ConnectionString, "name", "name").Object; + mock = new Mock(new Uri("https://test/test/test"), new ShareClientOptions()).Object; + mock = new Mock(new Uri("https://test/test/test"), GetNewSharedKeyCredentials(), new ShareClientOptions()).Object; + mock = new Mock(new Uri("https://test/test/test"), new AzureSasCredential("foo"), new ShareClientOptions()).Object; + } + private async Task WaitForCopy(ShareFileClient file, int milliWait = 200) { CopyStatus status = CopyStatus.Pending; diff --git a/sdk/storage/Azure.Storage.Files.Shares/tests/ServiceClientTests.cs b/sdk/storage/Azure.Storage.Files.Shares/tests/ServiceClientTests.cs index 9b047faa19bf5..fa10fd7d7bd13 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/tests/ServiceClientTests.cs +++ b/sdk/storage/Azure.Storage.Files.Shares/tests/ServiceClientTests.cs @@ -9,6 +9,7 @@ using Azure.Storage.Files.Shares.Models; using Azure.Storage.Sas; using Azure.Storage.Test; +using Moq; using NUnit.Framework; namespace Azure.Storage.Files.Shares.Tests @@ -600,5 +601,16 @@ public void GenerateAccountSas_WrongService_Service() } } #endregion + + [Test] + public void CanMockClientConstructors() + { + // One has to call .Object to trigger constructor. It's lazy. + var mock = new Mock(TestConfigDefault.ConnectionString, new ShareClientOptions()).Object; + mock = new Mock(TestConfigDefault.ConnectionString).Object; + mock = new Mock(new Uri("https://test/test/test"), new ShareClientOptions()).Object; + mock = new Mock(new Uri("https://test/test/test"), GetNewSharedKeyCredentials(), new ShareClientOptions()).Object; + mock = new Mock(new Uri("https://test/test/test"), new AzureSasCredential("foo"), new ShareClientOptions()).Object; + } } } diff --git a/sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/DirectoryClientTests/CanMockClientConstructors.json b/sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/DirectoryClientTests/CanMockClientConstructors.json new file mode 100644 index 0000000000000..9a97b60fda957 --- /dev/null +++ b/sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/DirectoryClientTests/CanMockClientConstructors.json @@ -0,0 +1,6 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/DirectoryClientTests/CanMockClientConstructorsAsync.json b/sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/DirectoryClientTests/CanMockClientConstructorsAsync.json new file mode 100644 index 0000000000000..9a97b60fda957 --- /dev/null +++ b/sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/DirectoryClientTests/CanMockClientConstructorsAsync.json @@ -0,0 +1,6 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/FileClientTests/CanMockClientConstructors.json b/sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/FileClientTests/CanMockClientConstructors.json new file mode 100644 index 0000000000000..9a97b60fda957 --- /dev/null +++ b/sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/FileClientTests/CanMockClientConstructors.json @@ -0,0 +1,6 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/FileClientTests/CanMockClientConstructorsAsync.json b/sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/FileClientTests/CanMockClientConstructorsAsync.json new file mode 100644 index 0000000000000..9a97b60fda957 --- /dev/null +++ b/sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/FileClientTests/CanMockClientConstructorsAsync.json @@ -0,0 +1,6 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/ServiceClientTests/CanMockClientConstructors.json b/sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/ServiceClientTests/CanMockClientConstructors.json new file mode 100644 index 0000000000000..9a97b60fda957 --- /dev/null +++ b/sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/ServiceClientTests/CanMockClientConstructors.json @@ -0,0 +1,6 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/ServiceClientTests/CanMockClientConstructorsAsync.json b/sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/ServiceClientTests/CanMockClientConstructorsAsync.json new file mode 100644 index 0000000000000..9a97b60fda957 --- /dev/null +++ b/sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/ServiceClientTests/CanMockClientConstructorsAsync.json @@ -0,0 +1,6 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/ShareClientTests/CanMockClientConstructors.json b/sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/ShareClientTests/CanMockClientConstructors.json new file mode 100644 index 0000000000000..9a97b60fda957 --- /dev/null +++ b/sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/ShareClientTests/CanMockClientConstructors.json @@ -0,0 +1,6 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/ShareClientTests/CanMockClientConstructorsAsync.json b/sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/ShareClientTests/CanMockClientConstructorsAsync.json new file mode 100644 index 0000000000000..9a97b60fda957 --- /dev/null +++ b/sdk/storage/Azure.Storage.Files.Shares/tests/SessionRecords/ShareClientTests/CanMockClientConstructorsAsync.json @@ -0,0 +1,6 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Files.Shares/tests/ShareClientTests.cs b/sdk/storage/Azure.Storage.Files.Shares/tests/ShareClientTests.cs index 6213505f7647b..456dcd98a50a7 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/tests/ShareClientTests.cs +++ b/sdk/storage/Azure.Storage.Files.Shares/tests/ShareClientTests.cs @@ -15,6 +15,7 @@ using NUnit.Framework; using System.Threading; using Azure.Identity; +using Moq; namespace Azure.Storage.Files.Shares.Tests { @@ -2353,5 +2354,16 @@ public void GenerateSas_BuilderWrongName() } } #endregion + + [Test] + public void CanMockClientConstructors() + { + // One has to call .Object to trigger constructor. It's lazy. + var mock = new Mock(TestConfigDefault.ConnectionString, "name", new ShareClientOptions()).Object; + mock = new Mock(TestConfigDefault.ConnectionString, "name").Object; + mock = new Mock(new Uri("https://test/test/test"), new ShareClientOptions()).Object; + mock = new Mock(new Uri("https://test/test/test"), GetNewSharedKeyCredentials(), new ShareClientOptions()).Object; + mock = new Mock(new Uri("https://test/test/test"), new AzureSasCredential("foo"), new ShareClientOptions()).Object; + } } } diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs index 1398eccc3a2be..81c98988672a0 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs @@ -85,7 +85,7 @@ public class QueueClient /// internal virtual MessageIdRestClient MessageIdRestClient => _messageIdRestClient; - internal bool UsingClientSideEncryption => ClientConfiguration.ClientSideEncryption != default; + internal bool UsingClientSideEncryption => _clientConfiguration.ClientSideEncryption != default; /// /// QueueMaxMessagesPeek indicates the maximum number of messages @@ -390,25 +390,25 @@ internal QueueClient( string uriString = uriBuilder.ToUri().ToString(); QueueRestClient queueRestClient = new QueueRestClient( - ClientConfiguration.ClientDiagnostics, - ClientConfiguration.Pipeline, + _clientConfiguration.ClientDiagnostics, + _clientConfiguration.Pipeline, uriString, queueName, - ClientConfiguration.Version.ToVersionString()); + _clientConfiguration.Version.ToVersionString()); MessagesRestClient messagesRestClient = new MessagesRestClient( - ClientConfiguration.ClientDiagnostics, - ClientConfiguration.Pipeline, + _clientConfiguration.ClientDiagnostics, + _clientConfiguration.Pipeline, uriString, queueName, - ClientConfiguration.Version.ToVersionString()); + _clientConfiguration.Version.ToVersionString()); MessageIdRestClient messageIdRestClient = new MessageIdRestClient( - ClientConfiguration.ClientDiagnostics, - ClientConfiguration.Pipeline, + _clientConfiguration.ClientDiagnostics, + _clientConfiguration.Pipeline, uriString, queueName, - ClientConfiguration.Version.ToVersionString()); + _clientConfiguration.Version.ToVersionString()); return (queueRestClient, messagesRestClient, messageIdRestClient); } diff --git a/sdk/storage/Azure.Storage.Queues/src/QueueServiceClient.cs b/sdk/storage/Azure.Storage.Queues/src/QueueServiceClient.cs index 172fe630bc44e..81bbc3dba3d22 100644 --- a/sdk/storage/Azure.Storage.Queues/src/QueueServiceClient.cs +++ b/sdk/storage/Azure.Storage.Queues/src/QueueServiceClient.cs @@ -265,10 +265,10 @@ internal QueueServiceClient( private ServiceRestClient BuildServiceRestClient() => new ServiceRestClient( - ClientConfiguration.ClientDiagnostics, - ClientConfiguration.Pipeline, - Uri.ToString(), - ClientConfiguration.Version.ToVersionString()); + _clientConfiguration.ClientDiagnostics, + _clientConfiguration.Pipeline, + _uri.ToString(), + _clientConfiguration.Version.ToVersionString()); #endregion ctors /// diff --git a/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs b/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs index 353c6555f7fba..1eabd906497cb 100644 --- a/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs +++ b/sdk/storage/Azure.Storage.Queues/tests/QueueClientTests.cs @@ -14,6 +14,7 @@ using Azure.Core.TestFramework; using System.Buffers.Text; using System.Text; +using Moq; namespace Azure.Storage.Queues.Test { @@ -1505,5 +1506,17 @@ public void GenerateSas_BuilderWrongName() } } #endregion + + [Test] + public void CanMockClientConstructors() + { + // One has to call .Object to trigger constructor. It's lazy. + var mock = new Mock(TestConfigDefault.ConnectionString, "queuename", new QueueClientOptions()).Object; + mock = new Mock(TestConfigDefault.ConnectionString, "queuename").Object; + mock = new Mock(new Uri("https://test/test"), new QueueClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), GetNewSharedKeyCredentials(), new QueueClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), new AzureSasCredential("foo"), new QueueClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), GetOAuthCredential(TestConfigHierarchicalNamespace), new QueueClientOptions()).Object; + } } } diff --git a/sdk/storage/Azure.Storage.Queues/tests/ServiceClientTests.cs b/sdk/storage/Azure.Storage.Queues/tests/ServiceClientTests.cs index 6753188156a90..2d07607da6b8c 100644 --- a/sdk/storage/Azure.Storage.Queues/tests/ServiceClientTests.cs +++ b/sdk/storage/Azure.Storage.Queues/tests/ServiceClientTests.cs @@ -11,6 +11,7 @@ using Azure.Storage.Queues.Tests; using Azure.Storage.Sas; using Azure.Storage.Test; +using Moq; using NUnit.Framework; namespace Azure.Storage.Queues.Test @@ -531,5 +532,17 @@ public void GenerateAccountSas_WrongService_Service() } } #endregion + + [Test] + public void CanMockClientConstructors() + { + // One has to call .Object to trigger constructor. It's lazy. + var mock = new Mock(TestConfigDefault.ConnectionString, new QueueClientOptions()).Object; + mock = new Mock(TestConfigDefault.ConnectionString).Object; + mock = new Mock(new Uri("https://test/test"), new QueueClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), GetNewSharedKeyCredentials(), new QueueClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), new AzureSasCredential("foo"), new QueueClientOptions()).Object; + mock = new Mock(new Uri("https://test/test"), GetOAuthCredential(TestConfigHierarchicalNamespace), new QueueClientOptions()).Object; + } } } diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanMockClientConstructors.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanMockClientConstructors.json new file mode 100644 index 0000000000000..e62d82ef43e64 --- /dev/null +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanMockClientConstructors.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope", + "Storage_TestConfigHierarchicalNamespace": "NamespaceTenant\nkasobolcanaryhns\nU2FuaXRpemVk\nhttps://kasobolcanaryhns.blob.core.windows.net\nhttps://kasobolcanaryhns.file.core.windows.net\nhttps://kasobolcanaryhns.queue.core.windows.net\nhttps://kasobolcanaryhns.table.core.windows.net\n\n\n\n\nhttps://kasobolcanaryhns-secondary.blob.core.windows.net\nhttps://kasobolcanaryhns-secondary.file.core.windows.net\nhttps://kasobolcanaryhns-secondary.queue.core.windows.net\nhttps://kasobolcanaryhns-secondary.table.core.windows.net\nc6b5fe1a-9b59-4975-92c4-d9f728c3c371\nSanitized\n72f988bf-86f1-41af-91ab-2d7cd011db47\nhttps://login.microsoftonline.com/\nCloud\nBlobEndpoint=https://kasobolcanaryhns.blob.core.windows.net/;QueueEndpoint=https://kasobolcanaryhns.queue.core.windows.net/;FileEndpoint=https://kasobolcanaryhns.file.core.windows.net/;BlobSecondaryEndpoint=https://kasobolcanaryhns-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasobolcanaryhns-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasobolcanaryhns-secondary.file.core.windows.net/;AccountName=kasobolcanaryhns;AccountKey=Sanitized\n" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanMockClientConstructorsAsync.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanMockClientConstructorsAsync.json new file mode 100644 index 0000000000000..e62d82ef43e64 --- /dev/null +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/QueueClientTests/CanMockClientConstructorsAsync.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope", + "Storage_TestConfigHierarchicalNamespace": "NamespaceTenant\nkasobolcanaryhns\nU2FuaXRpemVk\nhttps://kasobolcanaryhns.blob.core.windows.net\nhttps://kasobolcanaryhns.file.core.windows.net\nhttps://kasobolcanaryhns.queue.core.windows.net\nhttps://kasobolcanaryhns.table.core.windows.net\n\n\n\n\nhttps://kasobolcanaryhns-secondary.blob.core.windows.net\nhttps://kasobolcanaryhns-secondary.file.core.windows.net\nhttps://kasobolcanaryhns-secondary.queue.core.windows.net\nhttps://kasobolcanaryhns-secondary.table.core.windows.net\nc6b5fe1a-9b59-4975-92c4-d9f728c3c371\nSanitized\n72f988bf-86f1-41af-91ab-2d7cd011db47\nhttps://login.microsoftonline.com/\nCloud\nBlobEndpoint=https://kasobolcanaryhns.blob.core.windows.net/;QueueEndpoint=https://kasobolcanaryhns.queue.core.windows.net/;FileEndpoint=https://kasobolcanaryhns.file.core.windows.net/;BlobSecondaryEndpoint=https://kasobolcanaryhns-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasobolcanaryhns-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasobolcanaryhns-secondary.file.core.windows.net/;AccountName=kasobolcanaryhns;AccountKey=Sanitized\n" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/ServiceClientTests/CanMockClientConstructors.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/ServiceClientTests/CanMockClientConstructors.json new file mode 100644 index 0000000000000..e62d82ef43e64 --- /dev/null +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/ServiceClientTests/CanMockClientConstructors.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope", + "Storage_TestConfigHierarchicalNamespace": "NamespaceTenant\nkasobolcanaryhns\nU2FuaXRpemVk\nhttps://kasobolcanaryhns.blob.core.windows.net\nhttps://kasobolcanaryhns.file.core.windows.net\nhttps://kasobolcanaryhns.queue.core.windows.net\nhttps://kasobolcanaryhns.table.core.windows.net\n\n\n\n\nhttps://kasobolcanaryhns-secondary.blob.core.windows.net\nhttps://kasobolcanaryhns-secondary.file.core.windows.net\nhttps://kasobolcanaryhns-secondary.queue.core.windows.net\nhttps://kasobolcanaryhns-secondary.table.core.windows.net\nc6b5fe1a-9b59-4975-92c4-d9f728c3c371\nSanitized\n72f988bf-86f1-41af-91ab-2d7cd011db47\nhttps://login.microsoftonline.com/\nCloud\nBlobEndpoint=https://kasobolcanaryhns.blob.core.windows.net/;QueueEndpoint=https://kasobolcanaryhns.queue.core.windows.net/;FileEndpoint=https://kasobolcanaryhns.file.core.windows.net/;BlobSecondaryEndpoint=https://kasobolcanaryhns-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasobolcanaryhns-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasobolcanaryhns-secondary.file.core.windows.net/;AccountName=kasobolcanaryhns;AccountKey=Sanitized\n" + } +} \ No newline at end of file diff --git a/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/ServiceClientTests/CanMockClientConstructorsAsync.json b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/ServiceClientTests/CanMockClientConstructorsAsync.json new file mode 100644 index 0000000000000..e62d82ef43e64 --- /dev/null +++ b/sdk/storage/Azure.Storage.Queues/tests/SessionRecords/ServiceClientTests/CanMockClientConstructorsAsync.json @@ -0,0 +1,7 @@ +{ + "Entries": [], + "Variables": { + "Storage_TestConfigDefault": "ProductionTenant\nkasoboltest\nU2FuaXRpemVk\nhttps://kasoboltest.blob.core.windows.net\nhttps://kasoboltest.file.core.windows.net\nhttps://kasoboltest.queue.core.windows.net\nhttps://kasoboltest.table.core.windows.net\n\n\n\n\nhttps://kasoboltest-secondary.blob.core.windows.net\nhttps://kasoboltest-secondary.file.core.windows.net\nhttps://kasoboltest-secondary.queue.core.windows.net\nhttps://kasoboltest-secondary.table.core.windows.net\n\nSanitized\n\n\nCloud\nBlobEndpoint=https://kasoboltest.blob.core.windows.net/;QueueEndpoint=https://kasoboltest.queue.core.windows.net/;FileEndpoint=https://kasoboltest.file.core.windows.net/;BlobSecondaryEndpoint=https://kasoboltest-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasoboltest-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasoboltest-secondary.file.core.windows.net/;AccountName=kasoboltest;AccountKey=Kg==;\nencryptionScope", + "Storage_TestConfigHierarchicalNamespace": "NamespaceTenant\nkasobolcanaryhns\nU2FuaXRpemVk\nhttps://kasobolcanaryhns.blob.core.windows.net\nhttps://kasobolcanaryhns.file.core.windows.net\nhttps://kasobolcanaryhns.queue.core.windows.net\nhttps://kasobolcanaryhns.table.core.windows.net\n\n\n\n\nhttps://kasobolcanaryhns-secondary.blob.core.windows.net\nhttps://kasobolcanaryhns-secondary.file.core.windows.net\nhttps://kasobolcanaryhns-secondary.queue.core.windows.net\nhttps://kasobolcanaryhns-secondary.table.core.windows.net\nc6b5fe1a-9b59-4975-92c4-d9f728c3c371\nSanitized\n72f988bf-86f1-41af-91ab-2d7cd011db47\nhttps://login.microsoftonline.com/\nCloud\nBlobEndpoint=https://kasobolcanaryhns.blob.core.windows.net/;QueueEndpoint=https://kasobolcanaryhns.queue.core.windows.net/;FileEndpoint=https://kasobolcanaryhns.file.core.windows.net/;BlobSecondaryEndpoint=https://kasobolcanaryhns-secondary.blob.core.windows.net/;QueueSecondaryEndpoint=https://kasobolcanaryhns-secondary.queue.core.windows.net/;FileSecondaryEndpoint=https://kasobolcanaryhns-secondary.file.core.windows.net/;AccountName=kasobolcanaryhns;AccountKey=Sanitized\n" + } +} \ No newline at end of file diff --git a/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/tests/QueueListenerTests.cs b/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/tests/QueueListenerTests.cs index e8338578cf490..cafd7cda3b8eb 100644 --- a/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/tests/QueueListenerTests.cs +++ b/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/tests/QueueListenerTests.cs @@ -54,7 +54,7 @@ public void OneTimeTearDown() [SetUp] public void SetUp() { - _mockQueue = new Mock(new Uri("https://test.queue.core.windows.net/testqueue"), null); + _mockQueue = new Mock(new Uri("https://test.queue.core.windows.net/testqueue"), new QueueClientOptions()); _mockQueue.Setup(x => x.Name).Returns("testqueue"); _mockTriggerExecutor = new Mock>(MockBehavior.Strict);