Exemplo n.º 1
0
        /// <summary>
        /// The add test case element.
        /// </summary>
        /// <param name="assemblyObjectList">
        /// The assembly object list.
        /// </param>
        /// <param name="methodInfo">
        /// The method info.
        /// </param>
        /// <param name="methodDocumentation">
        /// The method documentation.
        /// </param>
        private void AddTestCaseElement(TestObjectCollection assemblyObjectList, EhMethodInfo methodInfo, MethodTags methodDocumentation)
        {
            Log.Enter(this, string.Format("AddTestCaseElement: {0}", methodInfo.MethodName));

            var parent = assemblyObjectList.FirstOrDefault(n => n.Name == methodInfo.MethodName);

            if (parent == null)
            {
                var testCase = new TestCase();

                testCase.Name = methodInfo.MethodDisplayName;

                var lastNamespaceSegment = GetLastNamespaceSegment(methodInfo.Namespace);
                testCase.DisplayName = string.Format("{0}.{1}.{2}", lastNamespaceSegment, methodInfo.ClassName, methodInfo.MethodName);

                testCase.Description = methodDocumentation.GetDocumentationText();

                testCase.AssemblyMethodRefId = methodInfo.CustomAttributGuid;

                testCase.AssemblyName = Path.GetFileName(methodInfo.AssemblyFullPath);
                testCase.Parameters   = this.GetTestParameterCollection(methodDocumentation);

                assemblyObjectList.Add(testCase);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// The add folder element.
        /// </summary>
        /// <param name="testObjectCollection">
        /// The assembly object list.
        /// </param>
        /// <param name="name">
        /// The name.
        /// </param>
        /// <returns>
        /// The <see cref="TestFolder"/>.
        /// </returns>
        private TestFolder AddFolderElement(TestObjectCollection testObjectCollection, string name)
        {
            Log.Enter(this, string.Format("AddFolderElement: {0}", name));

            var parent = testObjectCollection.FirstOrDefault(n => n.Name == name);

            if (parent == null)
            {
                var testFolder = new TestFolder {
                    Name = name
                };

                testObjectCollection.Add(testFolder);
                return(testFolder);
            }

            return(parent as TestFolder);
        }