public ResultDto RevisePost(long id, PostDto postDto) { return(Result(() => { var currentUserName = User.Identity.GetUserName(); var command = new RevisePostCommand { SiteId = postDto.SiteId, ZoneId = postDto.ZoneId, PostId = id, Name = postDto.Name, Title = postDto.Title, MetaTitle = postDto.MetaTitle, MetaDescription = postDto.MetaDescription, PageTemplate = postDto.PageTemplate, IsPrivate = postDto.IsPrivate, IsDiscussionEnabled = postDto.IsDiscussionEnabled, DisableDiscussionDays = postDto.DisableDiscussionDays, IsAnonymousCommentAllowed = postDto.IsAnonymousCommentAllowed, IsRatingEnabled = postDto.IsRatingEnabled, UserName = currentUserName, TagsCommaSeparated = postDto.TagsCommaSeparated, ContentSummary = postDto.ConentSummary, Content = postDto.Content, Links = (postDto.Links ?? new List <LinkDto>()).Select(l => new KeyValuePair <string, string>(l.Type, l.Ref)).ToList(), }; CommandDispatcher.Send(command); })); }
public async Task WhenPuttingPost_ItShouldIssuePostFileCommand() { var data = new RevisedPostData(FileId, null, null, 0, 0, 0, 0, 0, null); var command = new RevisePostCommand(Requester, PostId, FileId, null, null, 0, 0, 0, 0, 0, new List <FileId>()); this.requesterContext.Setup(_ => _.GetRequesterAsync()).ReturnsAsync(Requester); this.guidCreator.Setup(_ => _.CreateSqlSequential()).Returns(PostId.Value); this.revisePost.Setup(v => v.HandleAsync(command)).Returns(Task.FromResult(0)).Verifiable(); await this.target.PutPost(PostId.Value.EncodeGuid(), data); this.postToChannel.Verify(); }