コード例 #1
0
        /// <summary>
        /// This test is entangled with RegExpTest_1_Split_Test_0
        /// Should the Split Logic Break the Grep Logic will break also.
        /// </summary>
        /// <param name="arg">The input to match against using grep</param>
        /// <returns></returns>
        internal MFTestResults RegExpTest_2_Grep_Test_0(ref string[] arg)
        {
            bool testResult = false;

            string[] expectedResults;

            string[] acutalResults;

            Regex regex;
            try
            {
                regex = new Regex("x+");
                expectedResults = new String[] { "xxxx", "xxxx" };
                acutalResults = regex.GetMatches(arg);

                int al = acutalResults.Length;
                int el = expectedResults.Length;

                for (int i = 0; i < el; i++)
                {
                    Log.Comment("Actual[" + i + "] = " + acutalResults[i]);
                    testResult = TestTestsHelper.AssertEquals(ref TestTestsHelper.GrepFailString, ref expectedResults[i], ref acutalResults[i]);
                }
                
                testResult = TestTestsHelper.AssertEquals(ref TestTestsHelper.WrongNumberGrep, ref el, ref el);
            }
            catch(Exception ex)
            {
                Log.Exception("Unexpected Exception", ex);
                testResult = false;
            }
            return (testResult ? MFTestResults.Pass : MFTestResults.Fail);
            
        }