Ejemplo n.º 1
0
        public void WithObjectErrorLinking()
        {
            //Arrange
            TwoColumnsTableFixture          dest2Columns = new TwoColumnsTableFixture("JsonSourceErrorLinking");
            DbDestination <MySimpleRow>     dest         = new DbDestination <MySimpleRow>(SqlConnection, "JsonSourceErrorLinking");
            MemoryDestination <ETLBoxError> errorDest    = new MemoryDestination <ETLBoxError>();

            //Act
            JsonSource <MySimpleRow> source = new JsonSource <MySimpleRow>("res/JsonSource/TwoColumnsErrorLinking.json",
                                                                           ResourceType.File);

            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))
                                            );
        }