chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
Hello ,
I am uisng azure queue for message sorage. Now I want to test their wiorking.
Could u please tell me hta how do I mock the queue.AddMessage() & queue.GetMessage() methods for azure queue?

----Code----
1. CloudQueueMessage msg = new CloudQueueMessage("Message");
2. CloudQueue queue = Isolate.Fake.Instance<CloudQueue>(Members.MustSpecifyReturnValues);

3. Isolate.Swap.AllInstances<CloudQueue>().With(queue);
4. Isolate.WhenCalled(() => queue.GetMessage()).WillReturn(msg);
-----------Code---------

In above code , code line 4 is not returning the "msg" object when i run the test.
asked by sudhir (3.5k points)

2 Answers

0 votes
Hello,

could you please tell me what is returned when you call queue.GetMessage()? Do you get a null, or something else?
answered by igal (5.7k points)
0 votes
Hi,
When I call queue.GetMessage(), I get message object but its all values like AsString,AsBytes are null.
answered by sudhir (3.5k points)
...