public async Task <IActionResult> Test()
        {
            var url    = "https://localhost:5001/WeatherForecast";
            var header = new Dictionary <string, string>();
            var result = await _restInvoker.GetAsync <List <string> >(url, header);

            return(Ok(result));
        }
        public async Task <IEnumerable <WeatherForecast> > GetWithSSL()
        {
            //Localhost can ignore certificate check if enable ignoreSelfSignedCertificateCheck in setting
            var url    = "https://localhost:44369/weatherforecast";
            var header = new Dictionary <string, string>();
            var result = await _restInvoker.GetAsync <IEnumerable <WeatherForecast> >(url, header);

            return(result);
        }
Esempio n. 3
0
        public void GetAsync_overload3()
        {
            //Arrange
            RestInvoker target = new RestInvoker(_MyUri.OriginalString);
            StubModule.HaltProcessing = TimeSpan.FromSeconds(0);
            StubModule.GetPerson = false;
            StubModule.TestHarness = new List<Person> { new Person { Id = 1, Email = "*****@*****.**" } };

            //Act
            target.GetAsync("/Person/{id}", new { id = 1 }).ContinueWith(task =>
            {
                using (RestResponse actual = task.Result)
                {
                    //Assert
                    Assert.True(StubModule.GetPerson);
                    Assert.True(actual.IsSuccessStatusCode);
                    Assert.NotNull(actual);

                    string content = actual.Body.ReadAsString();

                    Assert.Equal("{\"Id\":1,\"UID\":\"00000000-0000-0000-0000-000000000000\",\"Email\":\"[email protected]\",\"NoOfSiblings\":0,\"DOB\":\"\\/Date(-59011459200000)\\/\",\"IsActive\":false,\"Salary\":0}", content);
                }

            }).Wait();
        }