/// <summary>
        ///     Opens tab statistic and checks actual channel assignment against user specs
        /// </summary>
        /// <param name="channelNumber">Channel numbers for the channels which should be checked</param>
        /// <param name="assignment">According assignment for every channel which should be checked</param>
        /// <returns>
        ///     true: If actual channel assignments match the user given ones
        ///     false: If an error occurred
        /// </returns>
        public bool Run(int[] channelNumber, string[] assignment)
        {
            if (new RunSelectTab().Run(2) == false)
            {
                // could not open statistic tab
                EH.PCPS.TestAutomation.Common.Tools.Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Could not open Tab Statistic results");
                return(false);
            }

            // Statistic tab is open, check specified channel(s) with according assignment
            bool result = true;
            int  index  = 0;

            foreach (int number in channelNumber)
            {
                // catch assignment array index out of bounds
                if (assignment.Length < (index + 1))
                {
                    result = false;
                    break;
                }

                result &= new StatisticResults().IsChannelAssignmentCorrect(channelNumber[index], assignment[index]);
                index++;
            }

            if (result == false)
            {
                EH.PCPS.TestAutomation.Common.Tools.Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Channel assignments do not match");
                return(false);
            }

            EH.PCPS.TestAutomation.Common.Tools.Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Channel assignments match");
            return(true);
        }
Esempio n. 2
0
 private static void Print(StatisticResults result)
 {
     IDictionary<String, Double> probabilities = result.StateProbabilities();
     System.Console.Clear();
     foreach (var element in probabilities)
     {
         System.Console.WriteLine("{0} {1}\n",element.Key, element.Value);
     }
     System.Console.WriteLine("Emitter blocking probability: {0}", result.EmitterBlockingProbability );
     System.Console.WriteLine("Average container content: {0}", result.AverageContainerContent);
 }