예제 #1
0
        // GET: Results/Details/5
        public IActionResult Details(int? id)
        {
            if (id == null)
            {
                return HttpNotFound();
            }

            ResultWithAllStepsAndScreenshotsAndTestRun resultWithAllStepsAndScreenshotsAndTestRun
                = new ResultWithAllStepsAndScreenshotsAndTestRun();
            resultWithAllStepsAndScreenshotsAndTestRun.Result = _context.Result.Single(m => m.ResultID == id);
            if (resultWithAllStepsAndScreenshotsAndTestRun == null)
            {
                return HttpNotFound();
            }

            resultWithAllStepsAndScreenshotsAndTestRun.StoredStepDetailsList = _context.StoredStepDetails.Where
                (t => t.ResultID == id).ToList();
            resultWithAllStepsAndScreenshotsAndTestRun.StoredScreenshotDetailsList = _context.StoredScreenshotDetails
                .Where(t => t.ResultID == id).ToList();

            var TestRunID = resultWithAllStepsAndScreenshotsAndTestRun.Result.TestRunID;
            resultWithAllStepsAndScreenshotsAndTestRun.TestRun = _context.TestRun.Single
                (t => t.TestRunID == TestRunID);
            resultWithAllStepsAndScreenshotsAndTestRun.TestRun.Run = _context.Run.Single(t => t.RunID ==
                resultWithAllStepsAndScreenshotsAndTestRun.TestRun.RunID);
            resultWithAllStepsAndScreenshotsAndTestRun.TestRun.Test = _context.Test.Single(t => t.TestID
                == resultWithAllStepsAndScreenshotsAndTestRun.TestRun.TestID);

            foreach (var item in resultWithAllStepsAndScreenshotsAndTestRun.StoredStepDetailsList)
            {
                var StoredTestExceptionDetailsList = _context.StoredTestExceptionDetails.Where
                    (t => t.StoredStepDetailsID == item.StoredStepDetailsID).ToList();
                if(StoredTestExceptionDetailsList.Any())
                {
                    item.listTestExceptionDetails = StoredTestExceptionDetailsList;
                }
            }

            return View(resultWithAllStepsAndScreenshotsAndTestRun);
        }