public StubWebRequest()
        {
            this.OnGetContentType = () => this.contentType;
            this.OnSetContentType = value => this.contentType = value;
            this.OnGetHeaders     = () => this.headers = new WebHeaderCollection();
            this.OnSetHeaders     = value => this.headers = value;
            this.OnGetMethod      = () => this.method;
            this.OnSetMethod      = value => this.method = value;
            this.OnGetRequestUri  = () => default(Uri);

            this.OnAbort = () => { };
            this.OnBeginGetRequestStream = (callback, state) => TaskEx.FromResult <object>(null).AsAsyncResult(callback, this);
            this.OnEndGetRequestStream   = asyncResult => this.requestStream = new StubStream();
            this.OnBeginGetResponse      = (callback, state) => TaskEx.FromResult <object>(null).AsAsyncResult(callback, this);
            this.OnEndGetResponse        = asyncResult => this.response = new StubWebResponse();
        }
        public StubWebRequest()
        {
            this.OnGetContentType = () => this.contentType;
            this.OnSetContentType = value => this.contentType = value;
            this.OnGetHeaders = () => this.headers = new WebHeaderCollection();
            this.OnSetHeaders = value => this.headers = value;
            this.OnGetMethod = () => this.method;
            this.OnSetMethod = value => this.method = value;
            this.OnGetRequestUri = () => default(Uri);

            this.OnAbort = () => { };
            this.OnBeginGetRequestStream = (callback, state) => TaskEx.FromResult<object>(null).AsAsyncResult(callback, this);
            this.OnEndGetRequestStream = asyncResult => this.requestStream = new StubStream();
            this.OnBeginGetResponse = (callback, state) => TaskEx.FromResult<object>(null).AsAsyncResult(callback, this);
            this.OnEndGetResponse = asyncResult => this.response = new StubWebResponse();
        }