Exemple #1
0
        /// <summary>
        /// returns the test result as a serialized and transformed (if configured) string
        /// </summary>
        /// <param name="testResult"></param>
        /// <returns></returns>
        protected string GetPayloadAsString(TestResult testResult)
        {
            ITestResultSerializerFactory serializerFactory = ServiceLocator.Resolve <ITestResultSerializerFactory>();

            if (serializerFactory == null)
            {
                throw new ApplicationException("There is no ITestResultSerializerFactory registered with the ServiceLocator.");
            }
            XmlDocument doc = testResult.ToXml(Name, serializerFactory);

            if (TransformSpec != null)
            {
                return(TransformSpec.Transform(doc, testResult, TransformArgs.MakeArgumentList(testResult, this)));
            }
            else
            {
                return(Utilities.Serialization.XmlDocumentToString(doc));
            }
        }
Exemple #2
0
        /// <summary>
        /// returns the test result as a serialized and transformed (if configured) XmlDocument
        /// </summary>
        /// <param name="testResult"></param>
        /// <returns></returns>
        protected XmlDocument GetPayloadAsXmlDocument(TestResult testResult)
        {
            ITestResultSerializerFactory serializerFactory = ServiceLocator.Resolve <ITestResultSerializerFactory>();

            if (serializerFactory == null)
            {
                throw new ApplicationException("There is no ITestResultSerializerFactory registered with the ServiceLocator.");
            }
            XmlDocument doc = testResult.ToXml(Name, serializerFactory);

            if (TransformSpec == null)
            {
                return(doc);
            }

            doc = new XmlDocument();
            doc.LoadXml(TransformSpec.Transform(doc, testResult, TransformArgs.MakeArgumentList(testResult, this)));
            return(doc);
        }