public static void XForm(string xformCommand, int expectedExitCode = 0, XDatabaseContext context = null) { if (context == null) { context = SampleDatabase.XDatabaseContext; // Ensure the as-of DateTime is reset for each operation context.RequestedAsOfDateTime = DateTime.MaxValue; } List <string> args = new List <string>(); XqlScanner scanner = new XqlScanner(xformCommand); while (scanner.Current.Type != TokenType.End) { if (scanner.Current.Type == TokenType.Newline) { break; } args.Add(scanner.Current.Value); scanner.Next(); } int result = Program.Run(args.ToArray(), context); Assert.AreEqual(expectedExitCode, result, $"Unexpected Exit Code for XForm {xformCommand}"); }
private static string TestSplitAndJoin(string xqlLine) { XqlScanner scanner = new XqlScanner(xqlLine); List <string> parts = new List <string>(); while (scanner.Current.Type != TokenType.End) { parts.Add(scanner.Current.Value); scanner.Next(); } return(string.Join("|", parts)); }