Ejemplo n.º 1
0
        /// <summary>
        /// To save the test result into the result file.
        /// </summary>
        /// <param name="result">
        /// The test result entity.
        /// </param>
        /// <exception cref="InvalidOperationException">
        /// </exception>
        private static void Save(TestResult result)
        {
            if (string.IsNullOrEmpty(result.ResultFile))
            {
                throw new InvalidOperationException("Result file path is not set properly.");
            }

            result.Save();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initialize an instance of <see cref="TestResult"/> from test result file name.
        /// </summary>
        /// <param name="fullyQualifiedName">
        /// The fully qualified name of the test result.
        /// </param>
        /// <returns>
        /// The <see cref="TestResult"/> instance.
        /// </returns>
        public static TestResult InitTestResult(string fullyQualifiedName)
        {
            if (string.IsNullOrWhiteSpace(fullyQualifiedName))
            {
                throw new ArgumentException("Test result FQDN cannot be null or empty", "fullyQualifiedName");
            }

            if (Results.ContainsKey(fullyQualifiedName))
            {
                return Results[fullyQualifiedName];
            }

            TestResult testResult = new TestResult(fullyQualifiedName) { FullyQualifiedName = fullyQualifiedName };
            Results.Add(fullyQualifiedName, testResult);
            return testResult;
        }