예제 #1
0
        private void FindFullContext()
        {
            if (Target is ChessResultEntity)
            {
                ChessResult = (ChessResultEntity)Target;

                // NOTE: The old actions would only set the TestRun/TestResult contexts if the result is an error/notification, but not for warnings.
                TestResult = ChessResult.OwningTestResult;
                TestRun    = ChessResult.OwningTestRun;
                Test       = TestRun.OwningTest;
            }
            else if (Target is TestResultEntity)
            {
                TestResult = (TestResultEntity)Target;
                TestRun    = TestResult.OwningTestRun;
                Test       = TestRun.OwningTest;

                // Find children we know about
                // None
            }
            else if (Target is TestRunEntity)
            {
                TestRun = (TestRunEntity)Target;
                Test    = TestRun.OwningTest;

                // Find children we know about
                TestResult = TestRun.Result;
            }
            else if (Target is TestEntity)
            {
                Test = (TestEntity)Target;
            }

            LastXSchedule = TestRun == null ? null : TestRun.GetLastXSchedule();
            MCutTestRun   = TestRun as MCutTestCaseRunEntity;

            // If there's only one bad chess result, then allow the UI to expose it's functionality
            // w/o the user needing to first select the chess result.
            if (ChessResult == null && TestResult != null)
            {
                var chessResults = Views.EntityViewUtil.GetNonInformationalChessResults(TestResult);
                if (chessResults.Count() == 1)
                {
                    ChessResult = chessResults.First();
                }
                ;
            }
        }