예제 #1
0
        public void SqlWriterTest_TruncateTableStatement_NO()
        {
            // Arrange
            var jsonSettings = @"
            {
            ""importFiles"": 
                [
                    {
                        ""file"": ""..\\..\\..\\..\\TestCsv\\simpleComma.csv"",
                        ""batchSize"": 4,
                        ""truncate"": false
                    }
                ]
            }";

            var importTasks = (List <ImportFileOptions>)CsvToSql.Configuration.ImportTasks.ReadTasks(log, jsonSettings);

            var sqlWriter = new SqlServerWriter(log, "");

            var headers = new List <string>()
            {
                "head1", "head2"
            };

            // Act
            sqlWriter.Init(importTasks.First(), headers);
            var tableTruncSql = sqlWriter.GetTruncateTableStatement();

            // Assert
            Assert.IsTrue(sqlWriter != null);
            Assert.IsTrue(tableTruncSql.Length < 3);
            Assert.IsFalse(tableTruncSql.Contains("TRUNCATE TABLE"));
        }