public static SvmrResults ProcessFileWithSettings(string filename, ProcessingSettings settings) { // Open file and load JObject from the file var content = File.ReadAllText(filename); var json = JObject.Parse(content); TestDataJsonFormat_0_1.CheckSignature(json); var methodId = TestDataJsonFormat_0_1.GetMethodId(json); if (methodId != SvmrMethodId.MethodId) { throw new NotSupportedException($"Method with id '{methodId}' is not supported!"); } // extract the method-specific json var testDataJson = TestDataJsonFormat_0_1.GetTestData(json); var hrvRawData = TestDataJsonFormat_0_1.GetTestData <SvmrRawData>(json); var dp = new SvmrDataProcessor(); if (settings != null) { dp.Set(settings); } return((SvmrResults)dp.ProcessData(hrvRawData)); }
private void ProcessSvmrData(TestRawData svmrData, out SvmrResults svmrOutData) { var svmrProcessor = new SvmrDataProcessor(); IMethodProcessedData tempSvmrOutData = svmrProcessor.ProcessData(svmrData); svmrOutData = tempSvmrOutData as SvmrResults; if (null == svmrOutData) { throw new ArgumentException( $"SVMR procesor returned object of an unexpected type. Data type: " + $"{tempSvmrOutData.GetType()}, expected: {typeof(SvmrResults)}"); } }
/// <summary> /// /// </summary> /// <param name="testDataFileName"></param> /// <param name="stateMatrixRow"></param> /// <param name="stateMatrixCol"></param> /// <param name="timeout"> /// Если больше нуля то это время в миллисекундах, в течение которого форма отображается на экране. /// Если меньше или равен нулю -- форма отображается на экране, пока не будет закрыта (оператором). /// </param> void Test_Processing_Internal(string testDataFileName, int stateMatrixRow, int stateMatrixCol, int timeout) { var currentlyOpenDataProcessor = new SvmrDataProcessor(); string full_filename = FileHelpers.GetPathFromExecutingAssembly( Path.Combine("unit_test_data", testDataFileName)); var settings = new ProcessingSettings(); SvmrFileProcessingHelper.ProcessFileWithSettings(full_filename, settings); if ((-1 != stateMatrixRow) && (-1 != stateMatrixCol)) { currentlyOpenDataProcessor.UTest_SetStateMatrixState(stateMatrixRow, stateMatrixCol); } }