Ejemplo n.º 1
0
        public void Update(Tos obj)
        {
            var recievedTracks = obj.RecievedTracks;

            foreach (var track in recievedTracks)
            {
                if (_airSpace.IsInValidAirSpace(track))
                {
                    if (_trackStorage.Contains(track))
                    {
                        _trackStorage.Update(track);
                    }
                    else
                    {
                        _trackStorage.Add(track);
                    }
                }
                else if (_trackStorage.Contains(track) && !_airSpace.IsInValidAirSpace(track))
                {
                    _trackStorage.Remove(track);
                }
            }

            _collisonDetector.CheckForCollision(_trackStorage.GetAllTracks());
            _render.PrintTrackData(_trackStorage.GetAllTracks());
        }
        public void Update_ArgIs2DifferentValidTracks_AddIsCalledTwice()
        {
            var list = new List <ITrack> {
                validTrack1,
                validTrack2
            };

            _tos.RecievedTracks = list;

            _airSpace.IsInValidAirSpace(validTrack1).Returns(true);
            _airSpace.IsInValidAirSpace(validTrack2).Returns(true);

            _uut.Update(_tos);
            _trackStorage.ReceivedWithAnyArgs(2).Add(new Track());
        }