public void StartServerTest()
        {
            TestInitialize();

            #region Act

            _aserv.StartServer();
            Thread.Sleep(5);
            _clientOne.ConnectToServer();
            Thread.Sleep(5);
            _clientTwo.ConnectToServer();
            Thread.Sleep(5);
            _clientThree.ConnectToServer();
            Thread.Sleep(5);

            _clientOne.SendResponse("ClientOne");
            Thread.Sleep(5);
            _clientTwo.SendResponse("ClientTwo");
            Thread.Sleep(5);
            _clientThree.SendResponse("ClientThree");

            #endregion

            #region Assert

            Thread.Sleep(5);
            Assert.IsNotNull(_aserv.ServerSocket);
            Assert.IsNotNull(_aserv.ClientSocket);
            Assert.IsNotEmpty(_aserv.MessageList);

            Thread.Sleep(5);
            _aserv.StopServer();

            #endregion
        }
        public void StopServerTest()
        {
            //Arrrange
            AServer aserv = new AServer();

            // Act
            aserv.StartServer();

            //Arrange
            Assert.IsNotNull(aserv.ServerSocket);

            // Act
            aserv.StopServer();

            //Assert
            Assert.IsNull(aserv.ServerSocket);
            //Assert.IsEmpty(aserv.ClientSocket);
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            AServer serv = new AServer()
            {
                ServerPort = 105
            };

            Client cli = new Client()
            {
                ClientPort = 105
            };

            Console.Title = "Server";
            serv.StartServer();

            Thread.Sleep(50);
            cli.ConnectToServer();

            Thread.Sleep(50);
            cli.SendResponse("Potato");

            Console.ReadLine();
            serv.StopServer();
        }