From f8a2126c908c43b27e5643c6962aa6fd702bce54 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Mon, 6 May 2019 12:14:57 +0200 Subject: [PATCH] TestMethods.Counter added, ver. 2.18.1211 --- TBF/BenchControl/TbfComponents.cs | 1 + .../TestMethods/Counter/CounterSeq.cs | 29 +++++++++++++++ .../TestMethods/Counter/Factory.cs | 30 ++++++++++++++++ .../TestMethods/Counter/TestMethod.cs | 35 +++++++++++++++++++ TBF/Properties/AssemblyInfo.cs | 4 +-- TBF/TBF.csproj | 3 ++ 6 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 TBF/BenchControl/TestMethods/Counter/CounterSeq.cs create mode 100644 TBF/BenchControl/TestMethods/Counter/Factory.cs create mode 100644 TBF/BenchControl/TestMethods/Counter/TestMethod.cs diff --git a/TBF/BenchControl/TbfComponents.cs b/TBF/BenchControl/TbfComponents.cs index 339e385fa..04cb68bb6 100644 --- a/TBF/BenchControl/TbfComponents.cs +++ b/TBF/BenchControl/TbfComponents.cs @@ -52,6 +52,7 @@ namespace TBF.BenchControl Factories.Add(new TestMethods.Adjustment.Factory()); Factories.Add(new TestMethods.ChangeFlowDirection.Factory()); Factories.Add(new TestMethods.CombinedWithDetection.TestMethodFactory()); + Factories.Add(new TestMethods.Counter.Factory()); Factories.Add(new TestMethods.Endurance.Factory()); Factories.Add(new TestMethods.FixedStart.Single.Factory()); Factories.Add(new TestMethods.FixedStart.Compound.Factory()); diff --git a/TBF/BenchControl/TestMethods/Counter/CounterSeq.cs b/TBF/BenchControl/TestMethods/Counter/CounterSeq.cs new file mode 100644 index 000000000..3ce57aa35 --- /dev/null +++ b/TBF/BenchControl/TestMethods/Counter/CounterSeq.cs @@ -0,0 +1,29 @@ +/// +/// Copyright (c) 2019 Sensus Slovensko a.s. +/// +using System; +using System.Collections.Generic; +using log4net; +using Config.Entities; + +namespace TBF.BenchControl.TestMethods.Counter +{ + public class CounterSeq : Sequences.SequenceBase + { + private static readonly ILog log = LogManager.GetLogger(typeof(CounterSeq)); + + /// + /// Counter method sequence + /// + /// Test entity + /// + /// Event.Done . . . . . . . OK + /// + public IList Execute(Test test, int repetitionNr, bool isLastRepetition, DebugMode mode) + { + + + return new List { Event.Done }; + } + } +} diff --git a/TBF/BenchControl/TestMethods/Counter/Factory.cs b/TBF/BenchControl/TestMethods/Counter/Factory.cs new file mode 100644 index 000000000..ce10c5238 --- /dev/null +++ b/TBF/BenchControl/TestMethods/Counter/Factory.cs @@ -0,0 +1,30 @@ +/// +/// Copyright (c) 2019 Sensus Slovensko a.s. +/// +using System.Collections.Generic; +using TBF.BenchControl.Generic; +using TBF.BenchControl.Configs.NameOnly; + +namespace TBF.BenchControl.TestMethods.Counter +{ + public class Factory : IComponentFactory + { + public string ClassName { get { return this.GetType().Namespace.Substring(17); } } + + public void ResetStaticProperties() { TestMethod.ResetStaticProperties(); } + + public IComponent DummyComponent() { return new TestMethod(); } + + public IComponent GetComponent(IComponentCfg cfg, IList components) { return new TestMethod(cfg); } + + public IComponentCfg DefaultConfig() + { + return new TestMethodCfg(this.GetType().Namespace.Substring(29), this); + } + + public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component) + { + return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this); + } + } +} diff --git a/TBF/BenchControl/TestMethods/Counter/TestMethod.cs b/TBF/BenchControl/TestMethods/Counter/TestMethod.cs new file mode 100644 index 000000000..f3690c540 --- /dev/null +++ b/TBF/BenchControl/TestMethods/Counter/TestMethod.cs @@ -0,0 +1,35 @@ +/// +/// Copyright (c) 2019 Sensus Slovensko a.s. +/// +using System; +using System.Collections.Generic; +using log4net; +using Config.Entities; +using TBF.BenchControl; + +namespace TBF.BenchControl.TestMethods.Counter +{ + public class TestMethod : ComponentBase, GenericDevices.ITestMethod + { + private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod)); + public override string ToString() { return string.Format("TestMethods.Counter({0})", Cfg.ToString(1)); } + + public bool CanTest(MetersKind meters) { return true; } + public bool DoTransitions() { return false; } + + public TestMethod() + { + } + + public TestMethod(Generic.IComponentCfg cfg) + : base(cfg) + { + log.Debug(this.ToString()); + } + + public IList Execute(Test test, int repetNr, bool isLastRepetition) + { + return (new CounterSeq()).Execute(test, repetNr, isLastRepetition, DebugLevel); + } + } +} diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs index d161ff523..040827be2 100644 --- a/TBF/Properties/AssemblyInfo.cs +++ b/TBF/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("2.18.1210.0")] -[assembly: AssemblyFileVersion("2.18.1210.0")] +[assembly: AssemblyVersion("2.18.1211.0")] +[assembly: AssemblyFileVersion("2.18.1211.0")] diff --git a/TBF/TBF.csproj b/TBF/TBF.csproj index 6a0d47b1e..c7bd31327 100644 --- a/TBF/TBF.csproj +++ b/TBF/TBF.csproj @@ -1075,6 +1075,9 @@ + + +