using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
using System.Xml.Serialization;
using QC.QsprTestObjects.Parameters;
using QC.QsprTestObjects.Tests.Base;
using QC.QTMInterface.Business_Objects;

namespace QC.QsprTestObjects.Tests.TestCase;

[Serializable]
public class TestCaseTest : FolderTest, ISerializable
{
	public const string TESTCASE = "TestCase";

	private TestCaseTestProperties testCaseTestProperties = new TestCaseTestProperties();

	private List<BaseTest> testSteps = new List<BaseTest>();

	public TestCaseMaster TestCaseMasterData { get; set; }

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

	[XmlIgnore]
	public override TestProperties Properties
	{
		get
		{
			testCaseTestProperties.Owner = this;
			return testCaseTestProperties;
		}
		set
		{
			testCaseTestProperties = (TestCaseTestProperties)value;
			testCaseTestProperties.Owner = this;
		}
	}

	public TestCaseTestProperties TestCaseProperties
	{
		get
		{
			return testCaseTestProperties;
		}
		set
		{
			testCaseTestProperties = value;
		}
	}

	public TestCaseTest()
	{
	}

	public TestCaseTest(string name)
		: base(name)
	{
	}

	public override BaseTest Clone()
	{
		TestCaseTest testCaseTest = new TestCaseTest();
		testCaseTest.Properties = Properties.Clone();
		Copy(testCaseTest);
		return testCaseTest;
	}

	protected void GetSelectedParameter(ParameterCollection oldParams, ref object objParameters)
	{
		try
		{
			object[] array = (object[])objParameters;
			ParameterCollection parameterCollection = new ParameterCollection(array[0]);
			ParameterCollection parameterCollection2 = new ParameterCollection(array[1]);
			ParameterCollection parameterCollection3 = new ParameterCollection(array[2]);
			ParameterCollection parameterCollection4 = new ParameterCollection();
			foreach (ParameterCls item in parameterCollection2)
			{
				if (oldParams.HasParameter(item.Name))
				{
					ParameterCls parameter = oldParams.GetParameter(item.Name);
					item.Selected = parameter.Selected;
					parameterCollection4.Add(item);
				}
				else if (item.Selected)
				{
					parameterCollection4.Add(item);
				}
			}
			foreach (ParameterCls item2 in parameterCollection3)
			{
				if (oldParams.HasParameter(item2.Name))
				{
					item2.Selected = true;
					parameterCollection4.Add(item2);
				}
			}
			parameterCollection4 = parameterCollection4.Sort();
			foreach (ParameterCls item3 in parameterCollection4)
			{
				parameterCollection.Add(item3);
			}
			objParameters = parameterCollection.GetParameterObjectInputFormat();
		}
		catch
		{
		}
	}
}
