Ejemplo n.º 1
0
        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...
        }
Ejemplo n.º 2
0
        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);
        }