예제 #1
0
        public void AsyncWrite()
        {
            NonAbstractStream s = new NonAbstractStream();

            message = "AsyncWrite";
            reset.Reset();
            IAsyncResult r = s.BeginWrite(null, 0, 0, new AsyncCallback(WriteCallback), s);

            Assert.IsNotNull(r, "IAsyncResult");
            if (!reset.WaitOne(timeout, true))
            {
                Assert.Ignore("Timeout");
            }
            Assert.IsNull(message, message);
        }
예제 #2
0
        private void WriteCallback(IAsyncResult ar)
        {
            NonAbstractStream s = (NonAbstractStream)ar.AsyncState;

            s.EndWrite(ar);
            try {
                // can we do something bad here ?
                Assert.IsNotNull(Environment.GetEnvironmentVariable("USERNAME"));
                message = "Expected a SecurityException";
            }
            catch (SecurityException) {
                message = null;
                reset.Set();
            }
            catch (Exception e) {
                message = e.ToString();
            }
        }
예제 #3
0
파일: StreamCas.cs 프로젝트: nlhepler/mono
		public void AsyncWrite ()
		{
			NonAbstractStream s = new NonAbstractStream ();
			message = "AsyncWrite";
			reset.Reset ();
			IAsyncResult r = s.BeginWrite (null, 0, 0, new AsyncCallback (WriteCallback), s);
			Assert.IsNotNull (r, "IAsyncResult");
			if (!reset.WaitOne (timeout, true))
				Assert.Ignore ("Timeout");
			Assert.IsNull (message, message);
		}