示例#1
0
        /// <summary>
        ///  Get Custom property values from test cases.
        /// </summary>
        /// <param name="testCase">TestCase object extracted from the TestResult</param>
        /// <returns> list of properties</returns>
        public static List <string> GetTicketNumber(ObjectModel.TestCase testCase)
        {
            var           properties   = testCase.GetProperties();
            List <string> ticketNumber = new List <string>();

            foreach (var propertyGroup in properties)
            {
                if (testCase.GetPropertyValue(propertyGroup.Key) is KeyValuePair <String, String>[])
                {
                    KeyValuePair <String, String>[] kvparr = ((IEnumerable)testCase.GetPropertyValue(propertyGroup.Key)).Cast <object>()
                                                             .Select(x => (KeyValuePair <String, String>)x)
                                                             .ToArray();
                    foreach (KeyValuePair <String, String> property in kvparr)
                    {
                        if (property.Key == "TicketNumber")
                        {
                            ticketNumber.Add(property.Value);
                        }
                    }
                }
            }
            if (ticketNumber.Count == 0)
            {
                return(null);
            }
            return(ticketNumber);
        }