private void AddPlannedInvocation <TResult>(JsRuntimePlannedInvocation <TResult> planned) { if (!_plannedInvocations.ContainsKey(planned.Identifier)) { _plannedInvocations.Add(planned.Identifier, new List <object>()); } _plannedInvocations[planned.Identifier].Add(planned); }
/// <summary> /// Configure a planned JSInterop invocation with the <paramref name="identifier"/> and arguments /// passing the <paramref name="argumentsMatcher"/> test. /// </summary> /// <typeparam name="TResult">The result type of the invocation</typeparam> /// <param name="identifier">The identifier to setup a response for</param> /// <param name="argumentsMatcher">A matcher that is passed arguments received in invocations to <paramref name="identifier"/>. If it returns true the invocation is matched.</param> /// <returns>A <see cref="TaskCompletionSource{TResult}"/> whose <see cref="Task"/> is returned when the <paramref name="identifier"/> is invoked.</returns> public JsRuntimePlannedInvocation <TResult> Setup <TResult>(string identifier, Func <IReadOnlyList <object>, bool> argumentsMatcher) { var result = new JsRuntimePlannedInvocation <TResult>(identifier, argumentsMatcher); AddPlannedInvocation(result); return(result); }