Exemplo n.º 1
0
 public void PayloadToActivityShouldThrowArgumentNullExceptionWithNullPayload()
 {
     Assert.Throws <ArgumentNullException>(() =>
     {
         MessageBirdHelper.PayloadToActivity(null);
     });
 }
Exemplo n.º 2
0
 public void ActivityToMessageBirdShouldThrowArgumentNullExceptionWithEmptyReplyId()
 {
     Assert.Throws <ArgumentNullException>(() =>
     {
         MessageBirdHelper.ActivityToMessageBird(new List <Activity>(), "");
     });
 }
Exemplo n.º 3
0
 public void ActivityToMessageBirdShouldThrowArgumentNullExceptionWithNullActivities()
 {
     Assert.Throws <ArgumentNullException>(() =>
     {
         MessageBirdHelper.ActivityToMessageBird(null, "sampleReplyId");
     });
 }
Exemplo n.º 4
0
        public void ValidateMessageBirdRequestShouldThrowArgumentNullExceptionWithEmptySigningKey()
        {
            var          httpRequest = new Mock <HttpRequest>();
            const string content     = "Some content";

            Assert.Throws <ArgumentNullException>(() =>
            {
                MessageBirdHelper.ValidateMessageBirdRequest(content, httpRequest.Object, "");
            });
        }
Exemplo n.º 5
0
        public void ValidateMessageBirdRequestShouldThrowArgumentNullExceptionWithEmptyContent()
        {
            var          httpRequest = new Mock <HttpRequest>();
            const string signingKey  = "yruy374hgd87shad";

            Assert.Throws <ArgumentNullException>(() =>
            {
                MessageBirdHelper.ValidateMessageBirdRequest("", httpRequest.Object, signingKey);
            });
        }
Exemplo n.º 6
0
 public void PayloadToActivityShouldReturnNullWithPayloadMessageDirectionNotReceived()
 {
     Assert.Null(MessageBirdHelper.PayloadToActivity(
                     new MessageBirdRequestModel
     {
         Message = new Message
         {
             Direction = ConversationMessageDirection.Sent
         }
     }));
 }
Exemplo n.º 7
0
        public void ActivityToMessageBirdShouldReturnMessageBirdResponseModel()
        {
            var activities = new List <Activity>
            {
                new Activity
                {
                    ChannelId = "Channel Id",
                    Text      = "Sample Text"
                }
            };

            const string replyToId = "sampleReplyId";

            Assert.True(MessageBirdHelper.ActivityToMessageBird
                            (activities, replyToId)?.Count == activities.Count);
        }
Exemplo n.º 8
0
        public void PayloadToActivityShouldReturnActivityModel()
        {
            var requestModel = new MessageBirdRequestModel
            {
                Message = new Message
                {
                    Id        = "12345",
                    Direction = ConversationMessageDirection.Received,
                    ChannelId = "MessageBird",
                    From      = "123456789",
                    Content   = new Content
                    {
                        Text = "SampleText"
                    }
                },
                Contact = new Contact
                {
                    DisplayName = "FirstName LastName"
                }
            };

            Assert.NotNull(MessageBirdHelper.PayloadToActivity(requestModel));
        }