public ExampleCapture(string secretsFile, string outputFolder, string outputFolderWorkarounds = null) { this.secrets = ExampleHelpers.ReadSecretsFile(secretsFile); this.outputFolder = outputFolder; this.outputFolderWorkarounds = outputFolderWorkarounds; this.client = ExampleHelpers.GetRealClient(secrets); this.rmClient = ExampleHelpers.GetRealRmClient(secrets); this.authClient = ExampleHelpers.GetAuthorizationClient(secrets); this.interceptor = new ExampleTracingInterceptor(client.SubscriptionId, client.ApiVersion); ServiceClientTracing.AddTracingInterceptor(interceptor); }
public static List <Example> GetMergedExamples(ExampleTracingInterceptor interceptor) { Dictionary <string, Example> merged = new Dictionary <string, Example>(); foreach (long id in interceptor.InvocationIdToExample.Keys.OrderBy(k => k)) { Example exampleNew = interceptor.InvocationIdToExample[id]; if (merged.TryGetValue(exampleNew.Name, out Example exampleExisting)) { if (!TryMerge(exampleExisting, exampleNew)) { exampleNew.Name = id.ToString() + exampleNew.Name; // give a unique name merged.Add(exampleNew.Name, exampleNew); } } else { merged.Add(exampleNew.Name, exampleNew); } } return(merged.Values.ToList()); }