public void Apply(Operation operation, OperationFilterContext context) { var controllerActionDescriptor = context.ApiDescription.ActionDescriptor as ControllerActionDescriptor; if (controllerActionDescriptor == null) { return; } var commentId = XmlCommentsIdHelper.GetCommentIdForMethod(controllerActionDescriptor.MethodInfo); var methodNode = _xmlNavigator.SelectSingleNode(string.Format(MemberXPath, commentId)); if (methodNode == null) { return; } var summaryNode = methodNode.SelectSingleNode(SummaryTag); if (summaryNode != null) { operation.Summary = summaryNode.ExtractContent(); } var remarksNode = methodNode.SelectSingleNode(RemarksTag); if (remarksNode != null) { operation.Description = remarksNode.ExtractContent(); } ApplyParamComments(operation, methodNode); }
public void GetCommentIdForMethod_ReturnsCorrectXmlCommentId_ForGivenMethodInfo( string actionFixtureName, string expectedCommentId ) { var methodInfo = typeof(FakeActions).GetMethod(actionFixtureName); var commentId = XmlCommentsIdHelper.GetCommentIdForMethod(methodInfo); Assert.Equal(expectedCommentId, commentId); }