public void AddRowTestWithOverflowExceptionRedirect()
        {
            OutputTestImpl output = null;
            ComponentBufferServiceTestImpl bufferService = null;

            GenerateOutputColumns(new string[] { "A", "B", "C", "D" }, true, DTSRowDisposition.RD_FailComponent, DTSRowDisposition.RD_RedirectRow, out output, out bufferService);
            BufferSink target = new BufferSink(bufferService, output, true);

            // Say we have headers, etc...
            target.CurrentRowCount = 3;
            string[] data = new string[] { "1", "", "3", "4" };

            RowData rowData = GenerateRowData(data);

            target.AddRow(rowData);
            Assert.AreEqual <Int64>(4, target.CurrentRowCount);
            Assert.AreEqual <int>(1, bufferService.RowCount);
            Assert.AreEqual <int>(0, bufferService.ErrorRowCount);

            VerifyAddedRowData(bufferService, new object[] { "1", null, "3", "4" });

            bufferService.ExceptionToFire = new OverflowException();

            target.AddRow(rowData);
            Assert.AreEqual <Int64>(5, target.CurrentRowCount);
            Assert.AreEqual <int>(1, bufferService.RowCount);
            Assert.AreEqual <int>(1, bufferService.ErrorRowCount);
        }
        public void AddRowTestWithOverflowException()
        {
            OutputTestImpl output = null;
            ComponentBufferServiceTestImpl bufferService = null;

            GenerateOutputColumns(new string[] { "A", "B", "C", "D" }, true, DTSRowDisposition.RD_FailComponent, DTSRowDisposition.RD_FailComponent, out output, out bufferService);
            bufferService.ExceptionToFire = new DoesNotFitBufferException();
            BufferSink target = new BufferSink(bufferService, output, true);

            // Say we have headers, etc...
            target.CurrentRowCount = 3;
            string[] data = new string[] { "1", "", "3", "4" };

            RowData rowData = GenerateRowData(data);

            try
            {
                target.AddRow(rowData);
            }
            catch (Exception ex)
            {
                Assert.AreEqual <Int64>(4, target.CurrentRowCount);
                Assert.AreEqual <int>(0, bufferService.RowCount);
                Assert.AreEqual <int>(0, bufferService.ErrorRowCount);
                throw ex;
            }
        }
        public void AddRowTestWithException()
        {
            OutputTestImpl output = null;
            ComponentBufferServiceTestImpl bufferService = null;

            GenerateOutputColumns(new string[] { "A", "B", "C", "D" }, true, DTSRowDisposition.RD_FailComponent, DTSRowDisposition.RD_FailComponent, out output, out bufferService);
            bufferService.ExceptionToFire = new System.Runtime.InteropServices.COMException();
            BufferSink target = new BufferSink(bufferService, output, true);

            string[] data = new string[] { "1", "", "3", "4" };

            RowData rowData = GenerateRowData(data);

            try
            {
                target.AddRow(rowData);
            }
            catch (Exception ex)
            {
                Assert.AreEqual <Int64>(1, target.CurrentRowCount);
                Assert.AreEqual <int>(0, bufferService.RowCount);
                Assert.AreEqual <int>(0, bufferService.ErrorRowCount);
                throw ex;
            }
        }
        public void AddRowTestWithTooManyColumnsIgnore()
        {
            OutputTestImpl output = null;
            ComponentBufferServiceTestImpl bufferService = null;

            GenerateOutputColumns(new string[] { "A", "B", "C", "D" }, true, DTSRowDisposition.RD_FailComponent, DTSRowDisposition.RD_FailComponent, out output, out bufferService);
            output.TruncationRowDisposition = DTSRowDisposition.RD_IgnoreFailure;
            BufferSink target = new BufferSink(bufferService, output, true);

            string[] data = new string[] { "1", "", "3", "4", "5", "6" };

            RowData rowData = GenerateRowData(data);

            target.AddRow(rowData);
            Assert.AreEqual <Int64>(1, target.CurrentRowCount);
            Assert.AreEqual <int>(0, bufferService.RowCount);
            Assert.AreEqual <int>(0, bufferService.ErrorRowCount);
        }
        public void AddRowTest()
        {
            OutputTestImpl output = null;
            ComponentBufferServiceTestImpl bufferService = null;

            GenerateOutputColumns(new string[] { "A", "B", "C", "D" }, false, DTSRowDisposition.RD_FailComponent, DTSRowDisposition.RD_FailComponent, out output, out bufferService);
            BufferSink target = new BufferSink(bufferService, output, false);

            string[] data    = new string[] { "1", "2", "3", "4" };
            RowData  rowData = GenerateRowData(data);

            target.AddRow(rowData);

            Assert.AreEqual <Int64>(1, target.CurrentRowCount);
            Assert.AreEqual <int>(1, bufferService.RowCount);
            Assert.AreEqual <int>(0, bufferService.ErrorRowCount);

            VerifyAddedRowData(bufferService, data);
        }