Beispiel #1
0
        public void InvalidConnections()
        {
            using (var server = new DebugServer()) {
                Assert.AreEqual(0, server.Run());
                const int count   = 1000;
                var       threads = new Thread [count];
                try {
                    for (int i = 0; i < count; i++)
                    {
                        threads [i] = new Thread(() => {
                            var client = new TcpClient("localhost", 9000);
                            using (var sw = new StreamWriter(client.GetStream()))
                                sw.Write("\0\0\0\0");
                            client.Close();
                        });
                        threads [i].Start();
                    }

                    foreach (Thread thread in threads)
                    {
                        thread.Join();
                    }
                } catch (WebException e) {
                    Assert.Fail(e.Message);
                }
            }
        }
Beispiel #2
0
        public void ValidConnections()
        {
            using (var server = new DebugServer()) {
                Assert.AreEqual(0, server.Run());
                const int count   = 1000;
                var       threads = new Thread [count];
                try {
                    for (int i = 0; i < count; i++)
                    {
                        threads [i] = new Thread(() => {
                            var wc            = new WebClient();
                            string downloaded = wc.DownloadString("http://localhost:9000/");
                            Assert.AreEqual(Environment.CurrentDirectory, downloaded);
                        });
                        threads [i].Start();
                    }

                    foreach (Thread thread in threads)
                    {
                        thread.Join();
                    }
                } catch (WebException e) {
                    Assert.Fail(e.Message);
                }
            }
        }
Beispiel #3
0
		public void TestCase ()
		{
			using (var server = new DebugServer()) {
				Assert.AreEqual (0, server.Run ());
				var wc = new WebClient ();
				try {
					string downloaded = wc.DownloadString ("http://localhost:9000/");
					Assert.AreEqual (Environment.CurrentDirectory, downloaded);
				} catch (WebException e) {
					Assert.Fail (e.Message);
				}
			}
		}
Beispiel #4
0
 public void TestCase()
 {
     using (var server = new DebugServer()) {
         Assert.AreEqual(0, server.Run());
         var wc = new WebClient();
         try {
             string downloaded = wc.DownloadString("http://localhost:9000/");
             Assert.AreEqual(Environment.CurrentDirectory, downloaded);
         } catch (WebException e) {
             Assert.Fail(e.Message);
         }
     }
 }
Beispiel #5
0
		public void ValidConnections ()
		{
			using (var server = new DebugServer()) {
				Assert.AreEqual (0, server.Run ());
				const int count = 1000;
				var threads = new Thread [count];
				try {
					for (int i = 0; i < count; i++) {
						threads [i] = new Thread (() => {
							var wc = new WebClient ();
							string downloaded = wc.DownloadString ("http://localhost:9000/");
							Assert.AreEqual (Environment.CurrentDirectory, downloaded);
						});
						threads [i].Start ();
					}

					foreach (Thread thread in threads)
						thread.Join ();
				} catch (WebException e) {
					Assert.Fail (e.Message);
				}
			}
		}
Beispiel #6
0
		public void InvalidConnections ()
		{
			using (var server = new DebugServer()) {
				Assert.AreEqual (0, server.Run ());
				const int count = 1000;
				var threads = new Thread [count];
				try {
					for (int i = 0; i < count; i++) {
						threads [i] = new Thread (() => {
							var client = new TcpClient ("localhost", 9000);
							using (var sw = new StreamWriter(client.GetStream()))
								sw.Write ("\0\0\0\0");
							client.Close ();
						});
						threads [i].Start ();
					}

					foreach (Thread thread in threads)
						thread.Join ();
				} catch (WebException e) {
					Assert.Fail (e.Message);
				}
			}
		}