예제 #1
0
        private static void Execute(int numberOfIdentities)
        {
            new GraphInterpreterSpecKit().WithTestSetup((setup, lastEvents) =>
            {
                var identities =
                    Enumerable.Range(1, numberOfIdentities)
                    .Select(_ => GraphStages.Identity <int>())
                    .Cast <IGraphStageWithMaterializedValue <Shape, object> >()
                    .ToArray();

                var source = new GraphDataSource <int>("source", Data100K);
                var sink   = new GraphDataSink <int>("sink", Data100K.Length);

                var b = setup.Builder(identities)
                        .Connect(source, identities[0].Shape.Inlets[0] as Inlet <int>)
                        .Connect(identities.Last().Shape.Outlets[0] as Outlet <int>, sink);

                // FIXME: This should not be here, this is pure setup overhead
                for (var i = 0; i < identities.Length - 1; i++)
                {
                    b.Connect(identities[i].Shape.Outlets[0] as Outlet <int>,
                              identities[i + 1].Shape.Inlets[0] as Inlet <int>);
                }

                b.Init();
                sink.RequestOne();
                setup.Interpreter.Execute(int.MaxValue);
            });
        }
 public void TestRetrieveNamedSource( )
 {
     IGraphDataSources sources = CreateDataSources( );
     IGraphDataSource source = new GraphDataSource( "test" );
     sources.Add( source );
     Assert.AreEqual( source, sources[ source.Name ] );
 }
        public void TestRemoveThenGetNamedSourceShouldThrow( )
        {
            IGraphDataSources sources = CreateDataSources( );
            IGraphDataSource source = new GraphDataSource( "test" );
            sources.Add( source );
            Assert.AreEqual( source, sources[ source.Name ] );
            sources.Remove( source );

            source = sources[ source.Name ];
        }
 public GraphiteController(IEnumerable <IGraphCollectionViewModel> graphViewModels, IEnumerable <IEventCollectionViewModel> eventViewModels)
 {
     _dataSource      = new GraphDataSource(graphViewModels);
     _eventViewModels = eventViewModels.ToList();
 }