Exemplo n.º 1
0
 public void FufuDrinkTest()
 {
     TwoServerWindow twoServ = null; // TODO: Initialize to an appropriate value
     PlayerList target = new PlayerList(twoServ); // TODO: Initialize to an appropriate value
     target.FufuDrink();
     Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }
Exemplo n.º 2
0
 public UsersConnected(PlayerList pL)
 {
     InitializeComponent();
     _playerList = pL;
     for( int i = 0; i < pL.NumberPlayers; i++)
     {
         _isConnected.Add(false);
     }
     BuildList();
 }
Exemplo n.º 3
0
 public void AddPlayerTest()
 {
     TwoServerWindow twoServ = null; // TODO: Initialize to an appropriate value
     PlayerList target = new PlayerList(twoServ); // TODO: Initialize to an appropriate value
     EndPoint playerAddress = null; // TODO: Initialize to an appropriate value
     string name = string.Empty; // TODO: Initialize to an appropriate value
     bool expected = false; // TODO: Initialize to an appropriate value
     bool actual;
     actual = target.AddPlayer(playerAddress, name);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Exemplo n.º 4
0
        /// <summary> 
        /// Constructor for TwoServerWindow, creates udp receptor thread and creates listening sockets, spawns
        /// a game options window, and prepares the server to accept clients
        /// </summary> 
        public TwoServerWindow()
        {
            InitializeComponent();
            PlayerList = new PlayerList(this);
            IPHostEntry localHostEntry;
            try
            {
                //Create a UDP socket.
                _udpSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);

                localHostEntry = Dns.GetHostEntry(Dns.GetHostName());
            }
            catch (Exception)
            {
                //If the socket can't be created the server can't work
                AddText("Local Host not found");
                return;
            }
            IPAddress localIp = null;
            foreach (IPAddress ip in localHostEntry.AddressList)
            {
                if (ip.AddressFamily == AddressFamily.InterNetwork)
                    localIp = ip;
            }

            _localEndPoint = new IPEndPoint(localIp, 48484);
            _udpSocket.Bind(_localEndPoint);
            Show();
            GameOption = new GameOptions();
            GameOption.ShowDialog();

            _udpThread = new Thread(new ThreadStart(RecieveUdp));
            _udpThread.Start();
            _broadcastThread = new Thread(new ThreadStart(BroadcastServerThread));
            _broadcastThread.Start();
            UdpMessageEvent += new UdpMessageHandler(UdpMessageListener);
            DownDeck = new Stack<Card>();
        }
Exemplo n.º 5
0
 /// <summary> 
 /// Resets the game state to default, so that clients can rejoin and the game can be started again.
 /// </summary> 
 public void RestartGame()
 {
     foreach (TimedEvent timedEvent in TimedEventList)
     {
         timedEvent.IsRunning = false;
     }
     CreateDeck();
     ShuffleDeck();
     PlayerList = new PlayerList(this);
     GameState = 0;
     _broadcastThread = new Thread(new ThreadStart(BroadcastServerThread));
     _broadcastThread.Start();
 }
Exemplo n.º 6
0
 public void GetNextPlayerTest()
 {
     TwoServerWindow twoServ = null; // TODO: Initialize to an appropriate value
     PlayerList target = new PlayerList(twoServ); // TODO: Initialize to an appropriate value
     int noOfTurns = 0; // TODO: Initialize to an appropriate value
     Player expected = null; // TODO: Initialize to an appropriate value
     Player actual;
     actual = target.GetNextPlayer(noOfTurns);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Exemplo n.º 7
0
 public void SwapPlayerTest()
 {
     TwoServerWindow twoServ = null; // TODO: Initialize to an appropriate value
     PlayerList target = new PlayerList(twoServ); // TODO: Initialize to an appropriate value
     int p1 = 0; // TODO: Initialize to an appropriate value
     int p2 = 0; // TODO: Initialize to an appropriate value
     target.SwapPlayer(p1, p2);
     Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }
Exemplo n.º 8
0
 public void RemovePlayerCardTest()
 {
     TwoServerWindow twoServ = null; // TODO: Initialize to an appropriate value
     PlayerList target = new PlayerList(twoServ); // TODO: Initialize to an appropriate value
     Player p = null; // TODO: Initialize to an appropriate value
     Card c = null; // TODO: Initialize to an appropriate value
     target.RemovePlayerCard(p, c);
     Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }
Exemplo n.º 9
0
 public void PlayerListConstructorTest()
 {
     TwoServerWindow twoServ = null; // TODO: Initialize to an appropriate value
     PlayerList target = new PlayerList(twoServ);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }