Пример #1
0
 public void WriteTest()
 {
     FeatureSheet target = new FeatureSheet(); // TODO: Initialize to an appropriate value
     long expected = 0; // TODO: Initialize to an appropriate value
     long actual;
     CommonTestMethod.DisableDebugAsserts();
     try
     {
         actual = target.Write();
         Assert.Fail("Write succeeded with no sheet name!");
     }
     catch (Exception e)
     {
         ArgumentNullException expectedException = new ArgumentNullException();
         Assert.AreEqual(expectedException.GetType(), e.GetType());
     }
     finally
     {
         CommonTestMethod.EnableDebugAsserts();
     }
 }
Пример #2
0
        private void TS_ThrowTextPatternRangeExceptions()
        {
            int results = 0;
            bool isEqual = false;
            string text = "";
            object nullObject = null;
            TextPattern differentTextPattern = TextTestsHelper.GetDifferentTextPattern(m_le, CheckType.IncorrectElementConfiguration);
            TextPatternRange targetRange = null;

            ArgumentException aeEx = new ArgumentException("<<Fake argument>>");
            ArgumentNullException anEx = new ArgumentNullException("<<Fake null argument>>");
            TextPatternRange callingRange = null;
            ArgumentOutOfRangeException aoreEx = new ArgumentOutOfRangeException();

            //---------
            // Compare
            //---------

            // ArgumentNullException – if the range is null.
            callingRange = _pattern.DocumentRange.Clone();
            _tth.Range_Compare(callingRange, null, ref isEqual, anEx.GetType(), CheckType.Verification);

            // ArgumentException – if range is from another container.
            callingRange = _pattern.DocumentRange.Clone();
            _tth.Range_Compare(callingRange, differentTextPattern.DocumentRange, ref isEqual, aeEx.GetType(), CheckType.Verification);

            //------------------
            // CompareEndPoints
            //------------------

            // ArgumentNullException – if the range is null.
            callingRange = _pattern.DocumentRange.Clone();
            _tth.Range_CompareEndpoints(callingRange, TextPatternRangeEndpoint.Start, null,
                    TextPatternRangeEndpoint.Start, ref results, anEx.GetType(), CheckType.Verification);

            // ArgumentException – if range is from another container.
            callingRange = _pattern.DocumentRange.Clone();
            _tth.Range_CompareEndpoints(callingRange, TextPatternRangeEndpoint.Start, differentTextPattern.DocumentRange,
                    TextPatternRangeEndpoint.Start, ref results, aeEx.GetType(), CheckType.Verification);

            //---------------
            // FindAttribute
            //---------------

            // ArgumentException – if wrong type is specified.
            callingRange = _pattern.DocumentRange.Clone();
            _tth.Range_FindAttribute(callingRange, ref targetRange, TextPattern.AnimationStyleAttribute,
                    results, true, aeEx.GetType(), CheckType.Verification);

            // ArgumentNullException – if attribute value is null.
            callingRange = _pattern.DocumentRange.Clone();
            _tth.Range_FindAttribute(callingRange, ref targetRange, TextPattern.AnimationStyleAttribute,
                    null, true, anEx.GetType(), CheckType.Verification);

            // ArgumentNullException – if attribute is null.
            callingRange = _pattern.DocumentRange.Clone();
            _tth.Range_FindAttribute(callingRange, ref targetRange, null,
                    (object)text, true, anEx.GetType(), CheckType.Verification);

            //----------
            // FindText
            //----------

            // ArgumentNullException – if null is applied for search text argument.
            _tth.Range_FindText( callingRange, ref targetRange, null, true, true, anEx.GetType() , CheckType.Verification );

            // ArgumentException –if empty string is applied for search text argument.
            callingRange = _pattern.DocumentRange.Clone();
            _tth.Range_FindText(callingRange, ref targetRange, "", true, true, aeEx.GetType(), CheckType.Verification);

            //-------------------
            // GetAttributeValue
            //-------------------            

            // ArgumentNullException – if attribute is null.
            callingRange = _pattern.DocumentRange.Clone();
            _tth.Range_GetAttributeValue(callingRange, null, ref nullObject, anEx.GetType(), CheckType.Verification);

            //---------
            // GetText
            //---------

            // Shoduld return ArgumentOutOfRangeException per the spec.
            callingRange = _pattern.DocumentRange.Clone();
            _tth.Range_GetText(callingRange, ref text, Int32.MinValue, aoreEx.GetType(), CheckType.Verification);
            
            //---------------------
            // MoveEndpointByRange
            //---------------------

            // ArgumentNullException – if targetRange is null.
            callingRange = _pattern.DocumentRange.Clone();
            _tth.Range_MoveEndpointByRange(callingRange, TextPatternRangeEndpoint.Start, null,
                    TextPatternRangeEndpoint.Start, anEx.GetType(), CheckType.Verification);

            // ArgumentException – if range is from a different container.
            callingRange = _pattern.DocumentRange.Clone();
            _tth.Range_MoveEndpointByRange(callingRange, TextPatternRangeEndpoint.Start, differentTextPattern.DocumentRange,
                    TextPatternRangeEndpoint.Start, aeEx.GetType(), CheckType.Verification);
            m_TestStep++;
        }
Пример #3
0
        private void TS_ThrowTextPatternExceptions()
        {
            TextPatternRange returnedRange = null;
            Point screenLocation = new Point();
            ArgumentException aeEx = new ArgumentException("<<Fake argument>>");
            ArgumentNullException anEx = new ArgumentNullException("<<Fake null argument>>");

            //----------------
            // RangeFromPoint
            //----------------

            screenLocation.X = Int32.MaxValue;
            screenLocation.Y = Int32.MinValue;

            // ArgumentException – if given point is outside of AutomationElement of the control
            _tth.Pattern_RangeFromPoint(_pattern, ref returnedRange, screenLocation, aeEx.GetType(), CheckType.Verification);

            //----------------
            // RangeFromChild
            //----------------

            // ArgumentNullException – if returnedRange is null 
            _tth.Pattern_RangeFromChild(_pattern, ref returnedRange, null, anEx.GetType(), CheckType.Verification);

            //// InvalidOperationException – if the child could not have come from this container.
            // Bug 1199703: Spec bug: RangeFromChild returns incorrect exception when passed an automation element from another container
            //_tth.Pattern_RangeFromChild(_pattern, ref returnedRange, differentautoElement, ioeEx.GetType(), CheckType.Verification);

            m_TestStep++;
        }
Пример #4
0
        //-------------------------------------------------------------------
        // Regress Bug
        //-------------------------------------------------------------------
        internal void Bug1106920( string bugID, string controls, string bugTitle )
        {
            TextPatternRange range  = null;

            TS_RegressionTest(bugID, controls, bugTitle);

            try
            {
                string actualText = "";
                SetText(SampleText.String1, out actualText, CheckType.IncorrectElementConfiguration);
                range = Pattern_DocumentRange(CheckType.Verification);

                ArgumentException     aeEx  = new ArgumentException();
                ArgumentNullException aneEx = new ArgumentNullException();
                TextPatternRange targetRange = null;

                Range_FindText( range, ref targetRange, null, false, false, aneEx.GetType(), CheckType.IncorrectElementConfiguration );
                
                Range_FindText( range, ref targetRange, "",   false, false, aeEx.GetType(), CheckType.IncorrectElementConfiguration );

                Comment("FindText raised correct exceptions");
            }
            catch (Exception ex)
            {
                if (IsUIVerifyException(ex))  // Don't interfere with legitimate ThrowMe(...)
                    throw;

                ThrowMe(CheckType.Verification, "Unexpected exception encountered:\n" + ex.ToString());
            }
        }
Пример #5
0
        public void TestGetAttributeValueMethod50707(TestCaseAttribute testCase)
        {
            HeaderComment(testCase);

            ArgumentNullException ex = new ArgumentNullException("testCase"); //  Unused, just need an instance for GetType() below

            GetAttributeValueHelper(SampleText.NotEmpty, TargetRangeType.DocumentRange, AttributeType.Null, GetResult.Exception, ex.GetType());
        }
Пример #6
0
        public void TestMoveEndpointMethodRange51214(TestCaseAttribute testCase)
        {
            HeaderComment(testCase);

            ArgumentNullException ex = new ArgumentNullException("testCase"); //  Unused, just need an instance for GetType() below

            MoveEndpointByRangeHelper1(SampleText.Random256, TargetRangeType.DocumentRange, TargetRangeType.Null,
                   MoveEPResults.Exception, MoveEPResults.Exception, MoveEPResults.Exception, MoveEPResults.Exception,
                   ex.GetType());
        }
Пример #7
0
        public void TestFindTextMethod50614(TestCaseAttribute testCase)
        {
            HeaderComment(testCase);

            ArgumentNullException ex = new ArgumentNullException("testCase"); //  Unused, just need an instance for GetType() below

            FindTextHelper(SampleText.Random256, SearchText.Null,
                   FindResults.Exception, FindResults.Exception, FindResults.Exception, FindResults.Exception, ex.GetType());
        }
Пример #8
0
        public void TestFindAttributeMethod50516(TestCaseAttribute testCase)
        {
            HeaderComment(testCase);

            ArgumentNullException ex = new ArgumentNullException("testCase"); //  Unused, just need an instance for GetType() below

            FindAttributeHelper3(SampleText.Random256, ex.GetType());
        }
Пример #9
0
        public void TestCompareEndpointsMethod50317(TestCaseAttribute testCase)
        {
            HeaderComment(testCase);

            ArgumentNullException ex = new ArgumentNullException("testCase"); //  Unused, just need an instance for GetType() below

            CompareEndpointsHelper(SampleText.Empty, TargetRangeType.DocumentRange, TargetRangeType.Null,
                   ValueComparison.Equals, ValueComparison.Equals, ValueComparison.Equals, ValueComparison.Equals, ex.GetType());
        }
Пример #10
0
        public void TestCompareMethod50204(TestCaseAttribute testCase)
        {
            HeaderComment(testCase);

            ArgumentNullException ex = new ArgumentNullException("testCase"); //  Unused, just need an instance for GetType() below

            CompareHelper(SampleText.Random256, TargetRangeType.RandomStart, TargetRangeType.Null, false, ex.GetType());
        }
Пример #11
0
        public void TestRangeFromChildMethod20304(TestCaseAttribute testCase)
        {
            HeaderComment(testCase);

            ArgumentNullException ex = new ArgumentNullException("testCase"); //  Unused, just need an instance for GetType() below

            RangeFromChildHelper(SampleText.String1, false, AutoElementType.Null, ex.GetType());
        }