/// <summary>
        /// Add Attachments to defect
        /// </summary>
        /// <param name="bug">TDAPIOLELib.Bug Object</param>
        /// <param name="attachmentsPath">List of attachment paths</param>
        /// <returns>True if Successfull</returns>
        public Boolean AddAttachment(TDAPIOLELib.Bug bug, List <String> attachmentsPath)
        {
            TDAPIOLELib.AttachmentFactory OAttachmentFactory;
            TDAPIOLELib.Attachment        OAttachment;

            OAttachmentFactory = bug.Attachments;

            foreach (String AP in attachmentsPath)
            {
                if (System.IO.File.Exists(AP))
                {
                    OAttachment          = OAttachmentFactory.AddItem(System.DBNull.Value);
                    OAttachment.FileName = AP;
                    OAttachment.Type     = Convert.ToInt16(TDAPIOLELib.tagTDAPI_ATTACH_TYPE.TDATT_FILE);
                    OAttachment.Post();
                }
            }

            return(true);
        }
Beispiel #2
0
        /// <summary>
        /// Add a single design step to the test. Added design step will be the last design step.
        /// <para/> returns TDAPIOLELib.DesignStep Object
        /// </summary>
        /// <param name="test">TDAPIOLELib.Test Object</param>
        /// <param name="description">Description of the design step</param>
        /// <param name="expectedResult">Expected result of the design step</param>
        /// <param name="attachmentPath">attachment path of the design step</param>
        /// <returns>TDAPIOLELib.DesignStep Object</returns>
        public TDAPIOLELib.DesignStep AddSingleDeignStep(TDAPIOLELib.Test test, String description, String expectedResult, String attachmentPath = "")
        {
            TDAPIOLELib.DesignStep        ODesignStep;
            TDAPIOLELib.DesignStepFactory ODesignStepFactory;

            ODesignStepFactory = test.DesignStepFactory;

            int StepCounter = ODesignStepFactory.NewList("").Count + 1;

            ODesignStep                    = ODesignStepFactory.AddItem(System.DBNull.Value);
            ODesignStep.StepName           = "Step " + StepCounter;
            ODesignStep.StepDescription    = description;
            ODesignStep.StepExpectedResult = expectedResult;
            ODesignStep.Post();

            if (attachmentPath != "")
            {
                TDAPIOLELib.AttachmentFactory OAttachmentFactory;
                TDAPIOLELib.Attachment        OAttachment;

                OAttachmentFactory = ODesignStep.Attachments;
                if (System.IO.File.Exists(attachmentPath))
                {
                    OAttachment          = OAttachmentFactory.AddItem(System.DBNull.Value);
                    OAttachment.FileName = attachmentPath;
                    OAttachment.Type     = Convert.ToInt16(TDAPIOLELib.tagTDAPI_ATTACH_TYPE.TDATT_FILE);
                    OAttachment.Post();
                }
                else
                {
                    throw (new Exception("File Not Found : " + attachmentPath));
                }
            }

            return(ODesignStep);
        }