public async Task <GetPostQueryResult> ExecuteAsync(GetPostDbResult postData, PostSecurityResult access, AccessSignatureExpiryInformation expiry) { postData.AssertNotNull("postData"); expiry.AssertNotNull("expiry"); var post = await this.ProcessPost(postData.Post, access); var files = new List <GetPostQueryResult.File>(); foreach (var file in postData.Files) { var completeFile = await this.ProcessFile(post, file, access, expiry); files.Add(completeFile); } return(new GetPostQueryResult(post, files)); }
private static void AssertExpectedResult(bool hasLiked, bool isFreePost, GetPostDbResult result) { Assert.AreEqual( new PreviewNewsfeedPost( CreatorId, CreatorUsername, null, null, Introduction, PostId, BlogId, BlogId.ToString(), ChannelId, ChannelId.ToString(), PreviewText, Content, FileId1, PreviewWordCount, WordCount, ImageCount, FileCount, VideoCount, LiveDate, FileName1, FileExtension1, FileSize1, FileWidth1, FileHeight1, 1 + (hasLiked ? 1 : 0), 1, hasLiked, isFreePost, CreationDate), result.Post); Assert.AreEqual(2, result.Files.Count); var file1 = result.Files.Single(v => v.FileId.Equals(FileId1)); var file2 = result.Files.Single(v => v.FileId.Equals(FileId2)); Assert.AreEqual( new GetPostDbResult.PostFileDbResult( FileId1, FileName1, FileExtension1, FilePurpose1, FileSize1, FileWidth1, FileHeight1), file1); Assert.AreEqual( new GetPostDbResult.PostFileDbResult( FileId2, FileName2, FileExtension2, FilePurpose2, FileSize2, FileWidth2, FileHeight2), file2); }