/// <summary> /// Executes aggregate assertion for the component of the current page object using <see cref="AtataContext.AggregateAssert(Action, string)" /> method. /// </summary> /// <typeparam name="TComponent">The type of the component.</typeparam> /// <param name="componentSelector">The component selector.</param> /// <param name="action">The action to execute in scope of aggregate assertion.</param> /// <returns>The instance of this page object.</returns> public TOwner AggregateAssert <TComponent>(Func <TOwner, TComponent> componentSelector, Action <TComponent> action) { componentSelector.CheckNotNull(nameof(componentSelector)); action.CheckNotNull(nameof(action)); TComponent component = componentSelector((TOwner)this); string componentName = UIComponentResolver.ResolveComponentFullName <TOwner>(component) ?? ComponentFullName; AtataContext.Current.AggregateAssert(() => action(component), componentName); return((TOwner)this); }
/// <summary> /// Executes aggregate assertion for the component of the current page object using <see cref="AtataContext.AggregateAssert(Action, string)" /> method. /// </summary> /// <typeparam name="TComponent">The type of the component.</typeparam> /// <param name="componentSelector">The component selector.</param> /// <param name="action">The action to execute in scope of aggregate assertion.</param> /// /// <param name="assertionScopeName"> /// Name of the scope being asserted. /// Is used to identify the assertion section in log. /// If it is <see langword="null"/>, component full name is used instead. /// </param> /// <returns>The instance of this page object.</returns> public TOwner AggregateAssert <TComponent>(Func <TOwner, TComponent> componentSelector, Action <TComponent> action, string assertionScopeName = null) { componentSelector.CheckNotNull(nameof(componentSelector)); action.CheckNotNull(nameof(action)); TComponent component = componentSelector((TOwner)this); assertionScopeName = assertionScopeName ?? UIComponentResolver.ResolveComponentFullName <TOwner>(component) ?? ComponentFullName; Context.AggregateAssert(() => action(component), assertionScopeName); return((TOwner)this); }