public void Setup() { // Drivers/included _receiver = Substitute.For <ITransponderReceiver>(); _trackConverter = new TrackConverter(_receiver); _sorter = new Sorter(_trackConverter); _checker = new CheckForSeparationEvent(); // System under test _logger = new LogSeparationEvent(_checker); _warningCreator = new CreateWarning(_checker); // Stubs/mocks _ts = Substitute.For <ITrackSpeed>(); _tcc = Substitute.For <ITrackCompassCourse>(); // Driver _controller = new Controller(_sorter, _ts, _tcc, _checker, _warningCreator, _logger); // Data _fakeRawArgs = new RawTransponderDataEventArgs(new List <string>() { "Tag123;70000;70000;1000;20180420222222222", "Tag456;68000;68000;800;20180420222222222", "Tag789;89000;89000;5000;20180420222222222" }); // Assign to events _checker.SeperationEvents += _checker_SeperationEvents; _checker.NewSeperationEvents += _checker_FinishedSeperationEvents; }
public void SetUp() { _checker = Substitute.For <ISeperationEventChecker>(); _uut = new LogSeparationEvent(_checker); // Clearing variable for eventhandling _receivedArgs = null; // Assigning to event and saving the args in variable _checker.NewSeperationEvents += (o, args) => { _receivedArgs = args; }; }
public Controller(ISorter sorter, ITrackSpeed ts, ITrackCompassCourse tcc, ISeperationEventChecker checker, ISeperationEventHandler warningCreator, ISeperationEventLogger logger) { currentTracks = new List <TrackObject>(); _sorter = sorter; _sorter.TrackSortedReady += _sorter_TrackSortedReady; _ts = ts; _tcc = tcc; _checker = checker; _warningCreator = warningCreator; _logger = logger; consoleReady = false; }
public void SetUp() { _transponderReceiver = Substitute.For <ITransponderReceiver>(); _trackTransmitter = new TrackTransmitter(); _dateTimeBuilder = new DateTimeBuilder(); _trackObjectifier = new TrackObjectifier(_dateTimeBuilder); _trackReciever = new TrackReciever(_transponderReceiver, _trackObjectifier, _trackTransmitter); _output = Substitute.For <IOutput>(); _tracksManager = new TracksManager(); _courseCalculator = new CourseCalculator(); _velocityCalculator = new VelocityCalculator(); _seperationEventChecker = new SeperationEventChecker(); _seperationEventLogger = Substitute.For <ISeperationEventLogger>(); _airspace = new Airspace() { MaxAltitude = 20000, MinAltitude = 500, Northeast = new Corner() { X = 90000, Y = 90000 }, Southwest = new Corner() { X = 10000, Y = 10000 } }; _uut = new AirspaceChecker(_airspace); _tagsManager = new TagsManager(_uut); _trackWarehouse = new TrackWarehouse(_tagsManager, _courseCalculator, _velocityCalculator, _tracksManager, _seperationEventChecker); _atmController = new AtmController(_trackTransmitter, _output, _trackWarehouse); _list = new List <string> { "ATR423;11000;11000;14000;20151006213456000", "ATR424;9000;11000;14000;20151006213456000" }; _trackTransmitter.TrackReady += (o, args) => { _recievedTracks = args.TrackList; }; //Act _transponderReceiver.TransponderDataReady += Raise.EventWith(new RawTransponderDataEventArgs(_list)); }
public MainWindow() { // TrackConverter that takes a TransponderReceiver and starts it trackConverter = new TrackConverter(TransponderReceiverFactory.CreateTransponderDataReceiver()); // A sorter that uses the information from the TrackConverter sorter = new Sorter(trackConverter); // The logic-classes using and handling data ts = new TrackSpeed(); tcc = new TrackCompassCourse(); checker = new CheckForSeparationEvent(); warningCreator = new CreateWarning(checker); logger = new LogSeparationEvent(checker); // Controller that delegates out the data controller = new Controller(sorter, ts, tcc, checker, warningCreator, logger); InitializeComponent(); DataContext = new Controller(sorter, ts, tcc, checker, warningCreator, logger); Loaded += new RoutedEventHandler(MainWindow_Loaded); }
public void SetUp() { _transponderReceiver = Substitute.For <ITransponderReceiver>(); _trackTransmitter = new TrackTransmitter(); _dateTimeBuilder = new DateTimeBuilder(); _trackObjectifier = new TrackObjectifier(_dateTimeBuilder); _trackReciever = new TrackReciever(_transponderReceiver, _trackObjectifier, _trackTransmitter); _output = Substitute.For <IOutput>(); _tracksManager = new TracksManager(); _airspaceChecker = Substitute.For <IAirspaceChecker>(); _tagsManager = new TagsManager(_airspaceChecker); _courseCalculator = new CourseCalculator(); _velocityCalculator = new VelocityCalculator(); _uut = new SeperationEventChecker(); _seperationEventLogger = Substitute.For <ISeperationEventLogger>(); _trackWarehouse = new TrackWarehouse(_tagsManager, _courseCalculator, _velocityCalculator, _tracksManager, _uut); _atmController = new AtmController(_trackTransmitter, _output, _trackWarehouse); _list = new List <string> { "ATR423;10000;10000;14000;20151006213456000", "ATR424;10000;10100;14000;20151006213456000" }; _trackTransmitter.TrackReady += (o, args) => { _recievedTracks = args.TrackList; }; _uut.SeperationEvent += (o, args) => { _checkedTracks = args.Tracks; }; _airspaceChecker.Check(new Track()).ReturnsForAnyArgs(true); // Act _transponderReceiver.TransponderDataReady += Raise.EventWith(new RawTransponderDataEventArgs(_list)); }
public void SetUp() { _receiver = Substitute.For <ITransponderReceiver>(); _converter = new TrackConverter(_receiver); _sorter = new Sorter(_converter); _ts = new TrackSpeed(); _tcc = new TrackCompassCourse(); _checker = Substitute.For <ISeperationEventChecker>(); _warningCreator = Substitute.For <ISeperationEventHandler>(); _logger = Substitute.For <ISeperationEventLogger>(); _controller = new Controller(_sorter, _ts, _tcc, _checker, _warningCreator, _logger); _fakeRawArgs = new RawTransponderDataEventArgs(new List <string>() { "Fly1;88000;88000;6000;20180420222222222", "Fly2;72000;91000;19999;20180420222222222", "Fly3;86000;86000;6500;20180420222222222" }); _fakeRawArgs2 = new RawTransponderDataEventArgs(new List <string>() { "Fly1;86000;86000;6000;20180420223222222", "Fly2;72000;91000;19999;20180420223222222", "Fly3;86000;86000;6500;20180420223222222" }); }
public void SetUp() { _sorter = Substitute.For <ISorter>(); _speed = Substitute.For <ITrackSpeed>(); _compassCourse = Substitute.For <ITrackCompassCourse>(); _checker = Substitute.For <ISeperationEventChecker>(); _warningCreator = Substitute.For <ISeperationEventHandler>(); _logger = Substitute.For <ISeperationEventLogger>(); _uut = new Controller(_sorter, _speed, _compassCourse, _checker, _warningCreator, _logger); _sorter.TrackSortedReady += (o, args) => { _receivedArgs = args; }; _listOfTracks = new List <TrackObject>(); // Create tracks _track1 = new TrackObject("Tag123", 70000, 70000, 1000, DateTime.ParseExact("20180412111111111", "yyyyMMddHHmmssfff", CultureInfo.InvariantCulture)); _track2 = new TrackObject("Tag456", 68000, 68000, 800, DateTime.ParseExact("20180412111111111", "yyyyMMddHHmmssfff", CultureInfo.InvariantCulture)); _track3 = new TrackObject("Tag789", 89000, 89000, 5000, DateTime.ParseExact("20180412111111111", "yyyyMMddHHmmssfff", CultureInfo.InvariantCulture)); _track4 = new TrackObject("TagABC", 72000, 72000, 1200, DateTime.ParseExact("20180412111111111", "yyyyMMddHHmmssfff", CultureInfo.InvariantCulture)); }