tbf/TBF/Rig/TestMethods/LeakTest/TestMethodCfg.cs

95 lines
2.7 KiB
C#

///
/// Copyright (c) 2022 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using System.Xml.Serialization;
using Common;
using Config.Entities;
using TBF.Rig.Generic;
namespace TBF.Rig.TestMethods.LeakTest
{
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg, IParamsProvider
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestMethodCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities)
{
return new Configs.ParamsProvider.ComponentCfgCtrl(this, null);
}
/// <summary> Test parameters </summary>
[XmlIgnore]
public LeakTestParams TestParams;
public override IParamsProvider GetRuntimeTestParamsProvider() { return TestParams; }
public override IParamsProvider CreateTestParamsProvider() { return new LeakTestParams(true); }
public override IParamsProvider GetUITestParamsProvider(Test test)
{
return (test.Method == Name) ? base.GetUITestParamsProvider(test) : null;
}
/// Private parameterless constructor invoked by all other (public) constructors
TestMethodCfg()
{
TestParams = new LeakTestParams(true);
}
public TestMethodCfg(string name, IComponentFactory factory)
: this()
{
Name = name;
ParentName = string.Empty;
Factory = factory;
InitializeAll();
}
public string ComponentName { get { return Name; } }
public void InitializeAll()
{
}
string[] paramNames = new string[0];
public string ParamName(int i) { return paramNames[i]; }
public int ParamsCount() { return paramNames.Length; }
public ICollection<string> ParamValues(int i)
{
return null;
}
public string ToString(int i)
{
return string.Format("Name={0}", Name);
}
public CfgUpdateFlags UpdateParam(int i, string str)
{
return CfgUpdateFlags.None;
}
public bool ValidateParam(int i, string strValue, out string message)
{
message = "Invalid index";
return false;
}
void CopyContentTo(TestMethodCfg prms)
{
}
public IParamsProvider Clone()
{
TestMethodCfg pars = new TestMethodCfg();
CopyContentTo(pars);
return pars;
}
public bool UpdateEmbeddedDbEntity()
{
return true; /// =OK, do nothing
}
}
}