Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remake ContentSourceAttribute to behavior #233

YevgeniyShunevych opened this issue Feb 19, 2019 · 0 comments


1 participant
Copy link

commented Feb 19, 2019

ContentSourceAttribute becomes a behavior attribute with possibility to change it with a custom one.

  1. Create abstract ContentGetBehaviorAttribute class - represents the base behavior class for getting the component's content. Has the single method:

    public abstract string Execute<TOwner>(IUIComponent<TOwner> component)
        where TOwner : PageObject<TOwner>;
  2. ContentSourceAttribute to inherit ContentGetBehaviorAttribute and implement Execute method. The logic of ContentSourceAttribute is not changed, so there should not be any compatibility issues.

  3. Add the property to UIComponent<TOwner>:

    public ContentGetBehaviorAttribute ContentGetBehavior { get; }

    This property is used in UIComponent<TOwner>.GetContent method to execute the beahvior.

  4. Make UIComponent<TOwner>.ContentSourceAttribute property obsolete. Use ContentGetBehavior instead.

  5. Mark UIComponent<TOwner> with [ContentSource(ContentSource.Text)] attribute defining the default behavior for content getting.

Thus to create a custom implementation of content getting functionality it is needed to create a class that inherits ContentGetBehaviorAttribute and implements its Execute method. Then mark the components with custom attribute class to apply custom behavior.

@YevgeniyShunevych YevgeniyShunevych added this to the 1.1.0 milestone Feb 19, 2019

@YevgeniyShunevych YevgeniyShunevych self-assigned this Feb 19, 2019

YevgeniyShunevych added a commit that referenced this issue Feb 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.