Пример #1
0
        public void TestPipelineContextInitialization_ForbiddenType()
        {
            var contextFactory = new DataFlowPipelineContextFactory <DataTable>();
            var context        = contextFactory.Create(PipelineUsage.None);

            var component = new TestObject_RequiresTableInfo();
            var ti        = new TableInfo(new MemoryCatalogueRepository(), "Foo");
            var ex        = Assert.Throws <Exception>(() => context.PreInitialize(new ThrowImmediatelyDataLoadEventListener(), component, ti));

            StringAssert.Contains("Type TableInfo is not an allowable PreInitialize parameters type under the current DataFlowPipelineContext (check which flags you passed to the DataFlowPipelineContextFactory and the interfaces IPipelineRequirement<> that your components implement) ", ex.Message);
        }
Пример #2
0
        public void TestPipelineContextInitialization()
        {
            var contextFactory = new DataFlowPipelineContextFactory <DataTable>();
            var context        = contextFactory.Create(PipelineUsage.FixedDestination | PipelineUsage.LoadsSingleTableInfo);

            var component = new TestObject_RequiresTableInfo();
            var ti        = new TableInfo(CatalogueRepository, "TestTableInfo");

            context.PreInitialize(new ThrowImmediatelyDataLoadEventListener(), component, ti);

            Assert.AreEqual(component.PreInitToThis, ti);
            ti.DeleteInDatabase();
        }
Пример #3
0
        public void TestPipelineContextInitialization_UnexpectedType()
        {
            var contextFactory = new DataFlowPipelineContextFactory <DataTable>();
            var context        = contextFactory.Create(PipelineUsage.FixedDestination | PipelineUsage.LoadsSingleTableInfo);

            var component = new TestObject_RequiresTableInfo();
            var ti        = new TableInfo(mockRepo, "Foo");
            var ci        = new ColumnInfo(mockRepo, "ColumnInfo", "Type", ti);

            ci.Name = "ColumnInfo"; // because we passed a stubbed repository, the name won't be set

            var ex = Assert.Throws <Exception>(() => context.PreInitialize(new ThrowImmediatelyDataLoadEventListener(), component, ci));

            StringAssert.Contains("The following expected types were not passed to PreInitialize:TableInfo", ex.Message);
        }