public static ISchedule Build(SimplePlotterElement config, IEnumerable<ISnapshotProvider> sources)
        {
            var plotterConfig = new PlotterConfiguration(new [] { config });

            var sinks = MultiPlotterBuilder.Build(plotterConfig);

            var sourceStringBuilder = new StringBuilder();
            foreach(var source in config.Sources.Split(','))
            {
                sourceStringBuilder.Append(source).Append(" Buffer,");
            }
            var configSources = sourceStringBuilder.ToString().TrimEnd(',');

            var chainConfig = new ChainElement(config.Id + " Chain", config.Name, configSources, "", config.Id + " Plotter");

            var chains = ChainBuilder.Build(sources, new List<ISnapshotConsumer>(), sinks, new [] { chainConfig });

            var schedule = ScheduleBuilder.Build(config.Name, config.Delay, chains);

            return schedule;
        }
示例#2
0
        public void SimpleMultiPlotterCanConnectToMultipleSources()
        {
            const string sourceName1 = "testSource";
            const string sourceName2 = "testSource2";
            const string multiplotterName = "testPlotter";
            var sources = string.Join(",", sourceName1, sourceName2);
            float? min = 0.0f;
            float? max = 0.0f;
            const string outputPath = "thePath";
            const double scale = 0.1d;
            const int delay = 11;

            var plotter = new SimplePlotterElement("id", multiplotterName, sources, min, max, outputPath, scale, delay);

            var source1 = MockRepository.GenerateMock<ISnapshotProvider>();
            source1.Expect(s => s.Name).Return(sourceName1).Repeat.Any();
            var source2 = MockRepository.GenerateMock<ISnapshotProvider>();
            source2.Expect(s => s.Name).Return(sourceName2).Repeat.Any();

            var schedules = SimplePlotterBuilder.Build(plotter, new [] { source1, source2 });

           Assert.AreEqual("testPlotter", schedules.Name);
        }