public async Task GetReturnValueAsync_returns_null_for_property_on_PageObject_marked_with_XPathAttribute_when_Page_is_null() { var pageObject = new FakePageObject(); var methodInfo = pageObject.GetType().GetProperty(nameof(FakePageObject.XPathForElementHandleArray)).GetMethod; var invocation = new FakeInvocation(methodInfo); var result = await invocation.GetReturnValueAsync(pageObject, new XPathAttribute("//div")); Assert.Null(result); }
protected override async Task SetUp() { await Page.SetContentAsync(Fake.Html); _subject = new XPathInterceptor(); _pageObject = new FakePageObject(); _pageObject.Initialize(Page, null); _elementObject = new FakeElementObject(); _elementObject.Initialize(Page, await Page.QuerySelectorAsync("html")); }
public async Task GetReturnValue_returns_null_for_property_on_PageObject_marked_with_SelectorAttribute_when_Page_is_null() { var pageObject = new FakePageObject(); var methodInfo = pageObject.GetType().GetProperty(nameof(FakePageObject.SelectorForElementHandle)).GetMethod; var invocation = new FakeInvocation(methodInfo); var result = await invocation.GetReturnValue(pageObject, new SelectorAttribute(".retweets")); Assert.Null(result); }
public async Task GetReturnValueAsync_returns_null_for_property_on_PageObject_marked_with_XPathAttribute_but_wrong_return_type() { var pageObject = new FakePageObject(); pageObject.Initialize(Page, null); var methodInfo = pageObject.GetType().GetProperty(nameof(FakePageObject.XPathForWrongReturnType)).GetMethod; var invocation = new FakeInvocation(methodInfo); var result = await invocation.GetReturnValueAsync(pageObject, new XPathAttribute("//div")); Assert.Null(result); }
public async Task GetReturnValueAsync_returns_ElementObject_array_for_property_on_PageObject_marked_with_XPathAttribute() { var pageObject = new FakePageObject(); pageObject.Initialize(Page, null); var methodInfo = pageObject.GetType().GetProperty(nameof(FakePageObject.XPathForElementObjectArray)).GetMethod; var invocation = new FakeInvocation(methodInfo); var result = await invocation.GetReturnValueAsync(pageObject, new XPathAttribute("//div")); Assert.NotNull(result); Assert.IsAssignableFrom <FakeElementObject[]>(result); }
public async Task GetReturnValueAsync_returns_ElementHandle_array_for_property_on_PageObject_marked_with_SelectorAttribute() { var pageObject = new FakePageObject(); pageObject.Initialize(Page, null); var methodInfo = pageObject.GetType().GetProperty(nameof(FakePageObject.SelectorForElementHandleArray)).GetMethod; var invocation = new FakeInvocation(methodInfo); var result = await invocation.GetReturnValueAsync(pageObject, new SelectorAttribute("div")); Assert.NotNull(result); Assert.IsType <ElementHandle[]>(result); }
public async Task GetReturnValue_returns_ElementObject_for_property_on_PageObject_marked_with_SelectorAttribute() { var pageObject = new FakePageObject(); pageObject.Initialize(Page, null); var methodInfo = pageObject.GetType().GetProperty(nameof(FakePageObject.SelectorForElementObject)).GetMethod; var invocation = new FakeInvocation(methodInfo); var result = await invocation.GetReturnValue(pageObject, new SelectorAttribute(".retweets")); Assert.NotNull(result); Assert.IsAssignableFrom <FakeElementObject>(result); }