public void Init()
        {
            CsvFile m_ReadFile = new CsvFile();

            m_ReadFile.ID       = "Read";
            m_ReadFile.FileName = Path.Combine(m_ApplicationDirectory, "BasicCSV.txt");
            m_ReadFile.FileFormat.FieldDelimiter = ",";
            var cf = m_ReadFile.ColumnAdd(new Column {
                Name = "ExamDate", DataType = DataType.DateTime
            });

            cf.DateFormat = @"dd/MM/yyyy";
            m_ReadFile.FileFormat.CommentLine = "#";
            m_ReadFile.ColumnAdd(new Column {
                Name = "Score", DataType = DataType.Integer
            });
            m_ReadFile.ColumnAdd(new Column {
                Name = "Proficiency", DataType = DataType.Numeric
            });

            m_ReadFile.ColumnAdd(new Column
            {
                Name     = "IsNativeLang",
                DataType = DataType.Boolean,
                Ignore   = true
            });

            ApplicationSetting.ToolSetting.Input.Add(m_ReadFile);
            mimicReader.AddSetting(m_ReadFile);

            m_WriteFile              = new CsvFile();
            m_WriteFile.ID           = "Write";
            m_WriteFile.SqlStatement = m_ReadFile.ID;

            var add = new Column();

            add.Name       = "ExamDate";
            add.DataType   = DataType.DateTime;
            add.DateFormat = @"MM/dd/yyyy";
            add.TimePart   = "ExamTime";
            m_WriteFile.ColumnAdd(add);

            m_WriteFile.ColumnAdd(new Column
            {
                Name   = "Proficiency",
                Ignore = true
            });
        }
Beispiel #2
0
        public void DetermineColumnFormatFillGuessColumnFormatWriter()
        {
            var reader = new CsvFile
            {
                ID             = "Reader",
                FileName       = Path.Combine(m_ApplicationDirectory, "BasicCSV.txt"),
                HasFieldHeader = true
            };

            ApplicationSetting.ToolSetting.Input.Clear();
            ApplicationSetting.ToolSetting.Input.Add(reader);
            var mimic = new MimicSQLReader();

            mimic.AddSetting(reader);

            reader.FileFormat.FieldDelimiter = ",";
            var writer = new CsvFile
            {
                SqlStatement = reader.ID
            };

            ApplicationSetting.ToolSetting.Output.Clear();
            ApplicationSetting.ToolSetting.Output.Add(writer);

            // setting.TreatTextNullAsNull = true;
            ApplicationSetting.FillGuessSettings.IgnoreIdColums = false;
            using (var processDisplay = new DummyProcessDisplay())
            {
                writer.FillGuessColumnFormatWriter(true, processDisplay.CancellationToken);
                Assert.AreEqual(6, writer.Column.Count);
            }
        }
Beispiel #3
0
        public void Init()
        {
            var m_ReadFile = new CsvFile
            {
                ID       = "Read",
                FileName = Path.Combine(m_ApplicationDirectory, "BasicCSV.txt")
            };
            var cf = m_ReadFile.ColumnAdd(new Column {
                Name = "ExamDate", DataType = DataType.DateTime
            });

            cf.DateFormat = @"dd/MM/yyyy";
            m_ReadFile.FileFormat.CommentLine = "#";
            m_ReadFile.ColumnAdd(new Column {
                Name = "Score", DataType = DataType.Integer
            });
            m_ReadFile.ColumnAdd(new Column {
                Name = "Proficiency", DataType = DataType.Numeric
            });

            m_ReadFile.ColumnAdd(new Column
            {
                Name     = "IsNativeLang",
                DataType = DataType.Boolean,
                Ignore   = true
            });

            mimicReader.AddSetting(m_ReadFile);
            ApplicationSetting.ToolSetting.Input.Clear();
            ApplicationSetting.ToolSetting.Input.Add(m_ReadFile);
        }