Exemple #1
0
        /// <summary>
        /// A ship, composed of any number of ship sections
        /// </summary>
        /// <param name="radio">A reference to the radio service</param>
        /// <param name="battleTheatre">A reference to the battle theatre</param>
        public Ship(IRadio radio, IBattleTheatre battleTheatre)
        {
            //subscribe to the batlefield shot events
            _battleTheatre             = battleTheatre;
            _battleTheatre.ShotLanded += _battleTheatre_ShotLanded;

            _radio = radio;
        }
Exemple #2
0
        /// <summary>
        /// The Command and control centre for a team (player)
        /// </summary>
        /// <param name="radio">A refernce to the readio service</param>
        /// <param name="shipyard">A reference to the shipyard service</param>
        /// <param name="battleTheatre">A reference to the battle theatre (game board)</param>
        public CommandCentre(IRadio radio, IShipyard shipyard, IBattleTheatre battleTheatre)
        {
            _shipyard      = shipyard;
            _battleTheatre = battleTheatre;

            //subscribe to the radio events sent from ships
            radio.TransmissionReceived += Radio_TransmissionReceived;
        }
Exemple #3
0
        public void Setup()
        {
            var battleTheatreMock = new Mock <IBattleTheatre>();

            battleTheatreMock.SetupGet(x => x.Height).Returns(10);
            battleTheatreMock.SetupGet(x => x.Width).Returns(10);

            _battleTheatre = battleTheatreMock.Object;
            _radio         = new Mock <IRadio>().Object;
        }