public void ConsoleInputTest() { var mucInStream = new MemoryStream(); var mucOutStream = new MemoryStream(); Console.SetIn(new StreamReader(mucInStream)); Console.SetOut(new StreamWriter(mucOutStream)); var mucOut = new StreamReader(mucOutStream); var mucIn = new StreamWriter(mucInStream); var muc = new MuConsole(1); const string TEST_STR_2 = "Input Test"; mucIn.WriteAndRewind(TEST_STR_2); Assert.AreEqual(TEST_STR_2, muc.ReadLine()); }
static void Main(string[] args) { // Show the launch pages var console = new MuConsole(); var launcher = new Launcher(console, console); var task = launcher.ShowAll(); task.Wait(); // Start the server if desired MuServer srv = null; if (launcher.CreateServer) { srv = MuServer.StartServer(); } // TODO: connect to an existing server and start playing }
public void ConsoleOutputTest() { var mucInStream = new MemoryStream(); var mucOutStream = new MemoryStream(); Console.SetIn(new StreamReader(mucInStream)); Console.SetOut(new StreamWriter(mucOutStream)); var mucOut = new StreamReader(mucOutStream); var mucIn = new StreamWriter(mucInStream); var muc = new MuConsole(1); const string TEST_STR_1 = "Test 1"; muc.ServerSays(TEST_STR_1).Wait(); mucOutStream.Seek(0, SeekOrigin.Begin); var says = mucOut.ReadLine(); Assert.AreEqual(TEST_STR_1, says); }