예제 #1
0
        public void SetupScenerio()
        {
            var sqlBulkInsert = new DsfSqlBulkInsertActivity();
            var dbSource      = SqlServerTests.CreateDev2TestingDbSource();

            ResourceCatalog.Instance.SaveResource(Guid.Empty, dbSource);
            ScenarioContext.Current.Add("dbSource", dbSource);
            sqlBulkInsert.Database  = dbSource;
            sqlBulkInsert.TableName = "SqlBulkInsertSpecFlowTestTable_for_" + ScenarioContext.Current.ScenarioInfo.Title.Replace(' ', '_');
            var dataColumnMappings = new List <DataColumnMapping>
            {
                new DataColumnMapping
                {
                    InputColumn  = "[[rs(*).Col1]]",
                    OutputColumn = new DbColumn
                    {
                        ColumnName = "Col1",
                        DataType   = typeof(Int32),
                        MaxLength  = 100
                    },
                },
                new DataColumnMapping
                {
                    InputColumn  = "[[rs(*).Col2]]",
                    OutputColumn = new DbColumn
                    {
                        ColumnName = "Col2",
                        DataType   = typeof(String),
                        MaxLength  = 100
                    }
                },
                new DataColumnMapping
                {
                    InputColumn  = "[[rs(*).Col3]]",
                    OutputColumn = new DbColumn
                    {
                        ColumnName = "Col3",
                        DataType   = typeof(Guid),
                        MaxLength  = 100
                    }
                }
            };

            sqlBulkInsert.InputMappings = dataColumnMappings;
            TestStartNode = new FlowStep
            {
                Action = sqlBulkInsert
            };
            ErrorResultTO errors;

            var compiler  = ScenarioContext.Current.Get <IDataListCompiler>("compiler");
            var dlId      = ScenarioContext.Current.Get <Guid>("dlID");
            var dataShape = ScenarioContext.Current.Get <string>("dataShape");
            var data      = compiler.ConvertFrom(dlId, DataListFormat.CreateFormat(GlobalConstants._XML),
                                                 enTranslationDepth.Data, out errors);

            CurrentDl = dataShape;
            TestData  = data.ToString();
            ScenarioContext.Current.Add("activity", sqlBulkInsert);
        }
예제 #2
0
        public void SetupScenerio()
        {
            var sqlBulkInsert = new DsfSqlBulkInsertActivity();
            var dbSource      = SqlServerTests.CreateDev2TestingDbSource();

            ResourceCatalog.Instance.SaveResource(Guid.Empty, dbSource);
            ScenarioContext.Current.Add("dbSource", dbSource);
            sqlBulkInsert.Database  = dbSource;
            sqlBulkInsert.TableName = "SqlBulkInsertSpecFlowTestTable_for_" + ScenarioContext.Current.ScenarioInfo.Title.Replace(' ', '_');
            var dataColumnMappings = new List <DataColumnMapping>
            {
                new DataColumnMapping
                {
                    InputColumn  = "[[rs(*).Col1]]",
                    OutputColumn = new DbColumn
                    {
                        ColumnName = "Col1",
                        DataType   = typeof(Int32),
                        MaxLength  = 100
                    },
                },
                new DataColumnMapping
                {
                    InputColumn  = "[[rs(*).Col2]]",
                    OutputColumn = new DbColumn
                    {
                        ColumnName = "Col2",
                        DataType   = typeof(String),
                        MaxLength  = 100
                    }
                },
                new DataColumnMapping
                {
                    InputColumn  = "[[rs(*).Col3]]",
                    OutputColumn = new DbColumn
                    {
                        ColumnName = "Col3",
                        DataType   = typeof(Guid),
                        MaxLength  = 100
                    }
                }
            };

            sqlBulkInsert.InputMappings = dataColumnMappings;
            TestStartNode = new FlowStep
            {
                Action = sqlBulkInsert
            };

            ScenarioContext.Current.Add("activity", sqlBulkInsert);
        }