public void RaisingChannelValueUpdatedEventForGraphedChannelAddsPoint() { var eventAggregator = A.Fake <IEventAggregator>(); var evt = new AddToGraphEvent(); A.CallTo(() => eventAggregator.GetEvent <AddToGraphEvent>()).Returns(evt); A.CallTo(() => eventAggregator.GetEvent <GraphCreatedEvent>()).Returns(new GraphCreatedEvent()); var dataAquisition = A.Fake <IDataAquisition>(); var channel = new InputChannel(); var viewModel = new GraphsViewModel(eventAggregator, dataAquisition); evt.Publish((channel, 0)); var time = DateTime.Now; dataAquisition.ChannelValueUpdated += Raise.With(new ChannelValueUpdatedEventArgs(channel, 3.0, time)); Assert.IsType <LineSeries>(viewModel.Graphs[0].Series[0]); var lineSeries = (LineSeries)viewModel.Graphs[0].Series[0]; var point = lineSeries.Points[0]; Assert.Equal(DateTimeAxis.ToDouble(time), point.X); Assert.Equal(3.0, point.Y); }
public void PublishingAddToGraphEventWithId0CreatesNewGraph() { var eventAggregator = A.Fake <IEventAggregator>(); var evt = new AddToGraphEvent(); A.CallTo(() => eventAggregator.GetEvent <AddToGraphEvent>()).Returns(evt); var viewModel = new GraphsViewModel(eventAggregator, A.Fake <IDataAquisition>()); A.CallTo(() => eventAggregator.GetEvent <GraphCreatedEvent>()).Returns(new GraphCreatedEvent()); evt.Publish((new InputChannel(), 0)); Assert.Single(viewModel.Graphs); }
public void PublishingAddToGraphEventWithId0RaisesGraphCreatedEvent() { var eventAggregator = A.Fake <IEventAggregator>(); var evt = new AddToGraphEvent(); var graphCreated = A.Fake <GraphCreatedEvent>(); A.CallTo(() => eventAggregator.GetEvent <AddToGraphEvent>()).Returns(evt); A.CallTo(() => eventAggregator.GetEvent <GraphCreatedEvent>()).Returns(graphCreated); var viewModel = new GraphsViewModel(eventAggregator, A.Fake <IDataAquisition>()); evt.Publish((new InputChannel(), 0)); A.CallTo(() => graphCreated.Publish(1)).MustHaveHappened(); }