public void QueryExecutionAnnotationTest() { var id = Guid.NewGuid().ToString(); var args = new[] { "query", "-i", "create table quengine(id int auto_increment key, class varchar(10), data binary) engine='InnoDB';", "-o", "hoge", "-n", "Fuga", "--executionid", id }; CoconaLiteApp.Run <QueryToCSharp>(args); var expected = @"// ------------------------------------------------------------------------------ // <auto-generated> // Code Generated by MySQLToCsharp // </auto-generated> // ------------------------------------------------------------------------------ using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace Fuga { public partial class quengine { public int id { get; set; } [Required] [StringLength(10)] public string class { get; set; } [Required] public byte[] data { get; set; } } } "; var msg = QueryToCSharp.Context.GetLogs(id).First(); msg.Should().Be(InternalUtils.NormalizeNewLines(expected)); }
public void DirExecutionAnnotationTest() { var dir = "dir_annotation"; var id = Guid.NewGuid().ToString(); var args = new[] { "dir", "-i", "test_data/simple_annotation/", "-o", dir, "-n", "Fuga", "--executionid", id }; CoconaLiteApp.Run <QueryToCSharp>(args); var expected = @"// ------------------------------------------------------------------------------ // <auto-generated> // Code Generated by MySQLToCsharp // </auto-generated> // ------------------------------------------------------------------------------ using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace Fuga { public partial class quengine { public int id { get; set; } [Required] [StringLength(10)] public string class { get; set; } [Required] public byte[] data { get; set; } } } "; var msg = QueryToCSharp.Context.GetLogs(id).First(); msg.Should().Be(InternalUtils.NormalizeNewLines(expected)); }
static async Task Main(string[] args) { #if SENTRY || !DEBUG using var _ = SentrySdk.Init(ConfigureSentryOptions); #endif await CoconaLiteApp.RunAsync <Program>(args); }
public void QueryExecutionTest() { var id = Guid.NewGuid().ToString(); var args = new[] { "query", "-i", "create table ships_guns(guns_id int, ship_id int);", "-o", "hoge", "-n", "Fuga", "--executionid", id }; CoconaLiteApp.Create().Run <QueryToCSharp>(args); var expected = @"// ------------------------------------------------------------------------------ // <auto-generated> // Code Generated by MySQLToCsharp // </auto-generated> // ------------------------------------------------------------------------------ using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace Fuga { public partial class ships_gun { public int guns_id { get; set; } public int ship_id { get; set; } } } "; var msg = QueryToCSharp.Context.GetLogs(id).First(); msg.Should().Be(InternalUtils.NormalizeNewLines(expected)); }
public static Task Main(string[] args) => CoconaLiteApp.Create() .ConfigureServices(services => { services.AddJsonConfigurationService(FileConfigurationServiceRoot); }) .RunAsync <Program>(args, options => { options.TreatPublicMethodsAsCommands = false; });
static async Task Main(string[] args) { #if SENTRY || !DEBUG using var _ = SentrySdk.Init(ConfigureSentryOptions); #endif await CoconaLiteApp.Create() .ConfigureServices(services => { services.AddSingleton <IConsole, StandardConsole>(); services.AddSingleton <IKeyStore>(Web3KeyStore.DefaultKeyStore); }) .RunAsync <Program>(args); }
static void Main() { using var sentry = SentrySdk.Init(o => { o.Dsn = "https://[email protected]/6125607"; o.TracesSampleRate = 1.0; // Capture 100% of transactions }); DotEnv.Load(); var app = CoconaLiteApp.Create(); app.AddCommand(RunScraperWithExceptionHandling).WithDescription("A tool to detect new+modified postings on Vancouver's shapeyourcity.ca website. Data is stored in a local SQLite database next to the executable."); app.AddCommand("tweet", TweetWithExceptionHandling).WithDescription("Tweet a recent item."); app.Run(); }
public void DirExecutionIgnoreEolWindowsTest() { var dir = "dir_eol_windows"; var id = Guid.NewGuid().ToString(); var args = new[] { "dir", "-i", "test_data/simple_eol/", "-o", dir, "-n", "Fuga", "--executionid", id }; CoconaLiteApp.Run <QueryToCSharp>(args); var expected = @"// ------------------------------------------------------------------------------ // <auto-generated> // Code Generated by MySQLToCsharp // </auto-generated> // ------------------------------------------------------------------------------ using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace Fuga { public partial class eol { public int guns_id { get; set; } public int ship_id { get; set; } } } "; var msg = QueryToCSharp.Context.GetLogs(id).First(); msg.Should().Be(InternalUtils.NormalizeNewLines(expected)); QueryToCSharp.Context.Clear(); // replace existing for windows test var replaced = File.ReadAllText($"{dir}/eol.cs").Replace("\r\n", "\n"); File.WriteAllText($"{dir}/eol.cs", replaced); CoconaLiteApp.Run <QueryToCSharp>(args); File.ReadAllText($"{dir}/eol.cs").Should().Be(replaced); var ignoreeolArgs = new[] { "dir", "-i", "test_data/simple_eol/", "-o", dir, "-n", "Fuga", "--ignoreeol=false", "--executionid", id }; CoconaLiteApp.Run <QueryToCSharp>(ignoreeolArgs); File.ReadAllText($"{dir}/eol.cs").Replace("\r\n", "\n").Should().Be(replaced); }
/// <summary> /// Invokes the console app. /// </summary> /// <param name="args">List of arguments.</param> public static void Main(string[] args) { CoconaLiteApp.Run <Program>(args); }
static void Main(string[] args) => CoconaLiteApp.Run <Program>(args);
static async Task Main(string[] args) { await CoconaLiteApp.RunAsync <ClrmdRun>(args); }
public static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(Program.UnhandledException); CoconaLiteApp.Run <Program>(args); }
static async Task Main(string[] args) => await CoconaLiteApp.RunAsync <Diagnostics>(args);
public static async Task Main(string[] args) { await CoconaLiteApp.RunAsync <Program>(args); }
public static void Main(string[] args) { CoconaLiteApp.Run <Program>(args, options => options.EnableShellCompletionSupport = false); }
public static void Main(string[] args) { CoconaLiteApp.Run <QueryToCSharp>(args); }
public static Task Main(string[] args) => CoconaLiteApp.RunAsync<Program>(args, options => { options.TreatPublicMethodsAsCommands = false; });