Exemplo n.º 1
0
        public void Run(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext testContext, TempReader temp)
        {
            _reporter = new Reporter(testContext);
            string dllFullname = DllLoader.GetDllFullNameContainTCInProject(temp.ProjectName, temp.TcFolder);
            Type   t;

            if (DllLoader.HasFoundTypeByTcid(dllFullname, temp.TcID.ToString(), out t))
            {
                DataRow globalData, testData;
                this.LoadData(temp.PID.ToString(), temp.TcID.ToString(), out globalData, out testData);
                Execute(new DataUse(globalData), new DataUse(testData), t, temp.PID.ToString(), temp.TcID.ToString());
            }
            else
            {
                throw new NotImplementedException(string.Format("Test case#{0} in Project {1} does not exist!", temp.TcID, t, temp.PID));
            }
        }
Exemplo n.º 2
0
        public static int[] GetAllTcidInProject(string prjName, string agentFolder)
        {
            string      dllName      = DllLoader.GetDllFullNameContainTCInProject(prjName, agentFolder);
            IList <int> tcIds        = new List <int>(0);
            Assembly    testAssembly = null;

            try
            {
                testAssembly = Assembly.LoadFrom(dllName);
            }
            catch (FileNotFoundException e)
            {
                ConsoleLogger.LogError("{0} not found!", e.FileName);
                throw e;
            }
            catch (BadImageFormatException e)
            {
                ConsoleLogger.LogError("{0}", e.Message);
                throw e;
            }
            catch (Exception e)
            {
                ConsoleLogger.LogError("Exception loading log and assembly: {0}", e);
                throw e;
            }

            Type[] assemblyTypes = testAssembly.GetExportedTypes();
            foreach (Type t in assemblyTypes)
            {
                int tcId;
                if (IsTypeTestCase(t.Name, out tcId) && HasTypeInheritedFromTestBase(t))
                {
                    tcIds.Add(tcId);
                }
            }

            return(tcIds.ToArray <int>());
        }