Esempio n. 1
0
        public void WhenIExtractValues_ThenTheAppropriateNumberOfRowsArePresent()
        {
            var stream = new FileStream(Path.GetFullPath(ConfigurationManager.AppSettings["FileUploadTemplatePath"] + "DataFileWizard/HappyPath.txt"), FileMode.Open);

            DataTable actual = DataFileParser.ExtractValues(stream, '\t', 3, 1, 2, 5);

            Assert.AreEqual(3, actual.Rows.Count);
        }
Esempio n. 2
0
        public void GivenFileHasTwoColumnsInAdditionToStudentId_AndLastIntegerColumnMissingData_AndColumnHasNoDelimiter_WhenExtractValues_ThenRowWithMissingDelimiterHasRowError()
        {
            var stream = new FileStream(Path.GetFullPath(ConfigurationManager.AppSettings["FileUploadTemplatePath"] + "DataFileWizard/LastIntegerColumnMissingValueAndDelimiter.txt"), FileMode.Open);

            DataTable actual = DataFileParser.ExtractValues(stream, '\t', 3, 1, 2, 5);

            DataRow errorRow = actual.GetErrors().SingleOrDefault();

            Assert.IsNotNull(errorRow);
            Assert.AreEqual("40", errorRow[1]);
            Assert.AreEqual("Incorrect number of columns.", errorRow.RowError);
        }