using System;
using System.Collections;
using System.ComponentModel;
using System.Threading;
using System.Xml.Serialization;

namespace QC.QSPRTreeSchemaLibrary;

[Serializable]
public abstract class BaseTest
{
	public const int iPassed = 1;

	public const int iFailed = 0;

	public const int iException = -1;

	public const int iFakeResult = int.MaxValue;

	public const string TEST = "Test";

	protected TestProperties testProperties;

	protected string name;

	protected static Hashtable ListOfTestsRunning = new Hashtable();

	protected string strTestPath;

	protected string index;

	protected string originalIndex;

	protected FolderTest parent;

	public static Mutex mutTest = new Mutex(initiallyOwned: false);

	[XmlIgnore]
	public virtual TestProperties Properties
	{
		get
		{
			return testProperties;
		}
		set
		{
			testProperties = value;
		}
	}

	[XmlAttribute("NodeType")]
	[Browsable(false)]
	public virtual string NodeType
	{
		get
		{
			return "Test";
		}
		set
		{
		}
	}

	public virtual string RealName => name;

	public virtual string Index
	{
		get
		{
			return index;
		}
		set
		{
			index = value;
		}
	}

	public virtual string OriginalIndex
	{
		get
		{
			if (originalIndex == null)
			{
				return index;
			}
			return originalIndex;
		}
		set
		{
			originalIndex = value;
		}
	}

	public BaseTest()
	{
		name = "Test";
		index = Guid.NewGuid().ToString();
	}

	public BaseTest(string name)
	{
		this.name = name;
		index = Guid.NewGuid().ToString();
		Properties.RealName = this.name;
		Properties.TestName = this.name;
		Properties.TestIndexCopy = index;
	}

	public BaseTest(string name, string targetName)
	{
		this.name = name;
		index = Guid.NewGuid().ToString();
		Properties.TestIndexCopy = index;
		Properties.RealName = this.name;
		Properties.TestName = this.name;
		Properties.TargetName = targetName;
	}
}
