From 4ab889b43e420ef4ac591adb9329253404190ee9 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Fri, 19 Feb 2016 10:43:42 +0100 Subject: [PATCH] Publish, Evaluate test parameters of the Flying start mass collection method excluded. --- .../FlyingStartMassCollectionSeq.cs | 2 +- .../FlyingStartMassCollection/TestMethod.cs | 35 +---- .../TestMethodCfg.cs | 12 -- .../FlyingStartMassCollection/TestParams.cs | 120 ------------------ TestBenchFramework/Properties/AssemblyInfo.cs | 4 +- TestBenchFramework/TBF.csproj | 1 - 6 files changed, 6 insertions(+), 168 deletions(-) delete mode 100644 TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/TestParams.cs diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs index 9bb04b7cd..131ee5409 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs @@ -26,7 +26,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection /// Event.OpArgumentError . Target flow is out of range /// Event.Error . . . . . . Unspecified error /// - public IList Execute(Config.Entities.Test test, TestParams testParams) + public IList Execute(Config.Entities.Test test) { Elde.ControlBoardDev cBrd = StateMachine.ControlBoard; diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/TestMethod.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/TestMethod.cs index f9ba46586..6607ee32c 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/TestMethod.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/TestMethod.cs @@ -15,36 +15,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod)); public override string ToString() { return string.Format("TestMethods.FlyingStartMassCollection({0})", Cfg.ToString(1)); } - readonly TestMethodCfg testMethodCfg; - - public bool Evaluate(Test test) - { - TestParams tp = new TestParams(); - foreach (var tstPrms in test.MoreParams) - { - if (tstPrms.CmpntName.Equals(Name)) - { - tp.UpdateTestParams(tstPrms); - return tp.Evaluate; - } - } - return true; - } - - public bool Publish(Test test) - { - TestParams tp = new TestParams(); - foreach (var tstPrms in test.MoreParams) - { - if (tstPrms.CmpntName.Equals(Name)) - { - tp.UpdateTestParams(tstPrms); - return tp.Publish; - } - } - return true; - } - + public bool Evaluate(Test test) { return true; } + public bool Publish(Test test) { return true; } public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; } public TestMethod() @@ -54,13 +26,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection public TestMethod(TestMethodCfg cfg) : base(cfg) { - testMethodCfg = cfg; log.Debug(this.ToString()); } public IList Execute(Test test) { - return (new FlyingStartCollectionMethodSeq()).Execute(test, testMethodCfg.TestParams); + return (new FlyingStartCollectionMethodSeq()).Execute(test); } } } diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/TestMethodCfg.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/TestMethodCfg.cs index 70458585a..647d47061 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/TestMethodCfg.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/TestMethodCfg.cs @@ -15,23 +15,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection public IComponent GetComponent(IList components) { return new TestMethod(this); } public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); } - /// Test parameters - [XmlIgnore] - public TestParams TestParams; - public override IParamsProvider GetTestParams() { return TestParams; } - public override IParamsProvider CreateTestParams(Test test) - { - TestParams testParams = new TestParams(); - testParams.UpdateTestParams(Name, test); - return testParams; - } - /// Private parameterless constructor invoked by all other (public) constructors TestMethodCfg() { Name = "FlyingStartCollection"; ParentName = string.Empty; - TestParams = new TestParams(); } public TestMethodCfg(IComponentFactory factory) diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/TestParams.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/TestParams.cs deleted file mode 100644 index 185a7c073..000000000 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/TestParams.cs +++ /dev/null @@ -1,120 +0,0 @@ -/// -/// Copyright (c) 2015 Sensus Metering Systems -/// Author: Milan Hanajík -/// -using System; -using System.IO; -using System.Xml.Serialization; -using Config.Entities; -using TBF.BenchControl.Generic; -using TBF.Resources; - -namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection -{ - public class TestParams : TestParamsBase, IParamsProvider, ITestParams - { - public bool Evaluate; /// Evaluate this test for passed/failed final result - public bool Publish; /// Publish this test in results (screen, printed, file, DB) - - public override void InitializeAll() - { - Evaluate = true; - Publish = true; - } - - - string[] paramNames = new string[] - { - Strings.Evaluate, - Strings.Publish, - }; - 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 (Evaluate ? Strings.yes : Strings.no); - case 1: return (Publish ? Strings.yes : Strings.no); - default: return string.Empty; - } - } - - public void UpdateParam(int i, string strValue) - { - switch (i) - { - case 0: Evaluate = strValue.Equals(Strings.yes); return; - case 1: Publish = strValue.Equals(Strings.yes); return; - default: return; - } - } - - public bool ValidateParam(int i, string strValue, out string message) - { - message = string.Empty; - - switch (i) - { - case 0: - case 1: - if (strValue.Equals(Strings.yes) || strValue.Equals(Strings.no)) return true; - break; - default: - message = "Invalid index"; - return false; - } - - message = ParamName(i) + " is invalid"; - return false; - } - - void CopyContentTo(TestParams prms) - { - prms.Evaluate = this.Evaluate; - prms.Publish = this.Publish; - } - - public IParamsProvider Clone() - { - TestParams pars = new TestParams(); - CopyContentTo(pars); - return pars; - } - - public override void UpdateTestParams(ComponentTest dbEntity) - { - if (dbEntity == null) return; - try - { - TestParams tmp = (TestParams)(new XmlSerializer(typeof(TestParams))) - .Deserialize(new StringReader(dbEntity.Parameters)); - - testParamsEntity = dbEntity; - componentName = dbEntity.CmpntName; - test = dbEntity.Test; - - tmp.CopyContentTo(this); - } - catch - { - } - } - - /// - /// Parameterless constructor initializes the parameters - /// - public TestParams() - { - InitializeAll(); - } - - public TestParams(ComponentTest testParamsEntity, string componentName, Test test) - { - this.testParamsEntity = testParamsEntity; - this.componentName = componentName; - this.test = test; - } - } -} diff --git a/TestBenchFramework/Properties/AssemblyInfo.cs b/TestBenchFramework/Properties/AssemblyInfo.cs index 17d01727a..bcaf84953 100644 --- a/TestBenchFramework/Properties/AssemblyInfo.cs +++ b/TestBenchFramework/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("2.2.221.1")] -[assembly: AssemblyFileVersion("2.2.221.1")] +[assembly: AssemblyVersion("2.2.222.1")] +[assembly: AssemblyFileVersion("2.2.222.1")] diff --git a/TestBenchFramework/TBF.csproj b/TestBenchFramework/TBF.csproj index 61732e740..97cbc8474 100644 --- a/TestBenchFramework/TBF.csproj +++ b/TestBenchFramework/TBF.csproj @@ -459,7 +459,6 @@ TestMethodCfgCtrl.cs -