예제 #1
0
        public void PostProcessReturnValue_TargetTypeImplementsWrapperInterfaceAndWebElementReturned_WrappedInstanceCreated()
        {
            var ctx = new PropertySelectionContext
            {
                TargetProperty     = typeof(TestTargetType).GetProperty("Button"),
                RawSelectedElement = new FakeWebElement("abc")
            };

            var returned = _pp.PostProcessReturnValue(ctx.RawSelectedElement, ctx, _cfg);

            Assert.That(returned, Is.InstanceOf <ElementSelectionHandlerTests.MyButton>());
            Assert.That(((ElementSelectionHandlerTests.MyButton)returned).Inner, Is.EqualTo(ctx.RawSelectedElement));
        }
예제 #2
0
        public void PostProcessReturnValue_TargetTypeImplementsWrapperInterfaceAndMultipleWebElementReturned_WrappedInstancesCreated()
        {
            var domElements = new List <IWebElement>
            {
                new FakeWebElement("1"),
                new FakeWebElement("2"),
                new FakeWebElement("3")
            };

            var ctx = new PropertySelectionContext
            {
                TargetProperty     = typeof(TestTargetType).GetProperty("Buttons"),
                RawSelectedElement = domElements
            };

            var returned = _pp.PostProcessReturnValue(ctx.RawSelectedElement, ctx, _cfg);

            Assert.That(returned, Is.InstanceOf <List <ElementSelectionHandlerTests.MyButton> >());
            Assert.That(((List <ElementSelectionHandlerTests.MyButton>)returned)[0].Inner, Is.EqualTo(domElements[0]));
            Assert.That(((List <ElementSelectionHandlerTests.MyButton>)returned)[1].Inner, Is.EqualTo(domElements[1]));
            Assert.That(((List <ElementSelectionHandlerTests.MyButton>)returned)[2].Inner, Is.EqualTo(domElements[2]));
        }