/// /// 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.PMaxTest { 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 cmpntEntities) { return new Configs.ParamsProvider.ComponentCfgCtrl(this, null); } /// Test parameters [XmlIgnore] public PMaxTestParams TestParams; public override IParamsProvider GetRuntimeTestParamsProvider() { return TestParams; } public override IParamsProvider CreateTestParamsProvider() { return new PMaxTestParams(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 PMaxTestParams(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 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 } } }