示例#1
0
    public void Calculate_HasScrollerParentDirectlyAbove_ReturnsIt()
    {
        IUIElement         uie         = Substitute.For <IUIElement>();
        ISomeTestUIElement typedParent = Substitute.For <ISomeTestUIElement>();
        IUIElement         nullParent  = null;

        uie.GetParentUIE().Returns(typedParent);
        typedParent.GetParentUIE().Returns(nullParent);

        IProximateParentTypedUIECalculator <ISomeTestUIElement> calculator = new ProximateParentTypedUIECalculator <ISomeTestUIElement>(uie);

        Assert.That(calculator.Calculate(), Is.SameAs(typedParent));
    }
示例#2
0
    public void Calculate_HasMultipleScrollerParentAbove_ReturnsTheColosest()
    {
        IUIElement         uie = Substitute.For <IUIElement>();
        ISomeTestUIElement closeTypedParent = Substitute.For <ISomeTestUIElement>();
        ISomeTestUIElement farTypedParent   = Substitute.For <ISomeTestUIElement>();
        IUIElement         nullParent       = null;

        uie.GetParentUIE().Returns(closeTypedParent);
        closeTypedParent.GetParentUIE().Returns(farTypedParent);
        farTypedParent.GetParentUIE().Returns(nullParent);

        IProximateParentTypedUIECalculator <ISomeTestUIElement> calculator = new ProximateParentTypedUIECalculator <ISomeTestUIElement>(uie);

        Assert.That(calculator.Calculate(), Is.SameAs(closeTypedParent));
    }