예제 #1
0
        }   // private static int PerformJSONTransofmration


        /// <summary>
        /// 
        /// </summary>
        /// <param name="penmSelectedTest">
        /// This member of the SelectedTest enumeration identifies the test that
        /// is up for consideration.
        /// </param>
        /// <param name="pastrCmdArgs">
        /// The command line argument list is an array of zero or more strings,
        /// each of which is a command line argument.
        /// </param>
        /// <returns>
        /// The return value is TRUE when <paramref name="penmSelectedTest"/>
        /// is the first, or only, command line argument, or when no command
        /// line arguments were given. Otherwise, a message is displayed on the
        /// console, and the return value is FALSE.
        /// </returns>
        private static bool RunThisTest (
            SelectedTest penmSelectedTest ,
            string [ ] pastrCmdArgs )
        {
            if ( pastrCmdArgs.Length == ArrayInfo.ARRAY_IS_EMPTY )
            {
                return true;
            }   // TRUE (No arguments were given on the command line, the degenerate case.) block, if ( pastrCmdArgs.Length == ArrayInfo.ARRAY_IS_EMPTY )
            else
            {
                try
                {
                    SelectedTest selected = pastrCmdArgs [ ArrayInfo.ARRAY_FIRST_ELEMENT ].EnumFromString<SelectedTest> ( );
                    return penmSelectedTest == selected;
                }
                catch ( InvalidOperationException )
                {
                    string strMsgTpl = Properties.Resources.ERRMSG_CMDARG_IS_INVALID;
                    WizardWrx.ConsoleStreams.ErrorMessagesInColor.RGBWriteLine (
                        s_smThisApp.BaseStateManager.AppExceptionLogger.ErrorMessageColors.MessageForegroundColor ,
                        s_smThisApp.BaseStateManager.AppExceptionLogger.ErrorMessageColors.MessageBackgroundColor ,
                        strMsgTpl ,
                        pastrCmdArgs [ ArrayInfo.ARRAY_FIRST_ELEMENT ].QuoteString ( ) );
                    throw new InvalidOperationException ( strMsgTpl );
                }
                catch ( Exception exAllOthers )
                {
                    throw exAllOthers;
                }
            }   // FALSE (At least one argument was given on the command line.) block, if ( pastrCmdArgs.Length == ArrayInfo.ARRAY_IS_EMPTY )
        }   // private static bool RunThisTest
예제 #2
0
 private bool CanGoToTest(Window dummyWindow)
 {
     if (SelectedTest != null)
     {
         if (SelectedTest is Model.Test)
         {
             if (SelectedTest.getQuestionsAmount() > 0)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
예제 #3
0
        private /*IDrawable*/ Port GetTestInput()
        {
            var p = new Port(new VisualSettings("A", color: "Green", transformer: new TranslateTransformer(10, 20)));

            IDrawable input, output;

            try
            {
                if (SelectedInputMode == InputCreationMode.AutoGeneration)
                {
                    input = SelectedTest.MetaData.MakeInput(null, _currentTestNumber);
                }
                else if (SelectedInputMode == InputCreationMode.FromFile)
                {
                    string filename = FileNames[_currentTestNumber - 1];
                    input = SelectedTest.MetaData.FileReader(filename);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                throw new Exception("There was an error during input creation", e);
            }

            input.PopulatePort(p, "Input."); p.Update();
            try
            {
                output = SelectedTest.RunMethod(input);
                output.PopulatePort(p, "Output."); p.Update();
            }
            catch (Exception e)
            {
                //throw new Exception("There was an error during alogorithm invocation", e);
                p["Error"].Populate(
                    DrawableElement.Text(20, 20, "There was an error during alogorithm invocation\n",
                                         "Error messaage was:", "\t" + e.Message,
                                         "\nStackTrace was:", "\t" + e.StackTrace)
                    );
            }

            return(p);
        }
예제 #4
0
 private void UpdateQuestionAmount()
 {
     SelectedTestQuestionAmount = SelectedTest.getQuestionsAmount();
     QuestionRepetitionAtOnce   = SelectedTestQuestionAmount;
 }