コード例 #1
0
        public mitigationinfo UpdateMitigations(string build_id, string action, string comment, string flaw_id_list)
        {
            action = action.ToLower();
            var acceptedActions = new[] { "comment", "fp", "appdesign", "osenv", "netenv", "rejected", "accepted" };

            if (!acceptedActions.Contains(action))
            {
                throw new ArgumentException("Action must be either \"comment\", \"fp\", \"appdesign\", \"osenv\", \"netenv\", \"rejected\", \"accepted\"");
            }

            if (action.Equals("accepted") || action.Equals("rejected"))
            {
                var currentMitigations = GetMitigationForFlaw(build_id, flaw_id_list);
                var mitigationActions  = new[] { ActionTypeType.appdesign, ActionTypeType.osenv, ActionTypeType.netenv, ActionTypeType.fp };
                if (!mitigationActions.Any(x => x == currentMitigations.First().mitigation_action.First().action))
                {
                    throw new ArgumentException("The latest action on this flaw is not \"appdesign\", \"osenv\", \"netenv\", \"fp\" so there is nothing to accept or reject.");
                }
            }

            var xml = _wrapper.UpdateMitigationInfo(build_id, action, comment, flaw_id_list);

            return(XmlParseHelper.Parse <mitigationinfo>(xml));
        }