public void MapperDoesNotNotifyDettachedObservers() { var airspace = Substitute.For <SWT_ATM.IObserver <List <Data> > >(); var format = new TransponderDataFormat(); var mapper = new CoordinateMapper(format); var simulator = new TrackSimulator(mapper, Substitute.For <ITransponderReceiver>()); mapper.Attach(airspace); mapper.Deattach(airspace); var testData = new List <string>(); testData.Add("ATR423;39045;12932;14000;20151006213456789"); simulator.OnDataReceieved(null, new RawTransponderDataEventArgs(testData)); airspace.DidNotReceive().Update(Arg.Any <List <Data> >()); }
public void MapperNotifiesAttachedObserversWithData() { var airspace = Substitute.For <SWT_ATM.IObserver <List <Data> > >(); var format = new TransponderDataFormat(); var mapper = new CoordinateMapper(format); var simulator = new TrackSimulator(mapper, Substitute.For <ITransponderReceiver>()); mapper.Attach(airspace); var testData = new List <string>(); testData.Add("ATR423;39045;12932;14000;20151006213456789"); simulator.OnDataReceieved(null, new RawTransponderDataEventArgs(testData)); airspace.Received(1).Update(Arg.Is <List <Data> >(d => d[0].Altitude == 14000 && d[0].Tag == "ATR423" && d[0].Timestamp == "20151006213456789" && d[0].XCord == 39045 && d[0].YCord == 12932) ); }
public void DisplayFormatterDoesEnteringNotification() { var notificationCenter = Substitute.For <INotificationCenter>(); var positionCalc = Substitute.For <IPositionCalc>(); var display = Substitute.For <IDisplay>(); displayFormatter = new DisplayFormatter(display, positionCalc, notificationCenter); mapper.Attach(new Airspace(monitor, displayFormatter, log)); var testData = new List <string>(); testData.Add("ATR423;10;10;14000;20151006213456789"); simulator.OnDataReceieved(null, new RawTransponderDataEventArgs(testData)); notificationCenter.Received(1).EnqueNotification(Arg.Is <List <string> >(d => d[0] == "ATR423" && d[1] == "ENTERING")); notificationCenter.Received(1).SetNotificationSignalHandle(); }
public void AirspaceCallsMonitorEventTrackerWithData() { var log = Substitute.For <ILog>(); var monitor = Substitute.For <IMonitor>(); var displayFormatter = Substitute.For <IDisplayFormatter>(); var airspace = new Airspace(monitor, displayFormatter, log); mapper.Attach(airspace); var testData = new List <string>(); testData.Add("ATR423;39045;12932;14000;20151006213456789"); monitor.GetTracksInConflict().Returns(new List <Data>()); simulator.OnDataReceieved(null, new RawTransponderDataEventArgs(testData)); monitor.Received(1).EventTracker(Arg.Is <Data>(d => d.Altitude == 14000 && d.Tag == "ATR423" && d.Timestamp == "20151006213456789" && d.XCord == 39045 && d.YCord == 12932) ); }