Esempio n. 1
0
        public void WithObjectErrorLinking()
        {
            //Arrange
            TwoColumnsTableFixture          dest2Columns = new TwoColumnsTableFixture("CSVSourceErrorLinking");
            DBDestination <MySimpleRow>     dest         = new DBDestination <MySimpleRow>(SqlConnection, "CSVSourceErrorLinking");
            MemoryDestination <ETLBoxError> errorDest    = new MemoryDestination <ETLBoxError>();

            //Act
            CSVSource <MySimpleRow> source = new CSVSource <MySimpleRow>("res/CSVSource/TwoColumnsErrorLinking.csv");

            source.LinkTo(dest);
            source.LinkErrorTo(errorDest);
            source.Execute();
            dest.Wait();
            errorDest.Wait();

            //Assert
            dest2Columns.AssertTestData();
            Assert.Collection <ETLBoxError>(errorDest.Data,
                                            d => Assert.True(!string.IsNullOrEmpty(d.RecordAsJson) && !string.IsNullOrEmpty(d.ErrorText)),
                                            d => Assert.True(!string.IsNullOrEmpty(d.RecordAsJson) && !string.IsNullOrEmpty(d.ErrorText)),
                                            d => Assert.True(!string.IsNullOrEmpty(d.RecordAsJson) && !string.IsNullOrEmpty(d.ErrorText)),
                                            d => Assert.True(!string.IsNullOrEmpty(d.RecordAsJson) && !string.IsNullOrEmpty(d.ErrorText))
                                            );
        }