public void Video_ReturnsToFirstImageAfterLastOne() { List <string> videoParts = new List <string>(); videoParts.Add(Convert.ToBase64String(Encoding.UTF8.GetBytes("Video1"))); videoParts.Add(Convert.ToBase64String(Encoding.UTF8.GetBytes("Video2"))); videoParts.Add(Convert.ToBase64String(Encoding.UTF8.GetBytes("Video3"))); videoParts.Add(Convert.ToBase64String(Encoding.UTF8.GetBytes("Video4"))); videoParts.Add(Convert.ToBase64String(Encoding.UTF8.GetBytes("Video5"))); videoParts.Add(Convert.ToBase64String(Encoding.UTF8.GetBytes("Video6"))); AttachmentPreview attachmentPreview = new AttachmentPreview(AttachmentType.Video, videoParts); _viewModel = new AttachmentPreviewViewModel(attachmentPreview); Assert.AreEqual("Video1", Encoding.UTF8.GetString(_viewModel.VideoPreview)); _viewModel.ShowNextVideoImage(); Assert.AreEqual("Video2", Encoding.UTF8.GetString(_viewModel.VideoPreview)); _viewModel.ShowNextVideoImage(); Assert.AreEqual("Video3", Encoding.UTF8.GetString(_viewModel.VideoPreview)); _viewModel.ShowNextVideoImage(); Assert.AreEqual("Video4", Encoding.UTF8.GetString(_viewModel.VideoPreview)); _viewModel.ShowNextVideoImage(); Assert.AreEqual("Video5", Encoding.UTF8.GetString(_viewModel.VideoPreview)); _viewModel.ShowNextVideoImage(); Assert.AreEqual("Video6", Encoding.UTF8.GetString(_viewModel.VideoPreview)); _viewModel.ShowNextVideoImage(); Assert.AreEqual("Video1", Encoding.UTF8.GetString(_viewModel.VideoPreview)); }
public void Image_Sets_IsImage() { List <string> imageParts = new List <string>(); imageParts.Add(Convert.ToBase64String(Encoding.UTF8.GetBytes("image"))); AttachmentPreview attachmentPreview = new AttachmentPreview(AttachmentType.Image, imageParts); _viewModel = new AttachmentPreviewViewModel(attachmentPreview); Assert.IsTrue(_viewModel.IsImage); Assert.IsFalse(_viewModel.IsVideo); }
public void Video_Sets_IsVideo() { List <string> videoParts = new List <string>(); videoParts.Add(Convert.ToBase64String(Encoding.UTF8.GetBytes("Video1"))); videoParts.Add(Convert.ToBase64String(Encoding.UTF8.GetBytes("Video2"))); videoParts.Add(Convert.ToBase64String(Encoding.UTF8.GetBytes("Video3"))); videoParts.Add(Convert.ToBase64String(Encoding.UTF8.GetBytes("Video4"))); videoParts.Add(Convert.ToBase64String(Encoding.UTF8.GetBytes("Video5"))); videoParts.Add(Convert.ToBase64String(Encoding.UTF8.GetBytes("Video6"))); AttachmentPreview attachmentPreview = new AttachmentPreview(AttachmentType.Video, videoParts); _viewModel = new AttachmentPreviewViewModel(attachmentPreview); Assert.IsFalse(_viewModel.IsImage); Assert.IsTrue(_viewModel.IsVideo); }
public async Task LoadingAttachmentPreviews_Loads_AllPreviews() { Attachment attachment = new Attachment(); AttachmentPreview preview = new AttachmentPreview(); Entry entry = new Entry(); entry.Header = "Header"; entry.Body = "Body"; entry.Attachments.Add(attachment); _entryServiceMock.Setup(s => s.LoadAttachmentPreviewAsync(_entryReference, attachment)).Returns(Task.FromResult(preview)).Verifiable(); _viewModel.InitFromEntry(entry); await _viewModel.LoadAttachmentPreviewsAsync(); Assert.AreEqual(1, _viewModel.AttachmentPreviews.Count); Assert.AreEqual(preview, _viewModel.AttachmentPreviews[0]._attachmentPreview); _entryServiceMock.Verify(); }
public AttachmentPreviewViewModel(AttachmentPreview attachmentPreview) { _attachmentPreview = attachmentPreview; InitVideoPreviewBytes(); }