public RestAPIAddCommentReplyResponse AddIdeaCommentReply(RestAPIAddCommentReplyRequest req) { RestAPIAddCommentReplyResponse response = new RestAPIAddCommentReplyResponse(); submitIdeaUtil.InsertCommentReply(response, req.IdeaCommentID, UserID, req.DiscussionDescription); logUtil.InsertIdeaLog(response, req.IdeaCommentID, LogMessages.AddIdeaCommentReply, (int)IdeaLogTypes.Info, Enum.GetName(typeof(IdeaMethodTypes), IdeaMethodTypes.AddIdeaCommentReply), EnumDescriptor.GetEnumDescription(IdeaMethodTypes.AddIdeaCommentReply), UserID); return(response); }
public void AddIdeaCommentReplyTest() { RESTAPIIdeaController apiController = new RESTAPIIdeaController() { DeviceWithDbContext = new RESTAPIDeviceWithDbContext() { DbContext = new IdeaDatabase.DataContext.IdeaDatabaseDataContext() } }; RestAPIAddCommentReplyRequest request = new RestAPIAddCommentReplyRequest() { IdeaCommentID = 1, DiscussionDescription = "test" }; Assert.IsNotNull(apiController.AddIdeaCommentReply(request)); submitIdeaMock.Verify(t => t.InsertCommentReply(It.IsAny <RestAPIAddCommentReplyResponse>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>())); }
public void InsertCommentReplyTest() { RestAPIAddCommentReplyResponse response = new RestAPIAddCommentReplyResponse(); RestAPIAddCommentReplyRequest request = new RestAPIAddCommentReplyRequest() { IdeaCommentID = 1, DiscussionDescription = "test" }; IdeaComment ideaComment = new IdeaComment(); IdeaCommentDiscussion ideaCommentDiscussion = new IdeaCommentDiscussion(); int UserId = 1; int IdeaCommentId = 1; string DiscussionDescription = "test"; queryUtilMock.Setup(x => x.GetIdeaCommentById(It.IsAny <IIdeaDatabaseDataContext>(), It.IsAny <int>())).Returns(ideaComment); queryUtilMock.Setup(x => x.AddIdeaCommentDiscussion(It.IsAny <IIdeaDatabaseDataContext>(), It.IsAny <IdeaCommentDiscussion>())); submitIdeaMock.Setup(x => x.InsertCommentReply(It.IsAny <RestAPIAddCommentReplyResponse>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>())).Returns(ideaCommentDiscussion); submitIdeaUtil.InsertCommentReply(response, IdeaCommentId, UserId, DiscussionDescription); Assert.IsTrue(response.ErrorList.Count == 0); }