当前位置: 首页>>代码示例>>C#>>正文


C# ArgumentNullException.GetType方法代码示例

本文整理汇总了C#中System.ArgumentNullException.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# ArgumentNullException.GetType方法的具体用法?C# ArgumentNullException.GetType怎么用?C# ArgumentNullException.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.ArgumentNullException的用法示例。


在下文中一共展示了ArgumentNullException.GetType方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteTest

 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();
     }
 }
开发者ID:neilmayhew,项目名称:pathway,代码行数:21,代码来源:FeatureSheetTest.cs

示例2: TS_ThrowTextPatternRangeExceptions

        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++;
//.........这里部分代码省略.........
开发者ID:geeksree,项目名称:cSharpGeeks,代码行数:101,代码来源:Text.cs

示例3: TS_ThrowTextPatternExceptions

        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++;
        }
开发者ID:geeksree,项目名称:cSharpGeeks,代码行数:30,代码来源:Text.cs

示例4: Bug1106920

        //-------------------------------------------------------------------
        // 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());
            }
        }
开发者ID:sergeyDyadenchuk,项目名称:Testing,代码行数:33,代码来源:TextTestsHelper.cs

示例5: TestGetAttributeValueMethod50707

        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());
        }
开发者ID:sergeyDyadenchuk,项目名称:Testing,代码行数:8,代码来源:TextTests.cs

示例6: TestMoveEndpointMethodRange51214

        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());
        }
开发者ID:sergeyDyadenchuk,项目名称:Testing,代码行数:10,代码来源:TextTests.cs

示例7: TestFindTextMethod50614

        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());
        }
开发者ID:sergeyDyadenchuk,项目名称:Testing,代码行数:9,代码来源:TextTests.cs

示例8: TestFindAttributeMethod50516

        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());
        }
开发者ID:sergeyDyadenchuk,项目名称:Testing,代码行数:8,代码来源:TextTests.cs

示例9: TestCompareEndpointsMethod50317

        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());
        }
开发者ID:sergeyDyadenchuk,项目名称:Testing,代码行数:9,代码来源:TextTests.cs

示例10: TestCompareMethod50204

        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());
        }
开发者ID:sergeyDyadenchuk,项目名称:Testing,代码行数:8,代码来源:TextTests.cs

示例11: TestRangeFromChildMethod20304

        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());
        }
开发者ID:sergeyDyadenchuk,项目名称:Testing,代码行数:8,代码来源:TextTests.cs


注:本文中的System.ArgumentNullException.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。