Beispiel #1
0
        public void TestMultipleElements()
        {
            var elementOne = new Mock <IWebElement>();

            elementOne.Setup(x => x.GetAttribute(It.IsAny <string>())).Returns("a");
            var elementTwo = new Mock <IWebElement>();

            elementTwo.Setup(x => x.GetAttribute(It.IsAny <string>())).Returns("b");
            var elementThree = new Mock <IWebElement>();

            elementThree.Setup(x => x.GetAttribute(It.IsAny <string>())).Returns("c");
            WebDriver.Setup(x => x.FindElements(It.IsAny <By>()))
            .Returns(new List <IWebElement>
            {
                elementOne.Object,
                elementTwo.Object,
                elementThree.Object
            }.AsReadOnly());

            var list = Actor.AsksFor(ValueAttributeList.For(Locator)).ToList();

            list.Count.Should().Be(3);
            list[0].Should().Be("a");
            list[1].Should().Be("b");
            list[2].Should().Be("c");
        }
Beispiel #2
0
        public void TestSingleElement()
        {
            var element = new Mock <IWebElement>();

            element.Setup(x => x.GetAttribute(It.IsAny <string>())).Returns("a");
            WebDriver.Setup(x => x.FindElements(It.IsAny <By>())).Returns(new List <IWebElement> {
                element.Object
            }.AsReadOnly());

            List <string> list = Actor.AsksFor(ValueAttributeList.For(Locator)).ToList();

            list.Count.Should().Be(1);
            list[0].Should().Be("a");
        }
Beispiel #3
0
        public void TestNoElements()
        {
            SetUpFindElementsReturnsEmpty();

            Actor.Invoking(x => x.AsksFor(ValueAttributeList.For(Locator))).Should().Throw <WaitingException <bool> >();
        }