Esempio n. 1
0
        private string ReportSqlName(DbCommand command)
        {
            const string namePrefix = "--Name: ";

            if (command?.CommandText?.StartsWith(namePrefix) == true)
            {
                return(" in '" + CsUtility.FirstLine(command.CommandText).Substring(namePrefix.Length).Limit(1000, "...") + "'");
            }
            else
            {
                return("");
            }
        }
Esempio n. 2
0
        public void FirstLine()
        {
            var tests = new ListOfTuples <string, string>
            {
                { "abc", "abc" },
                { "", "" },
                { null, null },
                { "abc\r\ndef\r\n123", "abc" },
                { "a\r\ndef", "a" },
                { "\r\ndef", "" },
                { "\r\ndef\r\n", "" },
                { "\r\ndef\r\n1234", "" },
                { "\r", "" },
                { "\n", "" },
                { "abc\rdef\n123", "abc" },
                { "abc\ndef\r123", "abc" },
            };

            foreach (var test in tests)
            {
                Assert.AreEqual(test.Item2, CsUtility.FirstLine(test.Item1), "Test: " + test.Item1);
            }
        }