예제 #1
0
        public void LoadTest(string testName)
        {
            try
            {
                events.FireTestLoading(TestFileName);

                testDomain = new TestDomain(stdOutWriter, stdErrWriter);
                Test test = testDomain.Load(TestProject, testName);

                TestSuite suite = test as TestSuite;
                if (suite != null)
                {
                    suite.Sort();
                }

                loadedTest     = test;
                loadedTestName = testName;
                results        = null;
                reloadPending  = false;

                if (ReloadOnChange)
                {
                    InstallWatcher( );
                }

                if (suite != null)
                {
                    events.FireTestLoaded(TestFileName, this.loadedTest);
                }
                else
                {
                    lastException = new ApplicationException(string.Format("Unable to find test {0} in assembly", testName));
                    events.FireTestLoadFailed(TestFileName, lastException);
                }
            }
            catch (FileNotFoundException exception)
            {
                lastException = exception;

                foreach (string assembly in TestProject.ActiveConfig.AbsolutePaths)
                {
                    if (Path.GetFileNameWithoutExtension(assembly) == exception.FileName &&
                        !ProjectPath.SamePathOrUnder(testProject.ActiveConfig.BasePath, assembly))
                    {
                        lastException = new ApplicationException(string.Format("Unable to load {0} because it is not located under the AppBase", exception.FileName), exception);
                        break;
                    }
                }

                events.FireTestLoadFailed(TestFileName, lastException);
            }
            catch (Exception exception)
            {
                lastException = exception;
                events.FireTestLoadFailed(TestFileName, exception);
            }
        }
예제 #2
0
 public string RelativePathTo(string path)
 {
     return(ProjectPath.RelativePath(BasePath, path));
 }