public void ShouldNormalizeAttachmentType() { // Arrange var fbAttachment = new FbAttachment { type = "animated_image", url = "http://test/test.mp4", media = new FbAttachmentMedia { image = new FbAttachmentImage { src = "http://test/123.jpg" } } }; var conveter = new FacebookConverter(); // Act MessageAttachment message = conveter.ConvertToAttachment(fbAttachment); // Assert Assert.Equal(MessageAttachmentType.Video, message.Type); Assert.Equal("video/mp4", message.MimeType); }
public void ShouldConvertToMessageAttachmentForSticker() { // Arrange var fbAttachment = new FbAttachment { type = "sticker", url = "http://test/test.jpg", media = new FbAttachmentMedia { image = new FbAttachmentImage { src = "http://test/123.jpg" } } }; var conveter = new FacebookConverter(); // Act MessageAttachment message = conveter.ConvertToAttachment(fbAttachment); // Assert Assert.Equal(MessageAttachmentType.Image, message.Type); Assert.Equal(fbAttachment.url, message.OriginalLink); Assert.Equal(fbAttachment.media.image.src, message.PreviewUrl); Assert.Equal("image/jpeg", message.MimeType); }
public void ShouldConvertToMessageAttachmentForFile() { // Arrange var fbAttachment = new FbAttachment { type = "xxxaaa", url = "http://test/test.txt", }; var conveter = new FacebookConverter(); // Act MessageAttachment message = conveter.ConvertToAttachment(fbAttachment); // Assert Assert.Equal(MessageAttachmentType.File, message.Type); Assert.Equal(fbAttachment.url, message.OriginalLink); Assert.Equal("text/plain", message.MimeType); }