private void TestSingleFieldTransformer(ITransformer transformer) { double[] inputValues = new double[1]; inputValues[0] = double.MinValue; Console.WriteLine($"{transformer.GetType().Name} Input {inputValues[0]} Output {transformer.Transform(inputValues)}"); for (double input = -5d; input <= 5d; input += 0.1d) { input = Math.Round(input, 1); inputValues[0] = input; Console.WriteLine($"{transformer.GetType().Name} Input {input} Output {transformer.Transform(inputValues)}"); } inputValues[0] = double.MaxValue; Console.WriteLine($"{transformer.GetType().Name} Input {inputValues[0]} Output {transformer.Transform(inputValues)}"); Console.ReadLine(); return; }
public void NoTransformerDefinedTest() { using (ConfigurationContext configurationContext = CreateConfigurationContext(noTransformerXmlString)) { TransformerFactory factory = new TransformerFactory(configurationContext); ITransformer transformer = factory.Create("ApplConfig1"); Assert.AreEqual(typeof(NullTransformer), transformer.GetType()); } }
private void TestTwoFieldsTransformer(ITransformer transformer) { double[] inputValues = new double[2]; inputValues[0] = double.MinValue; inputValues[1] = double.MinValue; Console.WriteLine($"{transformer.GetType().Name} Inputs [{inputValues[0]}, {inputValues[1]}] Output {transformer.Transform(inputValues)}"); for (double input1 = -5d; input1 <= 5d; input1 += 0.5d) { input1 = Math.Round(input1, 1); for (double input2 = -5d; input2 <= 5d; input2 += 0.5d) { input2 = Math.Round(input2, 1); inputValues[0] = input1; inputValues[1] = input2; Console.WriteLine($"{transformer.GetType().Name} Inputs [{inputValues[0]}, {inputValues[1]}] Output {transformer.Transform(inputValues)}"); } } inputValues[0] = double.MaxValue; inputValues[1] = double.MaxValue; Console.WriteLine($"{transformer.GetType().Name} Inputs [{inputValues[0]}, {inputValues[1]}] Output {transformer.Transform(inputValues)}"); Console.ReadLine(); return; }
protected void run(Arguments arg, IExtractor extractor, ITransformer transformer, ILoader loader) { DataTable data = null; Logger.info(extractor.GetType().ToString() + " Extraction Start"); extractor.setArgs(arg); data = extractor.extract(); Logger.info(transformer.GetType().ToString() + " Transformation Start"); transformer.setArgs(arg); data = transformer.transform(data); Logger.info(loader.GetType().ToString() + " Loading Start"); loader.setArgs(arg); loader.load(data); Logger.info(loader.GetType().ToString() + " Loading Complete"); }