Beispiel #1
0
        public static By FormatWith(this By by, params object[] args)
        {
            By formattedBy;

            if (TryResolveByChain(by, out ByChain byChain))
            {
                formattedBy = new ByChain(byChain.Items.Select(x => x.FormatWith(args)));
            }
            else
            {
                string selector = string.Format(by.GetSelector(), args);
                formattedBy = CreateBy(by.GetMethod(), selector);
            }

            return(by is ExtendedBy originalByAsExtended
                ? new ExtendedBy(formattedBy).ApplySettingsFrom(originalByAsExtended)
                : formattedBy);
        }
Beispiel #2
0
 private static bool TryResolveByChain(By by, out ByChain byChain)
 {
     byChain = (by as ByChain) ?? (by as ExtendedBy)?.By as ByChain;
     return(byChain != null);
 }