Esempio n. 1
0
        public void AddTask()
        {
            const string data    = "{\"Subject\":\"Fix something important\"}";
            const string address = UriRoot + "tasks";

            var client = _webClientHelper.CreateWebClient();

            try
            {
                var responseString = client.UploadString(address, HttpMethod.Post.Method, data);

                var jsonResponse = JObject.Parse(responseString);
                Assert.IsNotNull(jsonResponse.ToObject <TaskCreatedActionResult>());
            }
            finally
            {
                client.Dispose();
            }
        }
        public void GetTasks()
        {
            var client = _webClientHelper.CreateWebClient();

            try
            {
                const string address        = UriRoot + "tasks";
                var          responseString = client.DownloadString(address);
                var          jsonResponse   = JObject.Parse(responseString);
                Assert.IsNotNull(jsonResponse.ToObject <PagedDataInquiryResponse <Task> >());
            }
            finally
            {
                client.Dispose();
            }
        }