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


C# Element.WaitUntilExists方法代码示例

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


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

示例1: WaitUntilExistsTimeOutExceptionInnerExceptionNotSetToLastExceptionThrown

        public void WaitUntilExistsTimeOutExceptionInnerExceptionNotSetToLastExceptionThrown()
        {
            var domContainerMock = new Mock<DomContainer>( new object[] { });
            var finderMock = new ElementFinderMock();

            var counter = 0;
            finderMock.FindAllElements = () =>
                                             {
                                                 counter++;
                                                 if (counter == 1) throw new UnauthorizedAccessException("");
                                                 return new List<Element>();
                                             };

            var element1 = new Element(domContainerMock.Object, finderMock);

            Exceptions.TimeoutException timeoutException = null;

            try
            {
                element1.WaitUntilExists(1);
            }
            catch (Exceptions.TimeoutException e)
            {
                timeoutException = e;
            }

            Assert.IsNotNull(timeoutException, "TimeoutException not thrown");
            Assert.IsNull(timeoutException.InnerException, "Unexpected innerexception");

            domContainerMock.VerifyAll();
        }
开发者ID:koshdim,项目名称:KoWatIn,代码行数:31,代码来源:ElementTests.cs

示例2: WaitUntilExistsTimeOutExceptionInnerExceptionSetToLastExceptionThrown

        public void WaitUntilExistsTimeOutExceptionInnerExceptionSetToLastExceptionThrown()
        {
            var domContainerMock = new Mock<DomContainer>(new object[] { });
            var finderMock = new ElementFinderMock();

            var counter = 0;
            finderMock.FindAllElements = () =>
            {
                counter++;
                if (counter == 1) throw new Exception("");
                throw new UnauthorizedAccessException("mockUnauthorizedAccessException");
            };

            element = new Element(domContainerMock.Object, finderMock);

            Exceptions.TimeoutException timeoutException = null;

            try
            {
                element.WaitUntilExists(1);
            }
            catch (Exceptions.TimeoutException e)
            {
                timeoutException = e;
            }

            Assert.IsNotNull(timeoutException, "TimeoutException not thrown");
            Assert.IsInstanceOfType(typeof (UnauthorizedAccessException), timeoutException.InnerException, "Unexpected innerexception");
            Assert.AreEqual("mockUnauthorizedAccessException", timeoutException.InnerException.Message);

            domContainerMock.VerifyAll();
        }
开发者ID:koshdim,项目名称:KoWatIn,代码行数:32,代码来源:ElementTests.cs

示例3: WaitUntilElementExistsTimeOutException

        public void WaitUntilElementExistsTimeOutException()
        {
            // GIVEN
            var elementFinderMock = new ElementFinderMock
                                        {
                                            FindAllElements = (() => new List<Element> {(Element) null})
                                        };

            var element1 = new Element(new Mock<DomContainer>().Object, elementFinderMock);

            // WHEN
            element1.WaitUntilExists(1);

            // THEN exception
        }
开发者ID:koshdim,项目名称:KoWatIn,代码行数:15,代码来源:ElementTests.cs


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