コード例 #1
0
        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          = Substitute.For <ITracksManager>();
            _airspaceChecker        = Substitute.For <IAirspaceChecker>();
            _uut                    = new TagsManager(_airspaceChecker);
            _courseCalculator       = Substitute.For <ICourseCalculator>();
            _velocityCalculator     = Substitute.For <IVelocityCalculator>();
            _seperationEventChecker = Substitute.For <ISeperationEventChecker>();

            _trackWarehouse = new TrackWarehouse(_uut, _courseCalculator,
                                                 _velocityCalculator, _tracksManager, _seperationEventChecker);
            _atmController = new AtmController(_trackTransmitter, _output, _trackWarehouse);


            _list = new List <string> {
                "ATR423;39045;12932;14000;20151006213456000"
            };

            _trackTransmitter.TrackReady += (o, args) => { _recievedTracks = args.TrackList; };


            // Act
            _transponderReceiver.TransponderDataReady +=
                Raise.EventWith(new RawTransponderDataEventArgs(_list));
        }
コード例 #2
0
        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;
        }
コード例 #3
0
        public void Setup()
        {
            _tagsManager            = Substitute.For <ITagsManager>();
            _courseCalculator       = Substitute.For <ICourseCalculator>();
            _velocityCalculator     = Substitute.For <IVelocityCalculator>();
            _tracksManager          = Substitute.For <ITracksManager>();
            _seperationEventChecker = Substitute.For <ISeperationEventChecker>();
            _uut = new TrackWarehouse(_tagsManager, _courseCalculator,
                                      _velocityCalculator, _tracksManager, _seperationEventChecker);

            _tracks = new List <Track> {
                new Track()
                {
                    Tag = "1"
                },
                new Track()
                {
                    Tag = "2"
                },
                new Track()
                {
                    Tag = "1"
                }
            };

            _tags = new List <string> {
                "1", "2"
            };
            // Det gør ingen forskel, hvad der står i x.Manage()
            _tagsManager.WhenForAnyArgs(x => x.Manage(ref _tags, _tracks))
            .Do(x => x[0] = _tags);
        }
コード例 #4
0
        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; };
        }
コード例 #5
0
        public TrackWarehouse(ITagsManager tagsManager, ICourseCalculator courseCalculator,
                              IVelocityCalculator velocityCalculator, ITracksManager tracksManager,
                              ISeperationEventChecker seperationEventChecker)
        {
            _tagsManager            = tagsManager;
            _courseCalculator       = courseCalculator;
            _velocityCalculator     = velocityCalculator;
            _tracksManager          = tracksManager;
            _seperationEventChecker = seperationEventChecker;

            _tracksInAirspace = new List <Track>();
            _tagsInAirspace   = new List <string>();
        }
コード例 #6
0
        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;
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        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"
            });
        }
コード例 #9
0
        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));
        }
コード例 #10
0
 public SeperationEventLogger(IOutput output, ISeperationEventChecker seperationEventChecker)
 {
     _output = output;
     seperationEventChecker.SeperationEvent += Log;
 }
コード例 #11
0
ファイル: CreateWarning.cs プロジェクト: Gruppe19ST/ATM
 public CreateWarning(ISeperationEventChecker checker)
 {
     checker.SeperationEvents += Checker_SeperationEvents;
 }
コード例 #12
0
 public LogSeparationEvent(ISeperationEventChecker checker)
 {
     checker.NewSeperationEvents += Checker_NewSeperationEvents;
 }