2015-04-15 18:32:56 +00:00
|
|
|
|
///
|
2018-05-10 11:25:46 +00:00
|
|
|
|
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
2015-04-15 18:32:56 +00:00
|
|
|
|
///
|
2017-03-31 16:14:21 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.IO;
|
2022-01-23 18:56:15 +00:00
|
|
|
|
using Common;
|
2017-03-31 16:14:21 +00:00
|
|
|
|
|
2015-12-04 16:17:20 +00:00
|
|
|
|
namespace Config.Entities
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
|
|
|
|
|
public class ComponentTest
|
|
|
|
|
|
{
|
|
|
|
|
|
public virtual int Id { get; protected set; }
|
|
|
|
|
|
public virtual string CmpntName { get; set; } /// Component name
|
|
|
|
|
|
public virtual string Parameters { get; set; }
|
|
|
|
|
|
public virtual Test Test { get; set; }
|
|
|
|
|
|
|
2018-05-10 11:25:46 +00:00
|
|
|
|
IParamsProvider paramsProvider;
|
|
|
|
|
|
///
|
|
|
|
|
|
public virtual IParamsProvider GetParamsProvider() { return paramsProvider; }
|
|
|
|
|
|
public virtual void SetParamsProvider(IParamsProvider paramsProvider) { this.paramsProvider = paramsProvider; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected ComponentTest() { }
|
|
|
|
|
|
|
|
|
|
|
|
public ComponentTest(string name, string parameters, Test test)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.CmpntName = name;
|
|
|
|
|
|
this.Parameters = parameters;
|
|
|
|
|
|
this.Test = test;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
public virtual ComponentTest Clone()
|
|
|
|
|
|
{
|
2018-05-10 11:25:46 +00:00
|
|
|
|
return new ComponentTest(CmpntName, Parameters, Test);
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
2017-03-31 16:14:21 +00:00
|
|
|
|
|
|
|
|
|
|
public virtual void Export(StreamWriter output)
|
|
|
|
|
|
{
|
|
|
|
|
|
output.WriteLine(CmpntName);
|
|
|
|
|
|
output.WriteLine(Parameters.Replace(Environment.NewLine, "~"));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static ComponentTest Import(StreamReader input, Test newTest)
|
|
|
|
|
|
{
|
|
|
|
|
|
string firstLine = input.ReadLine();
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(firstLine)) return null;
|
|
|
|
|
|
|
2018-05-10 11:25:46 +00:00
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
string cmptnName = firstLine;
|
|
|
|
|
|
string parameters = input.ReadLine().Replace("~", Environment.NewLine);
|
|
|
|
|
|
return new ComponentTest(cmptnName, parameters, newTest);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception)
|
|
|
|
|
|
{
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2017-03-31 16:14:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|