コード例 #1
0
        public void MakeGetRequestTest()
        {
            #region Arrange

            var responseResult = new object();
            var restClient     = new RESTClientMethods();
            restClient.Endpoint = "http://api.nbp.pl/api/exchangerates/rates/C/EUR";

            #endregion

            #region Act

            var response = restClient.MakeGetRequest(new Dictionary <string, dynamic>
            {
                { "format", "json" }
            });

            responseResult = RESTClientMethods.DeserializeFromJson(response);

            #endregion

            #region Assert

            Console.WriteLine(responseResult);
            Assert.IsNotNull(response);

            #endregion
        }
コード例 #2
0
        public void MakePostRequestWithoutBodyTest()
        {
            #region Arrange

            var responseResult = new object();
            var restClient     = new RESTClientMethods();

            restClient.Endpoint = "https://jsonplaceholder.typicode.com/posts";

            #endregion

            #region Act

            var response = restClient.MakePostRequest();

            responseResult = RESTClientMethods.DeserializeFromJson(response);

            #endregion

            #region Assert

            Console.WriteLine(responseResult);
            Assert.IsNotNull(responseResult);

            #endregion
        }