Exemple #1
0
        private static TestResult ValidateReportTextNotBlank(VerificationStep step)
        {
            // none of this applies unless we're transitioning into the completed state
            if (step.State != ActivityStatus.CM)
            {
                return(new TestResult(true));
            }

            // check for a non-empty ReportContent property
            string content;

            if (!step.ReportPart.ExtendedProperties.TryGetValue("ReportContent", out content) || string.IsNullOrEmpty(content))
            {
                return(new TestResult(false, SR.MessageValidateVerifiedReportIsNotBlank));
            }

            // attempt to parse reportContent property as XML, to check for content
            try
            {
                var report = XDocument.Parse(content).Elements("Report").FirstOrDefault();
                if (report == null || string.IsNullOrEmpty(report.Value))
                {
                    return(new TestResult(false, SR.MessageValidateVerifiedReportIsNotBlank));
                }
            }
            catch (Exception)
            {
                // if we can't parse it, there isn't much we can do but assume it is valid
            }
            return(new TestResult(true));
        }
Exemple #2
0
		private static TestResult ValidateReportTextNotBlank(VerificationStep step)
    	{
			// none of this applies unless we're transitioning into the completed state
			if (step.State != ActivityStatus.CM)
				return new TestResult(true);

			// check for a non-empty ReportContent property
    		string content;
    		if(!step.ReportPart.ExtendedProperties.TryGetValue("ReportContent", out content) || string.IsNullOrEmpty(content))
				return new TestResult(false, SR.MessageValidateVerifiedReportIsNotBlank);

			// attempt to parse reportContent property as XML, to check for content
			try
			{
				var report = XDocument.Parse(content).Elements("Report").FirstOrDefault();
				if (report == null || string.IsNullOrEmpty(report.Value))
					return new TestResult(false, SR.MessageValidateVerifiedReportIsNotBlank);
			}
			catch(Exception)
			{
				// if we can't parse it, there isn't much we can do but assume it is valid
			}
			return new TestResult(true);
		}