protected static object RunInitAndReturnExitCode(InitOptions opts, TelemetryClient telemetryClient) { _TelemetryClient.TrackEvent("InitCommand"); string configFile = opts.ConfigFile; if (string.IsNullOrEmpty(configFile)) { configFile = "configuration.json"; } Log.Information("ConfigFile: {configFile}", configFile); if (File.Exists(configFile)) { Log.Information("Deleting old configuration.json reference file"); File.Delete(configFile); } if (!File.Exists(configFile)) { Log.Information("Populating config with {Options}", opts.Options.ToString()); IEngineConfigurationBuilder cbuilder = new EngineConfigurationBuilder(); EngineConfiguration config; switch (opts.Options) { case OptionsMode.Full: config = cbuilder.BuildDefault(); break; case OptionsMode.WorkItemTracking: config = cbuilder.BuildWorkItemMigration(); break; default: config = cbuilder.BuildDefault(); break; } string json = JsonConvert.SerializeObject(config, Formatting.Indented, new FieldMapConfigJsonConverter(), new ProcessorConfigJsonConverter()); StreamWriter sw = new StreamWriter(configFile); sw.WriteLine(json); sw.Close(); Log.Information("New configuration.json file has been created"); } return(0); }
public void BuildWorkItemMigrationTest() { var ecb = new EngineConfigurationBuilder(); ecb.BuildWorkItemMigration(); }