public TestCaseContext(IDictionary <string, string> options, TestCase testCase, IDisposableLogger logger, IDescriptionWriter descriptionWriter, IItemsHolder itemsHolder) { Options = options; TestCase = testCase; Logger = logger; DescriptionWriter = descriptionWriter; _itemsHolder = itemsHolder; }
public static T GetRequiredItem <T>(this IItemsHolder pipelineContext, string key) where T : class { if (!pipelineContext.TryGetItem <T>(key, out var item)) { Require.Fail($"Could not get required item: {key}"); } return(item); }
public static void ReplaceTokens(this IItemsHolder pipelineContext, JToken doc, IDictionary <string, IReadOnlyCollection <string> > groups) { if (!pipelineContext.TryGetItem("TokenGroups", out IDictionary <string, IDictionary <string, int> > tokenGroups)) { tokenGroups = new Dictionary <string, IDictionary <string, int> >(); pipelineContext.SetItem("TokenGroups", tokenGroups); } Replace(doc, groups, new TokenHolder(tokenGroups)); }
public HighlightSearchItemVm(IItemsHolder <TItem> parent, string color, params Func <TItem, string>[] accessors) { _parent = parent; _fieldsAccessors = accessors.ToList(); Color = (Color)(new ColorConverter().ConvertFrom(color)); var whenAnyHl = this.WhenAnyValue(x => x.Text).Where(x => _parent.IsLoading == false); whenAnyHl.Throttle(TimeSpan.FromMilliseconds(300)).Subscribe(b => OnTextChanged()); }
public static string GetRequiredItem(this IItemsHolder pipelineContext, string key) { var item = pipelineContext.GetRequiredItem <object>(key); return(item switch { null => null, string stringValue => stringValue, JToken jtokenValue => JsonConvert.SerializeObject(jtokenValue), _ => throw new NotSupportedException($"Unsupported item type {item.GetType()} for conversion into string"), });
public static string GetRequiredItem(this IItemsHolder pipelineContext, string key) { var item = pipelineContext.GetRequiredItem <object>(key); switch (item) { case null: return(null); case string stringValue: return(stringValue); case JToken jtokenValue: return(JsonConvert.SerializeObject(jtokenValue)); default: throw new NotSupportedException($"Unsupported item type {item.GetType()} for conversion into string"); } }
public static JToken GetRequiredItemAsJToken(this IItemsHolder pipelineContext, string key) { var item = pipelineContext.GetRequiredItem <object>(key); switch (item) { case null: return(null); case string stringValue: return(JToken.Parse(stringValue)); case JToken jtokenValue: return(jtokenValue); case object obj: return(JObject.FromObject(obj)); default: throw new NotSupportedException($"Unsupported item type {item.GetType()} for conversion into JToken"); } }
public NonUniqueIndex(IItemsHolder <T> holder, Indexer <T, P> indexer) { this.holder = holder; this.indexer = indexer; }
internal Cache(IItemsHolder <T> holder) { this.holder = holder; }
public static T GetItem <T>(this IItemsHolder pipelineContext, string key) where T : class { pipelineContext.TryGetItem <T>(key, out var item); return(item); }
public static T GetRequiredResolvedObject <T>(this IItemsHolder pipelineContext, TestCase testCase, string itemId) { var content = pipelineContext.GetRequiredResolvedContent(testCase, itemId); return(JsonConvert.DeserializeObject <T>(content)); }
public static string GetRequiredResolvedContent(this IItemsHolder pipelineContext, TestCase testCase, string itemId) { var content = testCase.GetRequiredContent(itemId); return(pipelineContext.Resolve(content)); }
public static string Resolve(this IItemsHolder pipelineContext, string value) { return(VariableResolver.Resolve(value, (key) => pipelineContext.GetRequiredItem(key))); }