コード例 #1
0
ファイル: DetailController.cs プロジェクト: dsb92/patientcare
 public DetailController()
 {
     _log = new Logger("PatientCareAdmin : DetailController");
     var client = new HttpClient();
     _handler = new HttpHandler<DetailModel>(client);
     _handler.Uri = "api/detail";
 }
コード例 #2
0
        public void GetCategory_TryingToGetJsonCategoryFromWebservice_JsonObjectReturnedFromWebService()
        {
            // Arrange
            var httpHandler = new HttpHandler();
            string testString = "test";

            try
            {
                
                // Det som modtages fra Web
                // Act
                var categoryJson = httpHandler.GetData(HttpHandler.API.Category);

                var categories = JsonConvert.DeserializeObject<CategoryEntity[]>(categoryJson);

                // Assert
                Assert.IsTrue(ReferenceEquals(categoryJson.GetType(), testString.GetType()));
                Assert.IsTrue(categories.ToList().Count > 0);
                
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
コード例 #3
0
        protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
        {
            _requestFactory = new AWSSDK.UnitTests.HttpHandlerTests.MockHttpRequestFactory();
            var httpHandler = new HttpHandler<Stream>(_requestFactory, this);

            pipeline.ReplaceHandler<HttpHandler<Stream>>(httpHandler);
        }
コード例 #4
0
 public CategoryController()
 {
     _log = new Logger("PatientCareAdmin : CategoryController");
     var client = new HttpClient();
     _handler = new HttpHandler<CategoryModel>(client);
     _handler.Uri = "api/category";
 }
コード例 #5
0
ファイル: CategoryManager.cs プロジェクト: dsb92/patientcare
        /// <summary>
        /// Henter alle Categorier tilknyttet Typer og tilbehør på en afdeling
        /// </summary>
        /// <returns></returns>
        public List<CategoryEntity> GetCategoriesWithAll()
        {

            var httpHandler = new HttpHandler();

            // Det som modtages fra Web
            var categoryJson = httpHandler.GetData(HttpHandler.API.Category);
            var choiceJson = httpHandler.GetData(HttpHandler.API.Choice);

            var categories = JsonConvert.DeserializeObject<CategoryEntity[]>(categoryJson);
            var choices = JsonConvert.DeserializeObject<ChoiceEntity[]>(choiceJson);

            var categoryList = new List<CategoryEntity>();

            foreach (var category in categories)
            {
                var choiceList = new List<ChoiceEntity>();
                var detailList = new List<DetailEntity>();

                foreach (var choice in choices.Where(choice => choice.CategoryId == category.CategoryId))
                {
                    if (choice.Details != null)
                    {
                        foreach (var detail in choice.Details)
                        {
                            // Tjek hvis en detail har den samme choice.
                            var detailWithSameChoiceList = (from detailWithSameChoice in choice.Details where detailWithSameChoice.DetailId == detail.DetailId select choice).ToList();

                            // Hvis en detail har mere end en choice tilknyttet.
                            detail.Choices = detailWithSameChoiceList.Count > 1 ? detailWithSameChoiceList : new List<ChoiceEntity> { choice };

                            //detail.Choices = new List<ChoiceEntity>(choices);
                            detailList.Add(detail);
                        }
                    }
                    

                    if (detailList.Count > 0)
                    {
                        choice.Details = detailList;
                    }

                    choiceList.Add(choice);

                    detailList = new List<DetailEntity>();
                }

                // Hvis pågældende kategori har nogle choices tilføj til dens liste.
                if (choiceList.Count > 0)
                {
                    category.Choices = choiceList;
                }

                categoryList.Add(category);
            }


            return categoryList;
        }
コード例 #6
0
ファイル: CallManager.cs プロジェクト: dsb92/patientcare
        /// <summary>
        /// Omdanner et kald til Json og opdater kaldet til Web API.
        /// </summary>
        /// <param name="request"></param>
        /// <param name="data"></param>
        public void PutCall(string content)
        {
            var httpHandler = new HttpHandler();

            StringContent httpContent = new StringContent(content, Encoding.UTF8, "application/json");

            httpHandler.PutData(httpContent, HttpHandler.API.Call);
        }
コード例 #7
0
        public void DoWork()
        {
            IPEndPoint clientEP = new IPEndPoint(IPAddress.Any, ServerPort);

            while (true)
            {
                Console.Write("Waiting for message: ");
                OnReceivedHandler("Listening on port:" + ServerPort.ToString());

                byte[] bytes = new byte[4096];

                try
                {
                    if (receiveSocket != null)
                    {
                        bytes = receiveSocket.Receive(ref clientEP);
                        string received = Encoding.ASCII.GetString(bytes, 0, bytes.Length);
                        OnReceivedFromHandler(clientEP, received);
                        OnReceivedHandler(received);

                    }
                    else
                    {
                        tcpListener.Start();
                        TcpClient client = tcpListener.AcceptTcpClient();
                        HttpHandler httpHandler = new HttpHandler(client, this);
                        httpHandler.OnReceived = this.OnReceived;
                        httpHandler.body = "<html><head><title>custom response</title></head><body><b>sooooo</b></body></html>";
                        Thread thread = new Thread(new ThreadStart(httpHandler.Process));
                        thread.Start();
                        Thread.Sleep(1);
                        //ns = client.GetStream();
                        //while((bytesRead = ns.Read(bytes, 0, bytes.Length)) > 0)
                        //{
                        //    OnReceivedHandler(Encoding.ASCII.GetString(bytes, 0, bytes.Length));
                        //}
                        //if (ns.CanWrite)
                        //{
                        //    string body =
                        //    using (System.IO.StreamWriter sw = new System.IO.StreamWriter(ns))
                        //    {
                        //        sw.Write(DefaultResponse(body.Length));
                        //        sw.WriteLine(body);
                        //        sw.Flush();
                        //    }
                        //}
                        //client.Close();
                    }
                }
                catch (Exception ex)
                {
                    Console.Write("Exception.message: " + ex.Message);
                    //throw;
                }

                //receiveSocket.Send(bytes, bytes.Length);
            }
        }
コード例 #8
0
ファイル: ChoiceController.cs プロジェクト: dsb92/patientcare
 public ChoiceController()
 {
     _log = new Logger("PatientCareAdmin : ChoiceController");
     var client = new HttpClient();
     _handler = new HttpHandler<ChoiceModel>(client);
     _handler.Uri = "api/choice";
     _categories = GetCategories();
     _details = GetDetails();
 }
コード例 #9
0
ファイル: HttpHandlerTest.cs プロジェクト: dsb92/patientcare
        public void HttpHandlerGet_GetSingleCallById_ReturnsSingleCallModel()
        {
            var client = new HttpClient();
            
            var httpHandler = new HttpHandler<CallModel>(client);
            httpHandler.Uri = "api/call";

            var singleCall = httpHandler.Get("563c930402a93d01d0d8506c");

            Assert.AreEqual(singleCall.GetType(), typeof(CallModel));
        }
コード例 #10
0
ファイル: HttpHandlerTest.cs プロジェクト: dsb92/patientcare
        public void TestGetAsync()
        {
            var client = new HttpClient();

            var httpHandler = new HttpHandler<CallModel>(client);
            httpHandler.Uri = "api/call";

            var returnedFromRequest = httpHandler.Get();

            Assert.IsNotNull(returnedFromRequest);
        }
コード例 #11
0
ファイル: LoginManager.cs プロジェクト: dsb92/patientcare
        /// <summary>
        /// Tjekker om det valide CPR nummer findes i databasen, hvor vi antager at hvis det gør, så er patienten indlagt
        /// </summary>
        /// <param name="userCpr"></param>
        /// <returns>Returner CPR-nummer fra server</returns>
        public String GetPatient(string userCpr)
        {
            var httpHandler = new HttpHandler();

            var patientJson = httpHandler.GetData(HttpHandler.API.Patient, userCpr);

            Dictionary<string, string> jsonDictionary = JsonConvert.DeserializeObject<Dictionary<string, string>>(patientJson);

            var patientCpr = jsonDictionary["PatientCPR"];

            return patientCpr;
        }
コード例 #12
0
ファイル: CallManager.cs プロジェクト: dsb92/patientcare
        /// <summary>
        /// Henter alle kald fra Web API som en Patient har foretaget
        /// </summary>
        /// <returns>Returnere en Liste af kald.</returns>
        public String GetStatusCall(CallEntity callEntity)
        {
            var httpHandler = new HttpHandler();

            var callJson = httpHandler.GetData(HttpHandler.API.Call, callEntity._id);

            var json = JsonConvert.DeserializeObject(callJson);

            Dictionary<string, string> jsonDictionary = JsonConvert.DeserializeObject<Dictionary<string, string>>(json as string);

            var callStatus = jsonDictionary["Status"];

            return callStatus;
        }
コード例 #13
0
        public static void SetResponse(
            AmazonServiceClient client,
            Func<HttpHandlerTests.MockHttpRequest, HttpWebResponse> responseCreator)
        {
            var pipeline = client
                .GetType()
                .GetProperty("RuntimePipeline", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)
                .GetValue(client, null)
                as RuntimePipeline;

            var requestFactory = new HttpHandlerTests.MockHttpRequestFactory();
            requestFactory.ResponseCreator = responseCreator;
            var httpHandler = new HttpHandler<Stream>(requestFactory, client);
            pipeline.ReplaceHandler<HttpHandler<Stream>>(httpHandler);
        }
コード例 #14
0
        public void GetCategoryChoice_TryingToGetJsonCategoryChoiceFromWebservice_JsonObjectReturnedFromWebService()
        {
            // Arrange
            var httpHandler = new HttpHandler();
            var testString = "test";

            try
            {
                
                // Det som modtages fra Web
                // Act
                var categoryJson = httpHandler.GetData(HttpHandler.API.Category);
                var choiceJson = httpHandler.GetData(HttpHandler.API.Choice);
                

                var categories = JsonConvert.DeserializeObject<CategoryEntity[]>(categoryJson);
                var choices = JsonConvert.DeserializeObject<ChoiceEntity[]>(choiceJson);

                
                var categoryList = new List<CategoryEntity>();
                foreach (var category in categories)
                {
                    var choiceList = choices.Where(choice => choice.CategoryId == category.CategoryId).ToList();

                    // Hvis pågældende kategori har nogle choices tilføj til dens liste.
                    if (choiceList.Count > 0)
                    {
                        category.Choices = choiceList;
                    }

                    categoryList.Add(category);
                }


                // Assert
                Assert.IsTrue(ReferenceEquals(categoryJson.GetType(), testString.GetType()));
                Assert.IsTrue(ReferenceEquals(choiceJson.GetType(), testString.GetType()));
                Assert.IsTrue(categoryList.Count > 0);
          
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
コード例 #15
0
ファイル: HttpHandlerTest.cs プロジェクト: dsb92/patientcare
        public void TestPostAsync()
        {
            var client = new HttpClient();

            var httpHandler = new HttpHandler<CallModel>(client);
            httpHandler.Uri = "api/call";

            var newCall = new CallModel()
            {
                PatientCPR = "123456-1234",
                Category = "Hvad er en constructor?",
                Choice = "Urhauer",
                Detail = "Din mor",
                CreatedOn = DateTime.Now.ToString("F")
            };

            var json = JsonConvert.SerializeObject(newCall);

            var result = httpHandler.Post(json);

            Assert.AreEqual(201,result.StatusCode);
        }
コード例 #16
0
        public void TestErrorCall()
        {
            var factory = new MockHttpRequestFactory
            {
                GetResponseAction = () => { throw new IOException(); }
            };
            var httpHandler      = new HttpHandler <Stream>(factory, callbackSender);
            var runtimePipeline  = new RuntimePipeline(httpHandler);
            var executionContext = CreateExecutionContextForListBuckets();

            Utils.AssertExceptionExpected(() =>
            {
                httpHandler.InvokeSync(executionContext);
            }, typeof(IOException));

            var httpRequest = factory.LastCreatedRequest;

            Assert.AreEqual("GET", httpRequest.Method);
            Assert.IsTrue(httpRequest.IsConfigureRequestCalled);
            Assert.IsTrue(httpRequest.IsSetRequestHeadersCalled);
            Assert.IsTrue(httpRequest.IsDisposed);
            Assert.IsTrue(httpRequest.IsAborted);
        }
コード例 #17
0
        public async Task ProcessRequestAsync()
        {
            string httpRequest = await this.ReadRequest();

            if (httpRequest != null)
            {
                IHttpContext httpContext = new HttpContext(httpRequest);


                var httpResponse = new HttpHandler(this.serverRouteConfig).Handle(httpContext);

                ArraySegment <byte> toBytes = new ArraySegment <byte>(Encoding.UTF8.GetBytes(httpResponse.ToString()));

                await this.client.SendAsync(toBytes, SocketFlags.None);

                Console.WriteLine($"--REQUEST---");
                Console.WriteLine(httpRequest);
                Console.WriteLine($"--RESPONSE---");
                Console.WriteLine(httpResponse);
            }

            this.client.Shutdown(SocketShutdown.Both);
        }
コード例 #18
0
        public void GetCategory_TryingToGetJsonCategoryFromWebservice_JsonObjectReturnedFromWebService()
        {
            // Arrange
            var    httpHandler = new HttpHandler();
            string testString  = "test";

            try
            {
                // Det som modtages fra Web
                // Act
                var categoryJson = httpHandler.GetData(HttpHandler.API.Category);

                var categories = JsonConvert.DeserializeObject <CategoryEntity[]>(categoryJson);

                // Assert
                Assert.IsTrue(ReferenceEquals(categoryJson.GetType(), testString.GetType()));
                Assert.IsTrue(categories.ToList().Count > 0);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
コード例 #19
0
        public async Task TestErrorAsyncCall()
        {
            var factory = new MockHttpRequestMessageFactory
            {
                GetResponseAction = () => { throw new IOException(); }
            };
            var httpHandler      = new HttpHandler <HttpContent>(factory, callbackSender);
            var runtimePipeline  = new RuntimePipeline(httpHandler);
            var executionContext = CreateExecutionContextForListBuckets();

            await Utils.AssertExceptionExpectedAsync(() =>
            {
                return(httpHandler.InvokeAsync <AmazonWebServiceResponse>(executionContext));
            }, typeof(IOException));

            var httpRequest = factory.LastCreatedRequest;

            Assert.AreEqual("GET", httpRequest.Method);
            Assert.IsTrue(httpRequest.IsConfigureRequestCalled);
            Assert.IsTrue(httpRequest.IsSetRequestHeadersCalled);
            Assert.IsTrue(httpRequest.IsDisposed);
            Assert.IsTrue(httpRequest.IsAborted);
        }
コード例 #20
0
        public async Task ProccessRequestAsync()
        {
            var request = await this.ReadRequest();

            if (request != null)
            {
                var httpContext = new HttpContext(request);

                IHttpResponse response = new HttpHandler(this.serverRouteConfig).Handle(httpContext);

                ArraySegment <byte> toBytes = new ArraySegment <byte>(Encoding.UTF8.GetBytes(response.ToString()));

                await this.client.SendAsync(toBytes, SocketFlags.None);

                Console.WriteLine("===Request===");
                Console.WriteLine(request);
                Console.WriteLine();
                Console.WriteLine("===Response===");
                Console.WriteLine(response.ToString());
            }

            this.client.Shutdown(SocketShutdown.Both);
        }
コード例 #21
0
        public bool Save(string username, string password, string fname, string lname, string mname, string email)
        {
            bool result = false;

            try
            {
                var temp = HttpHandler.UpdateUser(username, fname, lname, mname, "", password, email, "");
                try
                {
                    result = Convert.ToBoolean(temp);
                }
                catch
                {
                    result = false;
                }
            }
            catch
            {
                result = false;
            }

            return(result);
        }
コード例 #22
0
        public void TestSuccessfulAsyncCall()
        {
            var factory         = new MockHttpRequestFactory();
            var httpHandler     = new HttpHandler <Stream>(factory, callbackSender);
            var runtimePipeline = new RuntimePipeline(httpHandler);

            var listBucketsRequest = new ListBucketsRequest();
            var executionContext   = CreateAsyncExecutionContextForListBuckets();

            var asyncResult = httpHandler.InvokeAsync(executionContext);

            asyncResult.AsyncWaitHandle.WaitOne();

            Assert.IsNull(executionContext.ResponseContext.AsyncResult.Exception);
            Assert.IsNotNull(executionContext.ResponseContext.HttpResponse);
            var httpRequest = factory.LastCreatedRequest;

            Assert.AreEqual("GET", httpRequest.Method);
            Assert.IsTrue(httpRequest.IsConfigureRequestCalled);
            Assert.IsTrue(httpRequest.IsSetRequestHeadersCalled);
            Assert.IsTrue(httpRequest.IsDisposed);
            Assert.IsFalse(httpRequest.IsAborted);
        }
コード例 #23
0
        private string[] method_7(HttpHandler httpHandler_1, ref string string_6)
        {
            if (this.bool_0)
            {
                CaptchaDialog captchaDialog = new CaptchaDialog(httpHandler_1, ref string_6, true);
                string[]      ans           = captchaDialog.ans;
                Console.Write(ans);
                captchaDialog.Dispose();
                return(ans);
            }
            CaptchaDialog captchaDialog2 = new CaptchaDialog(httpHandler_1, ref string_6, false);

            string[] array = new string[]
            {
                ""
            };
            if (captchaDialog2.ShowDialog() == DialogResult.OK)
            {
                array[0] = captchaDialog2.txtCaptcha.Text;
            }
            captchaDialog2.Dispose();
            return(array);
        }
コード例 #24
0
        internal PictureModel GetImageDetail(string token, PictureModel input)
        {
            PictureModel output = null;

            try
            {
                HttpHandler http = new HttpHandler();
                output    = new PictureModel();
                output.Id = input.Id;
                output.Cropped_picture = input.Cropped_picture;

                dynamic respImage = http.Get(Config.Url + "/images/" + input.Id, AuthorizationType.Bearer, token, ResultType.JsonObj);

                if (respImage == null || respImage.id == null)
                {
                    throw new Exception("Error getting image data");
                }

                if (respImage.author != null)
                {
                    output.Author = Convert.ToString(respImage.author);
                }
                if (respImage.camera != null)
                {
                    output.Camera = Convert.ToString(respImage.camera);
                }
                if (respImage.tags != null)
                {
                    output.Tags = Convert.ToString(respImage.tags);
                }
            }
            catch (Exception)
            {
            }

            return(output);
        }
コード例 #25
0
ファイル: FrohgameSession.cs プロジェクト: cannap/Frohgame
        /// <summary>
        /// Versucht sich einzuloggen
        /// </summary>
        public void Login()
        {
            Logger.Log(LoggingCategories.NavigationAction, "Login");
            //Zur Ogame Startseite navigieren
            Logger.Log(LoggingCategories.NavigationAction, "Navigate to Startpage");

            HttpHandler.Get(_stringManager.StartUrl);

            //Logindaten senden^^
            Logger.Log(LoggingCategories.NavigationAction, "Sending Login Data");
            this._lastResult = HttpHandler.Post(_stringManager.LoginUrl, _stringManager.LoginParameter);

            //Nach Logout Link suchen... falls vorhanden => login war erfolgreich, sonst nicht
            if (!Regex.IsMatch(LastResult.ResponseContent, _stringManager.LogoutRegex))
            {
                throw new LoginFailedException("Login failed (LogoutRegex) not found");
            }

            Logger.Log(LoggingCategories.NavigationAction, "Login was successfull");

            //@CANNAP: DEIN PLANET AUSLESEN KRAM HAT BEI MIR GECRASHT

            //Todo Prüfen ob ein Gebäude im Bau ist
        }
コード例 #26
0
        private string[] ShowCaptchaDialog(HttpHandler httpHandler, ref string _status, bool _auto, bool usetwocap = false)
        {
            if (_auto)
            {
                var      captchaDialog1 = new CaptchaDialog(httpHandler, ref _status, true, usetwocap);
                string[] captcha        = captchaDialog1.ans;

                Console.Write(captcha);
                captchaDialog1.Dispose();
                return(captcha);
            }
            else
            {
                var      captchaDialog = new CaptchaDialog(httpHandler, ref _status);
                string[] captcha       = { "" };

                if (captchaDialog.ShowDialog() == DialogResult.OK)
                {
                    captcha[0] = captchaDialog.txtCaptcha.Text;
                }
                captchaDialog.Dispose();
                return(captcha);
            }
        }
コード例 #27
0
        public static async Task StartIngestion(TraceWriter log)
        {
            //Save your workspaceid and workspacekey in KeyVault
            workspaceid  = CryptoHelper.GetKeyVaultSecret("omsworkspaceid");
            workspacekey = CryptoHelper.GetKeyVaultSecret("omsworkspacekey");
            if (string.IsNullOrEmpty(workspaceid))
            {
                log.Info($"OmsWorkspaceId is empty. Cannot proceed further");
                return;
            }

            if (string.IsNullOrEmpty(workspacekey))
            {
                log.Info($"omsworkspacekey is empty. Cannot proceed further");
                return;
            }

            log.Info("Sending logs to OMS");
            var        oms    = new OMSIngestionApi(workspaceid, workspacekey, log);
            HttpClient client = HttpHandler.BuildClient();
            int        count  = await ProcessQuery(oms, client, GetUsageQueryUrl(log), log);

            log.Info($"Finished processing files");
        }
コード例 #28
0
        public void TestErrorAsyncCall()
        {
            var factory = new MockHttpRequestFactory
            {
                GetResponseAction = () => { throw new IOException(); }
            };
            var httpHandler      = new HttpHandler <Stream>(factory, callbackSender);
            var runtimePipeline  = new RuntimePipeline(httpHandler);
            var executionContext = CreateAsyncExecutionContextForListBuckets();

            var asyncResult = httpHandler.InvokeAsync(executionContext);

            asyncResult.AsyncWaitHandle.WaitOne();

            Assert.IsNotNull(executionContext.ResponseContext.AsyncResult.Exception);
            Assert.IsInstanceOfType(executionContext.ResponseContext.AsyncResult.Exception, typeof(IOException));

            var httpRequest = factory.LastCreatedRequest;

            Assert.AreEqual("GET", httpRequest.Method);
            Assert.IsTrue(httpRequest.IsConfigureRequestCalled);
            Assert.IsTrue(httpRequest.IsSetRequestHeadersCalled);
            Assert.IsTrue(httpRequest.IsDisposed);
        }
コード例 #29
0
        //for deleting equipment type from table
        public static bool DeleteEquipmentType(string id)
        {
            bool result = false;

            try
            {
                string query = "delete tblEquipmentType where ID=" + id;
                result = DBModel.ExecuteCustomQuery(query);

                if (result == true)
                {
                    string[] computer_name = Dns.GetHostEntry(HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]).HostName.Split(new Char[] { '.' });
                    string   HostName      = computer_name[0].ToString().ToUpper();
                    string   IP            = HttpHandler.GetIPAddress();
                    AuditModel.AddLog("Machine Type", "Deleted Machine Type - ID: " + id, HostName, IP, HttpContext.Current.Session["Username"].ToString());
                }
            }
            catch
            {
                result = false;
            }

            return(result);
        }
コード例 #30
0
        public static bool UpdateEnrollment(string ID, string username, string groupID, string host)
        {
            bool result = false;

            try
            {
                string query = "Update tblGroupEnrollment set GroupID=" + groupID + ",UserID='" + username + "',HostID='" + host + "' where ID=" + ID.ToString();
                result = DBModel.ExecuteCustomQuery(query);

                if (result == true)
                {
                    string[] computer_name = Dns.GetHostEntry(HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]).HostName.Split(new Char[] { '.' });
                    string   HostName      = computer_name[0].ToString().ToUpper();
                    string   IP            = HttpHandler.GetIPAddress();
                    AuditModel.AddLog("Group Enrollment", "Updated Group Enrollment - ID: " + ID, HostName, IP, HttpContext.Current.Session["Username"].ToString());
                }
            }
            catch
            {
                result = false;
            }

            return(result);
        }
コード例 #31
0
        public void GetData_CheckGetAsyncIsCalled_ReturnsString()
        {
            // Arrange/Setup

            // Content = new StringContent(SerializedString, System.Text.Encoding.UTF8, "application/json")
            var response = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent("Content here 123")
            };
            var moqHttp = new Mock <HTTPRequests.IHttpClientHandler>();

            moqHttp.Setup(HttpHandler => HttpHandler.GetAsync(It.IsAny <string>()))
            .Returns(() => Task.FromResult(response));
            var req = new Requests(moqHttp.Object);
            var url = "testurl";

            // Act
            var todo = req.GetData(url);

            Console.WriteLine(todo.Result);

            //
            Assert.Equal("Content here 123", todo.Result);
        }
コード例 #32
0
        public async Task ProcessRequestAsync()
        {
            var httpRequest = await this.ReadRequest();

            if (!string.IsNullOrEmpty(httpRequest))
            {
                var httpContext  = new HttpContext(new HttpRequest(httpRequest));
                var httpHandler  = new HttpHandler(this.serverRouteConfig);
                var httpResponse = httpHandler.Handle(httpContext);

                var responseBytes = Encoding.UTF8.GetBytes(httpResponse.ToString());
                var byteSegments  = new ArraySegment <byte>(responseBytes);

                await this.client.SendAsync(byteSegments, SocketFlags.None);

                Console.WriteLine("-----REQUEST-----");
                Console.WriteLine(httpRequest);
                Console.WriteLine("-----RESPONSE-----");
                Console.WriteLine(httpResponse);
                Console.WriteLine();
            }

            this.client.Shutdown(SocketShutdown.Both);
        }
コード例 #33
0
        public List <VenueDTO> Explore(int limit, string query, double lat, double lng)
        {
            FoursquareResponse response;
            var httpResponse        = HttpHandler.GetHttpResponse(url + $"&limit={limit}&ll={lat},{lng}&query={query}");
            var httpResponseContent = httpResponse.Content.ReadAsStringAsync().Result;

            response = JsonConvert.DeserializeObject <FoursquareResponse> (httpResponseContent);
            var venues = new List <VenueDTO> ();

            foreach (var v in response.Response.Groups[0].Items)
            {
                var venueDTO = new VenueDTO {
                    Name    = v.Venue.Name,
                    Lat     = v.Venue.Location.Lat,
                    Lng     = v.Venue.Location.Lng,
                    Phone   = v.Venue.Contact.FormattedPhone,
                    Rating  = v.Venue.Rating,
                    Address = v.Venue.Location.Address,
                    Country = v.Venue.Location.Country,
                    State   = v.Venue.Location.State,
                    City    = v.Venue.Location.City,
                };
                foreach (var t in v.Tips)
                {
                    var userDTO = new UserDTO {
                        Name  = t.User.FirstName + " " + t.User.LastName,
                        Photo = t.User.Photo.Prefix + Resources.SIZE_IMAGE_USER + t.User.Photo.Suffix
                    };
                    venueDTO.Comments.Add(new CommentDTO {
                        User = userDTO, Text = t.Text
                    });
                }
                venues.Add(venueDTO);
            }
            return(venues);
        }
コード例 #34
0
    public IEnumerator GetData(string url, HttpHandler handler, bool initialize = false)
    {
        while (locked || (!initializedFlag && !initialize))
        {
            yield return(null);
        }

        locked = true;
        UnityEngine.Debug.Log(url);
        url = baseUrl + url;
        using (UnityEngine.WWW www = new UnityEngine.WWW(url, null, headers)) {
            yield return(www);

            UnityEngine.Debug.Log(www.text);
            try {
                string text = www.text;
                handler(text);
            } catch (Exception e) {
                OnError(e);
            }
        }
        locked = false;
        yield return(null);
    }
コード例 #35
0
        public void GetData_CheckGetAsyncIsCalled_ReturnsJSON()
        {
            // Arrange/Setup
            var mockJson    = "{\"GroupId\":1,\"Samples\":[{\"SampleId\":1},{\"SampleId\":2}]}";
            var JSONContent = new StringContent(mockJson, System.Text.Encoding.UTF8, "application/json");
            var response    = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = JSONContent
            };
            var moqHttp = new Mock <HTTPRequests.IHttpClientHandler>();

            moqHttp.Setup(HttpHandler => HttpHandler.GetAsync(It.IsAny <string>()))
            .Returns(() => Task.FromResult(response));
            var req = new Requests(moqHttp.Object);
            var url = "testurl";

            // Act
            var todo = req.GetData(url);

            Console.WriteLine(todo.Result);

            // Assert
            Assert.Equal(mockJson, todo.Result);
        }
コード例 #36
0
        public HandlerTests()
        {
            var log           = new ConsoleLog();
            var metricScope   = Substitute.For <IMetricScope>();
            var airlockClient = Substitute.For <IAirlockClient>();

            VostokHostingEnvironment.Current = new VostokHostingEnvironment()
            {
                Environment   = "dev",
                Log           = log,
                AirlockClient = airlockClient,
                MetricScope   = metricScope
            };
            airlockClient.When(c => c.Push(Arg.Any <string>(), Arg.Any <LogEventData>(), Arg.Any <DateTimeOffset?>())).Do(
                x =>
            {
                routingKey   = x.Arg <string>();
                logEventData = x.Arg <LogEventData>();
                log.Debug(logEventData.ToPrettyJson());
            });
            httpHandler = new HttpHandler(new FrontierSetings {
                SourceMapBlacklist = new [] { "diadoc.kontur.ru" }
            }, metricScope, log, airlockClient);
        }
コード例 #37
0
        /// <summary>
        /// 发送消息
        /// </summary>
        /// <returns></returns>
        public async Task <dynamic> SendMessage(string content, string user)
        {
            var users = await GetOrgUserFromCache();

            if (!users.Contains(user))
            {
                return(null);
            }
            var token = await GetTokenFromCache();

            string url    = $"https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token={token}";
            var    result = HttpHandler.PostJson <JObject>(url, JsonConvert.SerializeObject(new
            {
                touser  = user,
                msgtype = "text",
                agentid = 1000002,
                text    = new
                {
                    content = content
                }
            }));

            return(result);
        }
コード例 #38
0
        public async Task ProcessRequestAsync()
        {
            string request = await _ReadRequest();

            if (request != string.Empty)
            {
                var httpContext = new HttpContext(request);
                var httpHandler = new HttpHandler(_serverRouteConfig);

                IHttpResponse response = httpHandler.Handle(httpContext);

                var byteSegments = new ArraySegment <byte>(Encoding.ASCII.GetBytes(response.Response));

                await _client.SendAsync(byteSegments, SocketFlags.None);

                Console.WriteLine($"-----REQUEST-----");
                Console.WriteLine(request);
                Console.WriteLine($"-----RESPONSE-----");
                Console.WriteLine(response);
                Console.WriteLine();
            }

            _client.Shutdown(SocketShutdown.Both);
        }
コード例 #39
0
        private void BuildRuntimePipeline()
        {
            HttpHandler <string> httpHandler = null;

            httpHandler = ((AWSConfigs.HttpClient != 0) ? new HttpHandler <string>(new UnityWebRequestFactory(), this) : new HttpHandler <string>(new UnityWwwRequestFactory(), this));
            CallbackHandler callbackHandler = new CallbackHandler();

            callbackHandler.OnPreInvoke = ProcessPreRequestHandlers;
            CallbackHandler callbackHandler2 = new CallbackHandler();

            callbackHandler2.OnPreInvoke = ProcessRequestHandlers;
            CallbackHandler callbackHandler3 = new CallbackHandler();

            callbackHandler3.OnPostInvoke = ProcessResponseHandlers;
            ErrorCallbackHandler errorCallbackHandler = new ErrorCallbackHandler();

            errorCallbackHandler.OnError = ProcessExceptionHandlers;
            RuntimePipeline = new RuntimePipeline(new List <IPipelineHandler>
            {
                httpHandler,
                new Unmarshaller(SupportResponseLogging),
                new ErrorHandler(_logger),
                callbackHandler3,
                new Signer(),
                new CredentialsRetriever(Credentials),
                new RetryHandler(new DefaultRetryPolicy(Config)),
                callbackHandler2,
                new EndpointResolver(),
                new Marshaller(),
                callbackHandler,
                errorCallbackHandler,
                new MetricsHandler(),
                new ThreadPoolExecutionHandler(10)
            }, _logger);
            CustomizeRuntimePipeline(RuntimePipeline);
        }
コード例 #40
0
        private void BuildRuntimePipeline()
        {
#if BCL || BCL45
            var httpRequestFactory = new HttpWebRequestFactory(new AmazonSecurityProtocolManager());
            var httpHandler        = new HttpHandler <Stream>(httpRequestFactory, this);
#elif UNITY
            IHttpRequestFactory <string> httpRequestFactory = null;
            HttpHandler <string>         httpHandler        = null;

            if (AWSConfigs.HttpClient == AWSConfigs.HttpClientOption.UnityWWW)
            {
                httpRequestFactory = new UnityWwwRequestFactory();
                httpHandler        = new HttpHandler <string>(httpRequestFactory, this);
            }
            else
            {
                httpRequestFactory = new UnityWebRequestFactory();
                httpHandler        = new HttpHandler <string>(httpRequestFactory, this);
            }
#else
            var httpRequestFactory = new HttpRequestMessageFactory(this.Config);
            var httpHandler        = new HttpHandler <System.Net.Http.HttpContent>(httpRequestFactory, this);
#endif
            var preMarshallHandler = new CallbackHandler();
            preMarshallHandler.OnPreInvoke = this.ProcessPreRequestHandlers;

            var postMarshallHandler = new CallbackHandler();
            postMarshallHandler.OnPreInvoke = this.ProcessRequestHandlers;

            var postUnmarshallHandler = new CallbackHandler();
            postUnmarshallHandler.OnPostInvoke = this.ProcessResponseHandlers;

            var errorCallbackHandler = new ErrorCallbackHandler();
            errorCallbackHandler.OnError = this.ProcessExceptionHandlers;

            // Build default runtime pipeline.
            this.RuntimePipeline = new RuntimePipeline(new List <IPipelineHandler>
            {
                httpHandler,
                new Unmarshaller(this.SupportResponseLogging),
                new ErrorHandler(_logger),
                postUnmarshallHandler,
                new Signer(),
                new CredentialsRetriever(this.Credentials),
                new RetryHandler(new DefaultRetryPolicy(this.Config)),
                postMarshallHandler,
                new EndpointResolver(),
                new Marshaller(),
                preMarshallHandler,
                errorCallbackHandler,
                new MetricsHandler()
#if UNITY
                , new ThreadPoolExecutionHandler(10)   //remove the hardcoded to unity config
#endif
            },
                                                       _logger
                                                       );

#if BCL || CORECLR
            if (DeterminedCSMConfiguration.Instance.CSMConfiguration.Enabled && !string.IsNullOrEmpty(ServiceMetadata.ServiceId))
            {
                this.RuntimePipeline.AddHandlerBefore <ErrorHandler>(new CSMCallAttemptHandler());
                this.RuntimePipeline.AddHandlerBefore <MetricsHandler>(new CSMCallEventHandler());
            }
#endif

            CustomizeRuntimePipeline(this.RuntimePipeline);

            // Apply global pipeline customizations
            RuntimePipelineCustomizerRegistry.Instance.ApplyCustomizations(this.GetType(), this.RuntimePipeline);
        }
コード例 #41
0
        public async Task GetHttpRequest(string url)
        {
            var allPosts = await HttpHandler.CallAsync <IEnumerable <PostPreviewDto> >(HttpHandler.CreateHttpRequestMessage(HttpMethod.Get, url));

            allPosts.Should().NotBeNull();
        }
コード例 #42
0
 /// <summary>
 /// Disposes of the resources used by RestClient.
 /// </summary>
 public void Dispose()
 {
     HttpHandler.Dispose();
     _client.Dispose();
 }
コード例 #43
0
        public ActionResult Index()
        {
            //Check cookie and session variables for retaining login status
            //if true go to page, else return to login page
            if (HttpHandler.CheckSession())
            {
                string username       = Session["Username"].ToString();
                string userType       = UserModels.GetUserType(username);
                string thumbnailPhoto = UserModels.GetThumbnailPhoto(username);
                try
                {
                    HttpContext.Session.Add("ThumbnailPhoto", thumbnailPhoto);
                    HttpContext.Session.Add("Name", Request.Cookies["Name"].Value.ToString());
                    HttpContext.Session.Add("Position", Request.Cookies["Position"].Value.ToString());
                    HttpContext.Session.Add("EmployeeNumber", Request.Cookies["EmployeeNumber"].Value.ToString());
                }
                catch { }

                //get the module
                var modName = "User";
                var module  = ModuleModels.getModule(modName);

                ViewBag.Title = "Cell Controller";

                bool check = false;

                if (module != null)
                {
                    //generate the menus
                    ViewBag.Menu        = custom_helper.GenerateMenu(module.Id, module.ParentId, userType);
                    ViewBag.PageHeader  = module.ParentName + " / " + module.Name;
                    ViewBag.Breadcrumbs = module.Name;

                    check = true;
                }
                else
                {
                    check = false;
                }

                //check access for module, if no access redirect to error page
                if (ModuleModels.checkAccessForURL(userType, module.Id) && check)
                {
                    try
                    {
                        Session.Remove("ModuleErrorHeader");
                        Session.Remove("ModuleErrorBreadCrumbs");
                    }
                    catch { }
                    return(View());
                }
                else
                {
                    Session.Add("ModuleErrorHeader", ViewBag.PageHeader);
                    Session.Add("ModuleErrorBreadCrumbs", ViewBag.Breadcrumbs);
                    return(RedirectToAction("Index", "Error"));
                }
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
コード例 #44
0
 public void Initialize(HttpHandler handler)
 {
     this.httpHandler = handler;
 }
コード例 #45
0
ファイル: TaskManager.cs プロジェクト: dsb92/patientcare
 public TaskManager()
 {
     _httpHandler = new HttpHandler();
 }
コード例 #46
0
ファイル: ChoiceController.cs プロジェクト: dsb92/patientcare
        private List<CategoryModel> GetCategories()
        {
            var client = new HttpClient();
            var handler = new HttpHandler<CategoryModel>(client);
            handler.Uri = "api/category";
            var categories = handler.Get();

            var List = new List<CategoryModel>();

            List.Add(new CategoryModel()
            {
                CategoryId = "000000",
                Name = "Ingen kategori valgt"
            });
            
            if (categories != null)
            {
                if (categories.Count > 0)
                {
                    foreach (var item in categories)
                    {
                        List.Add(new CategoryModel()
                        {
                            CategoryId = item.CategoryId,
                            Name = item.Name
                        });
                    }
                }
            }
            else
            {
                List.Add(new CategoryModel()
                {
                    CategoryId = "00000",
                    Name = "Ingen kategorier fundet"
                });
            }

            return List;
        }
コード例 #47
0
        private async void btCreateRG_Click(object sender, EventArgs e)
        {
            try
            {
                this.pbBusyStatue.Visible = true;
                this.lbMessage.Text = "Creating Resource Group ...";
                var subscriptionId = cbSubscription.SelectedValue as string;

                //put "https://management.azure.com/subscriptions/{subscription-id}/resourcegroups/{resource-group-name}?api-version=2015-01-01"
                var path = @"/subscriptions/"+subscriptionId+@"/resourcegroups/"+tbRGName.Text+@"?api-version=2015-01-01";
                Uri uri = AuthUtils.EnsureAbsoluteUri(path, this._authHelper);
                var cacheInfo = await this._authHelper.GetToken(subscriptionId);
                var handler = new HttpHandler(new HttpClientHandler(), ConfigSettingFactory.ConfigSettings.Verbose);
                HttpContent payload = new StringContent("{\"location\": \""+this.cbRGLocation.SelectedItem+"\"}", Encoding.UTF8, Constants.JsonContentType);
                await AuthUtils.HttpInvoke(uri, cacheInfo, "put", handler, payload);
            }
            catch(Exception ex)
            {
                MessageBox.Show("Failed.");
                return;
            }
            this.gbCreateWebApp.Enabled = true;
            this.pbBusyStatue.Visible = false;
            this.lbMessage.Text = "Done!";
        }
コード例 #48
0
        private async void getSitePublishSettings(string siteName)
        {
            try
            {
                var subscriptionId = cbSubscription.SelectedValue as string;
                var path = @"/subscriptions/" + subscriptionId + @"/resourceGroups/default-web-eastasia/providers/Microsoft.Web/sites/"+siteName+@"/publishxml?api-version=2014-04-01";
                Uri uri = AuthUtils.EnsureAbsoluteUri(path, this._authHelper);
                var cacheInfo = await this._authHelper.GetToken(subscriptionId);
                var handler = new HttpHandler(new HttpClientHandler(), ConfigSettingFactory.ConfigSettings.Verbose, siteName);
                HttpContent payload = null;

                //this.labelHint.Text = "Downloading "+siteName+".publishSettings ...";
                await AuthUtils.HttpInvoke(uri, cacheInfo, "get", handler, payload);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Creating Failed."+ex.Message);
                return;
            }
            //MessageBox.Show("Create successfully and get PublishSettings.");
           // this.labelHint.Text = "Done!";
            //this.pictureBusy.Visible = false;
           // this.buttonNext.Enabled = true;
        }
コード例 #49
0
        private async void Create_Click(object sender, EventArgs e)
        {
            try
            {


                var subscriptionId = cbSubscription.SelectedValue as string;
                //path "https://management.azure.com/subscriptions/<YourSubscriptionId>/resourcegroups/<YourResourceGroupName>/providers/Microsoft.Resources/deployments/<YourDeploymentName>?api-version=2015-01-01"
                var path = @"/subscriptions/"+
                    subscriptionId+@"/resourcegroups/"+
                    tbRGName.Text + @"/providers/Microsoft.web/sites/" +
                    tbWebAppName.Text+@"?api-version=2015-08-01";   
                Uri uri = AuthUtils.EnsureAbsoluteUri(path, this._authHelper);
                var cacheInfo = await this._authHelper.GetToken(subscriptionId);
                var handler = new HttpHandler(new HttpClientHandler(), ConfigSettingFactory.ConfigSettings.Verbose);
                //HttpContent payload = new StringContent("{\"location\":\"East Asia\",\"properties\":{\"serverFarm\":\"Default0\"}}", Encoding.UTF8, Constants.JsonContentType);
                //"{\"location\":\"East Asia\",\"properties\":{\"serverFarm\":\"Default0\"}}";
                  var _tmpPayloadFile = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "WebAPPtest.json");
                  HttpContent payload = new StringContent(File.ReadAllText(_tmpPayloadFile), Encoding.UTF8, Constants.JsonContentType);
                 
              //  HttpContent payload = new StringContent("{\"location\": \"" + this.cbRGLocation.SelectedItem + "\"}", Encoding.UTF8, Constants.JsonContentType);
                await AuthUtils.HttpInvoke(uri, cacheInfo, "put", handler, payload);
            }
            catch(Exception ex)
            {
                MessageBox.Show("Failed."+ex.Message);
                return;
            }
        }
コード例 #50
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AgentController"/> class.
 /// </summary>
 /// <param name="handler">The http handler.</param>
 public AgentController(HttpHandler handler)
 {
     httpHandler = handler;
 }
コード例 #51
0
ファイル: CallTest.cs プロジェクト: dsb92/patientcare
        public void RetreivingCallJSON_JSONConverted()
        {
            // Arrange
            var testString = "Test";
            var httpHandler = new HttpHandler();

            // Act
            var callJson = httpHandler.GetData(HttpHandler.API.Call, "5638662c4ca8e92f7cf1fcc7");

            var json = JsonConvert.DeserializeObject(callJson);

            Dictionary<string, string> jsonDictionary = JsonConvert.DeserializeObject<Dictionary<string, string>>(json as string);

            var callStatus = jsonDictionary["Status"];

            // Assert
            Assert.IsTrue(ReferenceEquals(callJson.GetType(), testString.GetType()));
            Assert.IsTrue(callStatus != null);
        }
コード例 #52
0
        private HttpHandler SelectHandler(HttpContext context)
        {
            Uri absolute = context.Request.RequestedUrl;

            if (!absolute.IsAbsoluteUri)
            {
                absolute = new Uri(context.Request.Host, absolute);
            }

            string fileName = absolute.Segments.Last();

            string ext = null;

            if (!fileName.Contains("."))
                ext = ".html";
            else
                ext = "." + fileName.Split('.').Last();

            HttpHandler handler = null;

            foreach (var candidate in Handlers)
            {
                if (candidate.FileExtensions != null && candidate.FileExtensions.Contains(ext))
                {
                    handler = candidate;

                    break;
                }

                // candidate is a default (low level) handler, that is better than nothing.
                if (candidate.FileExtensions == null && handler == null)
                {
                    handler = candidate;
                }
            }

            if (handler == null)
            {
                handler = new HttpHandler();
                handler.Host = this;
            }

            return handler;
        }
コード例 #53
0
 public void Register(string path, HttpHandler handler)
 {
     _handlerMap[path] = handler;
 }
コード例 #54
0
        private void BuildRuntimePipeline()
        {
#if BCL
            var httpRequestFactory = new HttpWebRequestFactory(new AmazonSecurityProtocolManager());
            var httpHandler        = new HttpHandler <Stream>(httpRequestFactory, this);
#else
            var httpRequestFactory = new HttpRequestMessageFactory(this.Config);
            var httpHandler        = new HttpHandler <System.Net.Http.HttpContent>(httpRequestFactory, this);
#endif
            var preMarshallHandler = new CallbackHandler();
            preMarshallHandler.OnPreInvoke = this.ProcessPreRequestHandlers;

            var postMarshallHandler = new CallbackHandler();
            postMarshallHandler.OnPreInvoke = this.ProcessRequestHandlers;

            var postUnmarshallHandler = new CallbackHandler();
            postUnmarshallHandler.OnPostInvoke = this.ProcessResponseHandlers;

            var errorCallbackHandler = new ErrorCallbackHandler();
            errorCallbackHandler.OnError = this.ProcessExceptionHandlers;

            //Determine which retry policy to use based on the retry mode
            RetryPolicy retryPolicy;
            switch (this.Config.RetryMode)
            {
            case RequestRetryMode.Adaptive:
                retryPolicy = new AdaptiveRetryPolicy(this.Config);
                break;

            case RequestRetryMode.Standard:
                retryPolicy = new StandardRetryPolicy(this.Config);
                break;

            case RequestRetryMode.Legacy:
                retryPolicy = new DefaultRetryPolicy(this.Config);
                break;

            default:
                throw new InvalidOperationException("Unknown retry mode");
            }

            // Build default runtime pipeline.
            this.RuntimePipeline = new RuntimePipeline(new List <IPipelineHandler>
            {
                httpHandler,
                new Unmarshaller(this.SupportResponseLogging),
                new ErrorHandler(_logger),
                postUnmarshallHandler,
                new Signer(),
                //EndpointDiscoveryResolver must come after CredentialsRetriever, RetryHander, and EndpointResolver as it depends on
                //credentials, retrying of requests for 421 web exceptions, and the current set regional endpoint.
                new EndpointDiscoveryHandler(),
                new CredentialsRetriever(this.Credentials),
                new RetryHandler(retryPolicy),
                postMarshallHandler,
                new EndpointResolver(),
                new Marshaller(),
                preMarshallHandler,
                errorCallbackHandler,
                new MetricsHandler()
            },
                                                       _logger
                                                       );

            if (DeterminedCSMConfiguration.Instance.CSMConfiguration.Enabled && !string.IsNullOrEmpty(ServiceMetadata.ServiceId))
            {
                this.RuntimePipeline.AddHandlerBefore <ErrorHandler>(new CSMCallAttemptHandler());
                this.RuntimePipeline.AddHandlerBefore <MetricsHandler>(new CSMCallEventHandler());
            }

            CustomizeRuntimePipeline(this.RuntimePipeline);

            // Apply global pipeline customizations
            RuntimePipelineCustomizerRegistry.Instance.ApplyCustomizations(this.GetType(), this.RuntimePipeline);
        }
コード例 #55
0
ファイル: ChoiceController.cs プロジェクト: dsb92/patientcare
        private List<DetailModel> GetDetails()
        {
            var client = new HttpClient();
            var handler = new HttpHandler<DetailModel>(client);
            handler.Uri = "api/detail";
            var details = handler.Get();

            var List = new List<DetailModel>();

            List.Add(new DetailModel()
            {
                DetailId = "000000",
                Name = "Ingen tilbehør valgt",
            });

            if (details != null)
            {
                if (details.Count > 0)
                {
                    foreach (var item in details)
                    {
                        List.Add(new DetailModel()
                        {
                            DetailId = item.DetailId,
                            Name = item.Name,
                        });
                    }
                }
            }
            
            return List;
        }