diff --git a/libraries/Microsoft.Bot.Builder.Azure.Queues/AssemblyInfo.cs b/libraries/Microsoft.Bot.Builder.Azure.Queues/AssemblyInfo.cs
new file mode 100644
index 0000000000..8634e2460a
--- /dev/null
+++ b/libraries/Microsoft.Bot.Builder.Azure.Queues/AssemblyInfo.cs
@@ -0,0 +1,11 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using System.Runtime.CompilerServices;
+
+// Allows us to access some internal methods from the Microsoft.Bot.Builder.Azure.Tests unit tests so we don't have to use reflection and we get compile checks.
+#if SIGNASSEMBLY
+[assembly: InternalsVisibleTo("Microsoft.Bot.Builder.Azure.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
+#else
+[assembly: InternalsVisibleTo("Microsoft.Bot.Builder.Azure.Tests")]
+#endif
diff --git a/libraries/Microsoft.Bot.Builder.Azure.Queues/AzureQueueStorage.cs b/libraries/Microsoft.Bot.Builder.Azure.Queues/AzureQueueStorage.cs
index d92c22cb78..22b2115784 100644
--- a/libraries/Microsoft.Bot.Builder.Azure.Queues/AzureQueueStorage.cs
+++ b/libraries/Microsoft.Bot.Builder.Azure.Queues/AzureQueueStorage.cs
@@ -52,6 +52,25 @@ public AzureQueueStorage(string queuesStorageConnectionString, string queueName,
_queueClient = new QueueClient(queuesStorageConnectionString, queueName);
}
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The custom implementation of QueueClient.
+ /// If passing in custom JsonSerializerSettings, we
+ /// recommend the following settings:
+ /// jsonSerializer.TypeNameHandling = TypeNameHandling.None.
+ /// jsonSerializer.NullValueHandling = NullValueHandling.Ignore.
+ ///
+ internal AzureQueueStorage(QueueClient queueClient, JsonSerializerSettings jsonSerializerSettings = null)
+ {
+ _queueClient = queueClient;
+ _jsonSettings = jsonSerializerSettings ?? new JsonSerializerSettings
+ {
+ TypeNameHandling = TypeNameHandling.None,
+ NullValueHandling = NullValueHandling.Ignore
+ };
+ }
+
///
/// Queue an Activity to an Azure.Storage.Queues.QueueClient. The visibility timeout specifies how long the message should be invisible
/// to Dequeue and Peek operations. The message content must be a UTF-8 encoded string that is up to 64KB in size.
diff --git a/tests/Microsoft.Bot.Builder.Azure.Tests/AzureQueueStorageTests.cs b/tests/Microsoft.Bot.Builder.Azure.Tests/AzureQueueStorageTests.cs
new file mode 100644
index 0000000000..574102f191
--- /dev/null
+++ b/tests/Microsoft.Bot.Builder.Azure.Tests/AzureQueueStorageTests.cs
@@ -0,0 +1,55 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using Azure;
+using Azure.Storage.Queues;
+using Azure.Storage.Queues.Models;
+using Microsoft.Bot.Builder.Azure.Queues;
+using Microsoft.Bot.Schema;
+using Moq;
+using Xunit;
+
+namespace Microsoft.Bot.Builder.Azure.Tests
+{
+ public class AzureQueueStorageTests
+ {
+ private const string ConnectionString = @"UseDevelopmentStorage=true";
+
+ [Fact]
+ public void ConstructorValidation()
+ {
+ // Should work.
+ _ = new AzureQueueStorage(ConnectionString, "queueName");
+
+ // No ConnectionString. Should throw.
+ Assert.Throws(() => new AzureQueueStorage(null, "queueName"));
+
+ // No QueueName. Should throw.
+ Assert.Throws(() => new AzureQueueStorage(ConnectionString, null));
+ }
+
+ [Fact]
+ public async void QueueActivityAsync()
+ {
+ var client = new Mock();
+ var response = new Mock>();
+
+ var receipt = QueuesModelFactory.SendReceipt("messageId", DateTimeOffset.MinValue, DateTimeOffset.MinValue, "popReceipt", DateTimeOffset.MinValue);
+ response.SetupGet(e => e.Value).Returns(receipt);
+ client.Setup(e => e.CreateIfNotExistsAsync(It.IsAny>(), It.IsAny()));
+ client.Setup(e => e.SendMessageAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()))
+ .ReturnsAsync(response.Object);
+
+ var storage = new AzureQueueStorage(client.Object);
+ var activity = Activity.CreateMessageActivity() as Activity;
+ var result = await storage.QueueActivityAsync(activity, TimeSpan.Zero, TimeSpan.Zero, CancellationToken.None);
+
+ Assert.NotNull(result);
+ client.Verify(e => e.CreateIfNotExistsAsync(It.IsAny>(), It.IsAny()), Times.Once());
+ client.Verify(e => e.SendMessageAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()), Times.Once());
+ }
+ }
+}