public void RunScriptShouldCallRunScriptOnNativeDocument()
		{
            // GIVEN
		    var domContainer = new Mock<DomContainer>().Object;
		    var nativeDocumentMock = new Mock<INativeDocument>();
		    var nativeDocument = nativeDocumentMock.Object;
		    var document = new TestDocument(domContainer, nativeDocument);

            var scriptCode = "alert('hello')";

		    // WHEN
		    document.RunScript(scriptCode);

            // THEN
            nativeDocumentMock.Verify(doc => doc.RunScript(scriptCode, "javascript"));
		}
Example #2
0
        public void Text()
        {
            // GIVEN
            var nativeDocumentMock = new Mock <INativeDocument>();
            var nativeElementMock  = new Mock <INativeElement>();

            nativeElementMock.Expect(x => x.IsElementReferenceStillValid()).Returns(true);
            nativeElementMock.Expect(element => element.GetAttributeValue("innertext")).Returns("Something");
            nativeDocumentMock.Expect(native => native.Body).Returns(nativeElementMock.Object);

            var domContainer = new Mock <DomContainer>().Object;
            var document     = new TestDocument(domContainer, nativeDocumentMock.Object);

            // WHEN
            var text = document.Text;

            // THEN
            Assert.That(text, Is.EqualTo("Something"));
        }
        public void Text()
        {
            // GIVEN
            var nativeDocumentMock = new Mock<INativeDocument>();
            var nativeElementMock = new Mock<INativeElement>();
            nativeElementMock.Expect(x => x.IsElementReferenceStillValid()).Returns(true);
            nativeElementMock.Expect(element => element.GetAttributeValue("innertext")).Returns("Something");
            nativeDocumentMock.Expect(native => native.Body).Returns(nativeElementMock.Object);

            var domContainer = new Mock<DomContainer>().Object;
            var document = new TestDocument(domContainer, nativeDocumentMock.Object);

            // WHEN
            var text = document.Text;

            // THEN
            Assert.That(text, Is.EqualTo("Something"));
        }