Exemplo n.º 1
0
        /// <summary>
        /// Merges the specified other.
        /// </summary>
        /// <param name="source"> </param>
        /// <param name="target"> </param>
        public void Merge(TestResult source, TestResult target)
        {
            var mergedType = GetType(target);
            var otherType = GetType(source);

            if (mergedType == TestType.Project && otherType == TestType.Project)
            {
                if (string.IsNullOrEmpty(target.FullName) && !string.IsNullOrEmpty(source.FullName))
                {
                    target.Test.TestName.FullName = source.FullName;
                    target.Test.TestName.Name = source.Name;
                }
            }

            if (mergedType != otherType)
                throw new NotSupportedException("Only merging of results with same test type are supported");

            if (!target.IsSuccess && source.IsSuccess)
            {
                target.Success(source.Message);
                target.SetAgentName(source.GetAgentName());
            }

            MergeChildren(source, target);
        }