using System;
using System.ComponentModel;
using System.Xml;

namespace QC.CompareTestTree;

[Serializable]
public class DotNetTestProperties : TestProperties
{
	private string failString = "False";

	private bool createNewInstance;

	[Category("Dot Net Test Settings")]
	[Description("Regular expression string for the test failure.\nThe method's return value is matched with this string.")]
	public string FailString
	{
		get
		{
			return failString;
		}
		set
		{
			failString = value;
		}
	}

	[Description("If TRUE creates new instance of the class before executing the test.")]
	[Category("Dot Net Test Settings")]
	public bool CreateNewInstance
	{
		get
		{
			return createNewInstance;
		}
		set
		{
			createNewInstance = value;
		}
	}

	internal void CompareProperties(string XmlTagName, DotNetTestProperties baseProperties, string overrideAttrib, ref XmlDocument xmlDoc, ref XmlElement theTestNode)
	{
		XmlElement parentNode = xmlDoc.CreateElement(XmlTagName);
		parentNode.SetAttribute("NodeType", "FolderProperty");
		CompareProperties(baseProperties, overrideAttrib, ref xmlDoc, ref parentNode);
		CommonFunctions.RootDoc = xmlDoc;
		CommonFunctions.ParentNode = parentNode;
		CommonFunctions.AddElement("CreateNewInstance", CreateNewInstance, baseProperties.CreateNewInstance, overrideAttrib);
		CommonFunctions.AddElement("FailString", FailString, baseProperties.FailString, overrideAttrib);
		XmlElement rootNode = xmlDoc.CreateElement("Statistics");
		Statistics.DetermineStatics(parentNode, ref xmlDoc, ref rootNode);
		parentNode.AppendChild(rootNode);
		theTestNode.AppendChild(parentNode);
	}
}
