Ejemplo n.º 1
0
        public void UsingCustomFindsByAttribute()
        {
            mockDriver.Setup(_ => _.FindElement(It.Is <By>(x => x.Equals(new CustomBy("customCriteria"))))).Returns(mockElement.Object);
            mockElement.Setup(_ => _.TagName).Returns("form");

            var page = new CustomFindsByAttributePage();

            AssertFindsElement(page, () => page.customFoundElement);
        }
Ejemplo n.º 2
0
        public void ElementExceptionsAreThrownDirectly()
        {
            const string exceptionMessage = "TestException";

            mockDriver.Setup(_ => _.FindElement(It.Is <By>(x => x.Equals(new CustomBy("customCriteria"))))).Returns(mockElement.Object);
            mockElement.Setup(_ => _.TagName).Throws(new Exception(exceptionMessage));

            var page = new CustomFindsByAttributePage();

            PageFactory.InitElements(mockDriver.Object, page);

            Assert.That(() => page.customFoundElement.TagName,
                        Throws.Exception.Message.EqualTo(exceptionMessage));
        }