Inheritance: System.ComponentModel.AsyncCompletedEventArgs
Exemplo n.º 1
0
        internal void UploadDataCompleted(object sender, UploadDataCompletedEventArgsWrapper e)
        {
            string json = null;

            if (e.Error == null && e.Result != null)
            {
                json = Encoding.UTF8.GetString(e.Result, 0, e.Result.Length);
            }

            HttpMethod method;
            var        args = GetApiEventArgs(e, json, out method);

            if (method == HttpMethod.Post)
            {
                OnPostCompleted(args);
            }
            else if (method == HttpMethod.Delete)
            {
                OnDeleteCompleted(args);
            }
            else
            {
                throw new InvalidOperationException();
            }
        }
Exemplo n.º 2
0
        public ThrowsRestApiErrorThen()
        {
            this.facebookClient = new FacebookClient();

            var tempState = new WebClientStateContainer
                                {
                                    Method = this.httpMethod,
                                    RequestUri = new Uri(this.requestUrl),
                                };

            this.uploadDataCompletedEventArgsWrapper =
                new UploadDataCompletedEventArgsWrapper(
                    null, false, tempState, System.Text.Encoding.UTF8.GetBytes(jsonResult));
        }
        public WhichThrowsGraphExceptionThen()
        {
            this.facebookClient = new FacebookClient();

            var tempState = new WebClientStateContainer
            {
                Method = this.httpMethod,
                RequestUri = new Uri(this.requestUrl),
            };

            this.uploadDataCompletedEventArgs =
                new UploadDataCompletedEventArgsWrapper(
                    WebClientFakes.GetFakeWebException(jsonResult), false, tempState, null);
        }