예제 #1
0
 public void OpenReadTestPGP()
 {
     PGPKeyStorageTestHelper.SetApplicationSetting();
     using (var res = ImprovedStream.OpenRead(Path.Combine(m_ApplicationDirectory, "BasicCsV.pgp"), () => { return("UGotMe".Encrypt()); }))
     {
         Assert.IsNotNull(res);
         Assert.IsNotNull(res.Stream);
     }
 }
예제 #2
0
        public void ReadPGP()

        {
            var setting = new CsvFile
            {
                HasFieldHeader   = true,
                AlternateQuoting = true
            };

            PGPKeyStorageTestHelper.SetApplicationSetting();

            setting.FileName = "TestFiles\\BasicCSV.pgp";
            setting.ColumnAdd(new Column
            {
                Name       = "ExamDate",
                DataType   = DataType.DateTime,
                DateFormat = @"dd/MM/yyyy"
            });
            setting.ColumnAdd(new Column
            {
                Name     = "ID",
                DataType = DataType.Integer
            });
            setting.ColumnAdd(new Column
            {
                Name     = "IsNativeLang",
                DataType = DataType.Boolean
            });
            using (var test = new CsvFileReader(setting))
            {
                test.Open(true, CancellationToken.None);
                int row = 0;
                while (test.Read())
                {
                    row++;
                }
                Assert.AreEqual(row, test.RecordNumber);
                Assert.AreEqual(7, row);
            }
        }