using System;
using System.ComponentModel;
using System.Runtime.Serialization;
using System.Xml.Serialization;

namespace QC.CompareTestTree;

[Serializable]
public class RootTest : FolderTest, ISerializable
{
	public const string ROOT = "Root";

	private RootTestProperties rootProperties = new RootTestProperties();

	public RootTestProperties RootProperties
	{
		get
		{
			return rootProperties;
		}
		set
		{
			rootProperties = value;
		}
	}

	[XmlIgnore]
	public override TestProperties Properties
	{
		get
		{
			return rootProperties;
		}
		set
		{
			rootProperties = (RootTestProperties)value;
		}
	}

	[Browsable(false)]
	[XmlAttribute("NodeType")]
	public override string NodeType
	{
		get
		{
			return "Root";
		}
		set
		{
			base.NodeType = value;
		}
	}

	public RootTest()
	{
	}

	public RootTest(string name)
	{
		rootProperties = new RootTestProperties();
		rootProperties.TestName = name;
		rootProperties.StopOnError = StopOnErrorTypes.None;
		Properties = rootProperties;
		base.name = name;
		Properties.RealName = "ROOT";
		index = Guid.NewGuid().ToString();
		Properties.TestIndexCopy = index;
	}

	protected RootTest(SerializationInfo info, StreamingContext context)
	{
		name = info.GetString("Name");
	}

	public void GetObjectData(SerializationInfo info, StreamingContext context)
	{
		info.AddValue("Name", name);
	}
}
