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)); }
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 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); }
public static void Main(string[] args) { CoconaLiteApp.Run <QueryToCSharp>(args); }
/// <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);
public static void Main(string[] args) { CoconaLiteApp.Run <Program>(args, options => options.EnableShellCompletionSupport = false); }
public static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(Program.UnhandledException); CoconaLiteApp.Run <Program>(args); }