97 lines
2.0 KiB
C#
97 lines
2.0 KiB
C#
///
|
|
/// Copyright (c) 2015 Sensus Metering Systems
|
|
/// Author: Milan Hanajík
|
|
///
|
|
using System;
|
|
using System.IO;
|
|
using System.Text;
|
|
using System.Xml.Serialization;
|
|
using TBF.BenchControl.Generic;
|
|
using TBF.Resources;
|
|
|
|
namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
|
{
|
|
public class iPerlCommunicationParams : TestParamsBase, IParamsProvider, ITestParams
|
|
{
|
|
public string Activity; /// Communication activity
|
|
|
|
public override void InitializeAll()
|
|
{
|
|
Activity = "Read Configuration";
|
|
}
|
|
|
|
|
|
string[] paramNames = new string[]
|
|
{
|
|
Strings.Activity,
|
|
};
|
|
public override string ParamName(int i) { return paramNames[i]; }
|
|
public override int ParamsCount() { return paramNames.Length; }
|
|
|
|
public override string ToString(int i)
|
|
{
|
|
switch (i)
|
|
{
|
|
case 0: return Activity;
|
|
default: return string.Empty;
|
|
}
|
|
}
|
|
|
|
public void UpdateParam(int i, string strValue)
|
|
{
|
|
switch (i)
|
|
{
|
|
case 0: Activity = strValue; return;
|
|
default: return;
|
|
}
|
|
}
|
|
|
|
public bool ValidateParam(int i, string strValue, out string message)
|
|
{
|
|
message = string.Empty;
|
|
|
|
switch (i)
|
|
{
|
|
case 0:
|
|
return true;
|
|
default:
|
|
message = "Invalid index";
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public override void UpdateTestParams(Entities.ComponentTest dbEntity)
|
|
{
|
|
if (dbEntity == null) return;
|
|
try
|
|
{
|
|
iPerlCommunicationParams tmp = (iPerlCommunicationParams)(new XmlSerializer(typeof(iPerlCommunicationParams)))
|
|
.Deserialize(new StringReader(dbEntity.Parameters));
|
|
|
|
testParamsEntity = dbEntity;
|
|
componentName = dbEntity.CmpntName;
|
|
test = dbEntity.Test;
|
|
|
|
Activity = tmp.Activity;
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Parameterless constructor initializes the parameters
|
|
/// </summary>
|
|
public iPerlCommunicationParams()
|
|
{
|
|
}
|
|
|
|
public iPerlCommunicationParams(Entities.ComponentTest testParamsEntity, string componentName, Entities.Test test)
|
|
{
|
|
this.testParamsEntity = testParamsEntity;
|
|
this.componentName = componentName;
|
|
this.test = test;
|
|
}
|
|
}
|
|
}
|