public void Make_TicTacToe_Incorrect_Correct_No_Port()
        {
            var mockPrinter = new MockPrinter();

            string[] args       = { "-p", "-p" };
            var      serverMade = Program.MakeServer(args, mockPrinter);

            Assert.Null(serverMade);
        }
        public void Make_TicTacToe_Server_Correct()
        {
            var mockPrinter = new MockPrinter();

            string[] args       = { "-p", "9560" };
            var      serverMade = Program.MakeServer(args, mockPrinter);

            Assert.NotNull(serverMade);
        }
        public void Make_Dirctory_Server_Inncorect_Correct_Not_Port()
        {
            var mockPrinter   = new MockPrinter();
            var correctOutput = new StringBuilder();

            correctOutput.Append("Invaild Port Detected.");
            correctOutput.Append("Vaild Ports 2000 - 65000");

            string[] args       = { "-p", "hello" };
            var      serverMade = Program.MakeServer(args, mockPrinter);

            Assert.Null(serverMade);
            mockPrinter.VerifyPrint(correctOutput.ToString());
        }
        public void Out_Of_Range_Ports(int invaildPorts)
        {
            var correctOutput = new StringBuilder();

            correctOutput.Append("Invaild Port Detected.");
            correctOutput.Append("Vaild Ports 2000 - 65000");

            string[] argsTicTacToe       = { "-p", invaildPorts.ToString() };
            var      mockPrinterOne      = new MockPrinter();
            var      serverMadeTicTacToe = Program.MakeServer(argsTicTacToe, mockPrinterOne);

            Assert.Null(serverMadeTicTacToe);
            mockPrinterOne.VerifyPrint(correctOutput.ToString());
        }
        public void Make_Dirctory_Server_Twice_Same_Port()
        {
            var mockPrinter   = new MockPrinter();
            var correctOutput = new StringBuilder();

            string[] args       = { "-p", "8765" };
            var      serverMade = Program.MakeServer(args, mockPrinter);

            Assert.NotNull(serverMade);

            var serverMadeInvaild = Program.MakeServer(args, mockPrinter);

            Assert.Null(serverMadeInvaild);
            mockPrinter.VerifyPrint("Another Server is running on that port");
        }
        public void Make_Server_Inncorect_NoArgs()
        {
            var mockPrinter   = new MockPrinter();
            var correctOutput = new StringBuilder();

            correctOutput.Append("Invaild Number of Arguments.\n");
            correctOutput.Append("Can only be -p PORT\n");
            correctOutput.Append("Examples:\n");
            correctOutput.Append("Server.exe -p 8080\n");
            correctOutput.Append("Server.exe -p 9999");

            var args       = new[] { "-s" };
            var serverMade = Program.MakeServer(args, mockPrinter);

            Assert.Null(serverMade);
            mockPrinter.VerifyPrint(correctOutput.ToString());
        }