public List <TestCaseRowMapping> GetTestCaseRowMappings()
        {
            List <TestCaseRowMapping> res = new List <TestCaseRowMapping>();

            int _rowCount = 3;

            while (_excelWorksheet.Cells[_rowCount, 5] != null && _excelWorksheet.Cells[_rowCount, 5].Text != "")
            {
                _rowCount += 1;
            }

            //Console.WriteLine(_rowCount);

            for (int i = 3; i < _rowCount; i++)
            {
                TestCaseRowMapping temp = new TestCaseRowMapping
                {
                    RowNumber    = i,
                    TestCaseName = _excelWorksheet.Cells[i, 5].Text,
                };

                if (_excelWorksheet.Cells[i, 4] != null &&
                    _excelWorksheet.Cells[i, 4].Text != null)
                {
                    if (IsDigitsOnly(_excelWorksheet.Cells[i, 4].Text))
                    {
                        temp.TestSuiteId = Convert.ToInt32(_excelWorksheet.Cells[i, 4].Text);
                        res.Add(temp);
                    }
                }
            }

            return(res);
        }
        public List <TestCaseRowMapping> GetTestCaseIdsFromNames(List <TestCaseRowMapping> testCaseRowMappings)
        {
            List <TestCaseRowMapping> res = new List <TestCaseRowMapping>();

            foreach (TestCaseRowMapping currTestCaseRowMapping in testCaseRowMappings)
            {
                TestCaseRowMapping updatedTestCaseRowMapping = GetTestCaseIdFromName(currTestCaseRowMapping).Result;

                if (updatedTestCaseRowMapping != null)
                {
                    res.Add(updatedTestCaseRowMapping);
                }
            }

            return(res);
        }
        public async Task <TestCaseRowMapping> GetTestCaseIdFromName(TestCaseRowMapping currTestCaseRowMapping)
        {
            TestCaseRowMapping tempTestCaseRowMapping = new TestCaseRowMapping()
            {
                RowNumber    = currTestCaseRowMapping.RowNumber,
                TestCaseName = currTestCaseRowMapping.TestCaseName,
                TestSuiteId  = currTestCaseRowMapping.TestSuiteId
            };

            HttpClientInitiator client    = new HttpClientInitiator("https://localhost:44369/");
            HttpClient          newClient = client.CreateHttpClient();

            newClient.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));

            var requestUri = "/api/TestCase/TestCaseName/" + tempTestCaseRowMapping.TestCaseName;
            var method     = new HttpMethod("GET");
            var request    = new HttpRequestMessage(method, requestUri)
            {
            };
            var response = await newClient.SendAsync(request);

            if (response.IsSuccessStatusCode)
            {
                string responseString = await response.Content.ReadAsStringAsync();

                if (responseString != "")
                {
                    var jo = JObject.Parse(responseString);

                    tempTestCaseRowMapping.TestCaseId = Convert.ToInt32(jo["testCaseId"]);
                }
            }

            //Console.WriteLine(tempTestCaseRowMapping.TestCaseId);

            return(tempTestCaseRowMapping);

            //string stringQuery = "Select[System.Id], [System.Title], [System.State] From WorkItems Where [System.WorkItemType] = 'Test Case' AND [System.Title] = '" + tempTestCaseRowMapping.TestCaseName + "'";

            //List<Object> patchDocument = new List<object>();
            //patchDocument.Add(new
            //{
            //    query = stringQuery
            //});

            //var patchValue = new StringContent(JsonConvert.SerializeObject(patchDocument), Encoding.UTF8, "application/json-patch+json");

            //var requestUri = "APHP/APHP%20Virginia/_api/_wit/search?searchText=" + tempTestCaseRowMapping.TestCaseName;
            //var method = new HttpMethod("GET");
            //var request = new HttpRequestMessage(method, requestUri) { };
            //var response = await _client.SendAsync(request);

            //List<int> listOfTestCasesInSuite = new List<int>();
            //listOfTestCasesInSuite = await GetTestCaseIdsInSuite(tempTestCaseRowMapping.TestSuiteId);

            //Console.WriteLine(listOfTestCasesInSuite);

            //if (response.IsSuccessStatusCode)
            //{
            //    string responseString = await response.Content.ReadAsStringAsync();
            //    var jo = JObject.Parse(responseString);

            //    int countTestCases = jo["payload"]["rows"].Count();

            //    Console.WriteLine(countTestCases);

            //    if (countTestCases > 0)
            //    {
            //        foreach (JToken currWorkItem in jo["payload"]["rows"])
            //        {
            //            if (listOfTestCasesInSuite.Contains(Convert.ToInt32(currWorkItem[0])))
            //            {
            //                tempTestCaseRowMapping.TestCaseId = Convert.ToInt32(currWorkItem[0]);
            //                return tempTestCaseRowMapping;
            //            }
            //        }
            //    }

            //    return null;
            //}
            //else
            //{
            //    throw new Exception();
            //}
        }