コード例 #1
0
        public void DbNullValueTest()
        {
            string OmegaLul = "HoHoHaHa";

            try
            {
                CreateTestTable();
                UpdateTestTable();
                PipelineContext context = new PipelineContext()
                {
                    SourceTableName     = "dbo.ConcurrentSqlExtractorTest"
                    , DbNullStringValue = OmegaLul
                };
                ConcurrentSqlExtractor           reader = new ConcurrentSqlExtractor(context);
                BoundedConcurrentQueu <object[]> output = new BoundedConcurrentQueu <object[]>();
                object[] row = null;

                while (reader.TryExtractRecord(out row))
                {
                    output.TryAdd(row);
                }
                Assert.IsTrue(output.Count == 5);
                object[] val = null;
                output.TryTake(out val);
                Assert.AreEqual(expected: OmegaLul, actual: val[0]);
            }
            finally
            {
                DestroyTestTable();
            }
        }
コード例 #2
0
        public void TryExtractRecordTest()
        {
            try
            {
                CreateTestTable();


                ConcurrentSqlExtractor reader = new ConcurrentSqlExtractor(context);

                BoundedConcurrentQueu <object[]> output = new BoundedConcurrentQueu <object[]>();
                Action action = () =>
                {
                    object[] currObject = null;
                    while (reader.TryExtractRecord(out currObject))
                    {
                        output.TryAdd(currObject);
                    }
                };
                List <Task> tasks = new List <Task>();
                for (int i = 0; i < 3; i++)
                {
                    tasks.Add(Task.Factory.StartNew(action));
                }
                Task.WhenAll(tasks).Wait();
                Assert.IsTrue(output.Count == 5);
            }
            finally
            {
                DestroyTestTable();
            }
        }
コード例 #3
0
        public void SkipperinoCappucinoMachiatoTest()
        {
            try
            {
                CreateTestTable();
                ConcurrentSqlExtractor           reader = new ConcurrentSqlExtractor(context);
                BoundedConcurrentQueu <object[]> output = new BoundedConcurrentQueu <object[]>();
                object[] row = null;

                Assert.IsTrue(reader.TrySkipRecord());
                Assert.IsTrue(reader.TrySkipRecord());
                while (reader.TryExtractRecord(out row))
                {
                    output.TryAdd(row);
                }
                Assert.IsTrue(output.Count == 3);
            }
            finally
            {
                DestroyTestTable();
            }
        }