Пример #1
0
        public void DiagnosticsCallback_Null_Test()
        {
            // Arrange
            var service = new Mock<DataTableServiceBase>();

            // Act
            var harvester = new DataTableHarvester(service.Object);

            // Assert
            Assert.Null(harvester.DiagnosticsCallback);
        }
Пример #2
0
        public void EndChar_Test()
        {
            // Arrange
            var service = new Mock<DataTableServiceBase>();

            // Act
            var harvester = new DataTableHarvester(service.Object);

            // Assert
            Assert.Equal("###", harvester.EndChar);
        }
Пример #3
0
        public void Harvest_Test()
        {
            // Arrange
            string fileName = Environment.CurrentDirectory + @"\Contracts.xlsx";
            var sevice = new ExcelReaderService(fileName);
            var harvester = new DataTableHarvester(sevice);
            harvester.DiagnosticsCallback = Console.WriteLine;

            List<string> colums = new List<string>();
            colums.Add("String");
            colums.Add("Sbyte");

            // Act
            IEnumerable<TestContract> items = harvester.Harvest<TestContract>(0, colums);

            // Assert
            Assert.True(items.Count() == 4);
        }
Пример #4
0
        public void PerRowHarvest_Test()
        {
            // Arrange
            string fileName = Environment.CurrentDirectory + @"\Contracts.xlsx";
            var sevice = new ExcelReaderService(fileName);
            var harvester = new DataTableHarvester(sevice);
            harvester.DiagnosticsCallback = Console.WriteLine;

            // Assert
            harvester.PerRowHarvest<TestContract>(0, Assert.NotNull);
        }