예제 #1
0
		public NUnitTestCase (NUnitAssemblyTestSuite rootSuite, NunitTestInfo tinfo, string className) : base (tinfo.Name)
		{
			this.className = className;
			this.pathName = tinfo.PathName;
			this.rootSuite = rootSuite;
			this.TestId = tinfo.TestId;
		}
예제 #2
0
		NunitTestInfo BuildTestInfo (Test test)
		{
			NunitTestInfo ti = new NunitTestInfo ();
			// The name of inherited tests include the base class name as prefix.
			// That prefix has to be removed
			string tname = test.TestName.Name;
			int i = tname.LastIndexOf ('.');
			if (i != -1)
				tname = tname.Substring (i + 1);
			if (test.FixtureType != null) {
				ti.FixtureTypeName = test.FixtureType.Name;
				ti.FixtureTypeNamespace = test.FixtureType.Namespace;
			} else if (test.TestType == "ParameterizedTest") {
				ti.FixtureTypeName = test.Parent.FixtureType.Name;
				ti.FixtureTypeNamespace = test.Parent.FixtureType.Namespace;
			}
			ti.Name = tname;
			ti.TestId = test.TestName.FullName;

			// Trim short name from end of full name to get the path
			string testNameWithDelimiter = "." + tname;
			if (test.TestName.FullName.EndsWith (testNameWithDelimiter)) {
				int pathLength = test.TestName.FullName.Length - testNameWithDelimiter.Length;
				ti.PathName = test.TestName.FullName.Substring(0, pathLength );
			}
			else
				ti.PathName = null;
			
			if (test.Tests != null && test.Tests.Count > 0) {
				ti.Tests = new NunitTestInfo [test.Tests.Count];
				for (int n=0; n<test.Tests.Count; n++)
					ti.Tests [n] = BuildTestInfo ((Test)test.Tests [n]);
			}
			return ti;
		}
예제 #3
0
		public NUnitTestSuite (NUnitAssemblyTestSuite rootSuite, NunitTestInfo tinfo): base (tinfo.Name)
		{
			fullName = !string.IsNullOrEmpty (tinfo.PathName) ? tinfo.PathName + "." + tinfo.Name : tinfo.Name;
			this.testInfo = tinfo;
			this.rootSuite = rootSuite;
			this.TestId = tinfo.TestId;
		}
예제 #4
0
        internal NunitTestInfo BuildTestInfo(Test test)
        {
            NunitTestInfo ti = new NunitTestInfo();
            // The name of inherited tests include the base class name as prefix.
            // That prefix has to be removed
            string tname = test.TestName.Name;

            // Find the last index of the dot character that is not a part of the test parameters
            // Parameterized methods can contain '.' as class name & they don't seem to prefix base class name, so it's safe to skip them
            if (!(test.Parent is ParameterizedMethodSuite))
            {
                int j = tname.IndexOf('(');
                int i = tname.LastIndexOf('.', (j == -1) ? (tname.Length - 1) : j);
                if (i != -1)
                {
                    tname = tname.Substring(i + 1);
                }
            }

            if (test.FixtureType != null)
            {
                ti.FixtureTypeName      = test.FixtureType.Name;
                ti.FixtureTypeNamespace = test.FixtureType.Namespace;
            }
            else if (test.TestType == "ParameterizedTest")
            {
                ti.FixtureTypeName      = test.Parent.FixtureType.Name;
                ti.FixtureTypeNamespace = test.Parent.FixtureType.Namespace;
            }
            ti.Name   = tname;
            ti.TestId = test.TestName.FullName;

            // Trim short name from end of full name to get the path
            string testNameWithDelimiter = "." + tname;

            if (test.TestName.FullName.EndsWith(testNameWithDelimiter))
            {
                int pathLength = test.TestName.FullName.Length - testNameWithDelimiter.Length;
                ti.PathName = test.TestName.FullName.Substring(0, pathLength);
            }
            else
            {
                ti.PathName = null;
            }

            if (test.Tests != null && test.Tests.Count > 0)
            {
                ti.Tests = new NunitTestInfo [test.Tests.Count];
                for (int n = 0; n < test.Tests.Count; n++)
                {
                    ti.Tests [n] = BuildTestInfo((Test)test.Tests [n]);
                }
            }
            ti.IsExplicit = test.RunState == RunState.Explicit;
            return(ti);
        }
			public void SetInfo (string path, NunitTestInfo info)
			{
				if (File.Exists (path)) {
					CachedTestInfo cti = new CachedTestInfo ();
					cti.LastWriteTime = File.GetLastWriteTime (path);
					cti.Info = info;
					table [path] = cti;
					modified = true;
				}
			}
		void FillTests (NunitTestInfo ti)
		{
			if (ti.Tests == null)
				return;
			foreach (NunitTestInfo test in ti.Tests) {
				UnitTest newTest;
				if (test.Tests != null)
					newTest = new NUnitTestSuite (this, test);
				else
					newTest = new NUnitTestCase (this, test, test.PathName);
				newTest.FixtureTypeName = test.FixtureTypeName;
				newTest.FixtureTypeNamespace = test.FixtureTypeNamespace;
				Tests.Add (newTest);

			}
			oldList = new UnitTest [Tests.Count];
			Tests.CopyTo (oldList, 0);
		}
		void FillTests (NunitTestInfo ti)
		{
			if (ti.Tests == null) return;
			foreach (NunitTestInfo test in ti.Tests) {
				if (test.Tests != null)
					Tests.Add (new NUnitTestSuite (this, test));
				else
					Tests.Add (new NUnitTestCase (this, test));
			}
			oldList = new UnitTest [Tests.Count];
			Tests.CopyTo (oldList, 0);
		}
예제 #8
0
		NunitTestInfo BuildTestInfo (Test test)
		{
			NunitTestInfo ti = new NunitTestInfo ();
			// The name of inherited tests include the base class name as prefix.
			// That prefix has to be removed
			string tname = test.TestName.Name;
			// Find the last index of the dot character that is not a part of the test parameters
			int j = tname.IndexOf ('(');
			int i = tname.LastIndexOf ('.', (j == -1) ? 0 : j);
			if (i != -1)
				tname = tname.Substring (i + 1);
			if (test.FixtureType != null) {
				ti.FixtureTypeName = test.FixtureType.Name;
				ti.FixtureTypeNamespace = test.FixtureType.Namespace;
			} else if (test.TestType == "ParameterizedTest") {
				ti.FixtureTypeName = test.Parent.FixtureType.Name;
				ti.FixtureTypeNamespace = test.Parent.FixtureType.Namespace;
			}
			ti.Name = tname;
			ti.TestId = test.TestName.FullName;

			// Trim short name from end of full name to get the path
			string testNameWithDelimiter = "." + tname;
			if (test.TestName.FullName.EndsWith (testNameWithDelimiter)) {
				int pathLength = test.TestName.FullName.Length - testNameWithDelimiter.Length;
				ti.PathName = test.TestName.FullName.Substring(0, pathLength );
			}
			else
				ti.PathName = null;
			
			if (test.Tests != null && test.Tests.Count > 0) {
				ti.Tests = new NunitTestInfo [test.Tests.Count];
				for (int n=0; n<test.Tests.Count; n++)
					ti.Tests [n] = BuildTestInfo ((Test)test.Tests [n]);
			}
			ti.IsExplicit = test.RunState == RunState.Explicit;
			return ti;
		}
예제 #9
0
		NunitTestInfo BuildTestInfo (Test test)
		{
			NunitTestInfo ti = new NunitTestInfo ();
			// The name of inherited tests include the base class name as prefix.
			// That prefix has to be removed
			string tname = test.TestName.Name;
			int i = tname.LastIndexOf ('.');
			if (i != -1)
				tname = tname.Substring (i + 1);
			if (test.FixtureType != null) {
				ti.FixtureTypeName = test.FixtureType.Name;
				ti.FixtureTypeNamespace = test.FixtureType.Namespace;
			} else if (test.TestType == "ParameterizedTest") {
				ti.FixtureTypeName = test.Parent.FixtureType.Name;
				ti.FixtureTypeNamespace = test.Parent.FixtureType.Namespace;
				Console.WriteLine ("---------------------------------");
				Console.WriteLine (test.GetType ());
				Console.WriteLine (tname);
				Console.WriteLine (test.TestName);
				Console.WriteLine (test.Description);
			}
			ti.Name = tname;
			ti.TestId = test.TestName.FullName;

			// Trim short name from end of full name to get the path
			string testNameWithDelimiter = "." + tname;
			if (test.TestName.FullName.EndsWith (testNameWithDelimiter)) {
				int pathLength = test.TestName.FullName.Length - testNameWithDelimiter.Length;
				ti.PathName = test.TestName.FullName.Substring(0, pathLength );
			}
			else
				ti.PathName = null;
			
			if (test.Tests != null && test.Tests.Count > 0) {
				ti.Tests = new NunitTestInfo [test.Tests.Count];
				for (int n=0; n<test.Tests.Count; n++)
					ti.Tests [n] = BuildTestInfo ((Test)test.Tests [n]);
			}
			return ti;
		}
		NunitTestInfo BuildTestInfo (Test test)
		{
			NunitTestInfo ti = new NunitTestInfo ();
			
			// The name of inherited tests include the base class name as prefix.
			// That prefix has to be removed
			string tname = test.TestName.Name;
			int i = tname.LastIndexOf ('.');
			if (i != -1)
				tname = tname.Substring (i + 1);
			
			ti.Name = tname;

			// Trim short name from end of full name to get the path
			string testNameWithDelimiter = "." + tname;
			if (test.TestName.FullName.EndsWith (testNameWithDelimiter)) {
				int pathLength = test.TestName.FullName.Length - testNameWithDelimiter.Length;
				ti.PathName = test.TestName.FullName.Substring(0, pathLength );
			}
			else
				ti.PathName = null;
			
			if (test.Tests != null && test.Tests.Count > 0) {
				ti.Tests = new NunitTestInfo [test.Tests.Count];
				for (int n=0; n<test.Tests.Count; n++)
					ti.Tests [n] = BuildTestInfo ((Test)test.Tests [n]);
			}
			return ti;
		}
		public NUnitTestCase (NUnitAssemblyTestSuite rootSuite, NunitTestInfo tinfo): base (tinfo.Name)
		{
			className = tinfo.PathName;
			this.rootSuite = rootSuite;
		}
		public NUnitTestSuite (NUnitAssemblyTestSuite rootSuite, NunitTestInfo tinfo): base (tinfo.Name)
		{
			fullName = tinfo.PathName != null && tinfo.PathName.Length > 0 ? tinfo.PathName + "." + tinfo.Name : tinfo.Name;
			this.testInfo = tinfo;
			this.rootSuite = rootSuite;
		}