public void BlobMetadata() { var dict = new Dictionary<string, string> {{"metadata1", "value1"}, {"metadata2", "value2"}}; var rfMsg = new ReferenceMessage(); BrokeredMessage msg = rfMsg.CreateMessage(TestStream, "queue", "messageType", CacheType.Storage); TestStream.Position = 0; msg = rfMsg.CreateMessage(TestStream, "queue", "messageType", CacheType.Storage, "filename123.txt"); TestStream.Position = 0; msg = rfMsg.CreateMessage(TestStream, "queue", "messageType", CacheType.Storage, "filename123.txt", dict); msg = rfMsg.CreateMessage(TestString, "queue", "messageType", CacheType.Storage); msg = rfMsg.CreateMessage(TestString, "queue", "messageType", CacheType.Storage, "filename123.txt"); msg = rfMsg.CreateMessage(TestString, "queue", "messageType", CacheType.Storage, "filename123.txt", dict); msg = rfMsg.CreateMessage(TestByteArray, "queue", "messageType", CacheType.Storage); msg = rfMsg.CreateMessage(TestByteArray, "queue", "messageType", CacheType.Storage, "filename123.txt"); msg = rfMsg.CreateMessage(TestByteArray, "queue", "messageType", CacheType.Storage, "filename123.txt", dict); //Check the blobs in storage... }
public void SendAndReceiveBytes() { var rfMsg = new ReferenceMessage(); var myMsg = rfMsg.CreateMessage(TestByteArray, Queue, MessageType, CacheType.Storage); var connectionString = ConfigurationManager.ConnectionStrings["AzureServiceBus"].ConnectionString; var messagingFactory = MessagingFactory.CreateFromConnectionString(connectionString); var sender = messagingFactory.CreateMessageSender("testing"); sender.Send(myMsg); var receiver = messagingFactory.CreateMessageReceiver("testing", ReceiveMode.ReceiveAndDelete); var receivedMsg = receiver.Receive(); var body = rfMsg.RetrieveBodyAsString(receivedMsg); Assert.AreEqual(TestString, body); }
public void TestSaveToStorage() { var rfMsg = new ReferenceMessage(); var myBlob = rfMsg.SaveToStorage(TestStream, "test1" + Guid.NewGuid().ToString()); Assert.IsTrue(myBlob.Exists()); myBlob = rfMsg.SaveToStorage(TestString, "test2" + Guid.NewGuid().ToString()); Assert.IsTrue(myBlob.Exists()); myBlob = rfMsg.SaveToStorage(TestByteArray, "test3" + Guid.NewGuid().ToString()); Assert.IsTrue(myBlob.Exists()); }