Пример #1
0
 public void When_the_file_metadata_is_POSTed()
 {
     var newDocumentDetails = new Document("a new example document", "a description of the new example document");
     var apiCall = new JsonApiCall();
     apiCall.SetRequestAuthenticationMechanism(new OAuth2AuthenticationMechanism(Configuration.OAuth2Token));
     _response = apiCall.Post(Configuration.ExampleCreateDocUri, newDocumentDetails);
 }
Пример #2
0
        public void When_the_file_metadata_is_PUTed()
        {
            var newDocumentDetails = new Document("a new example document", "a description of the new example document");

            var apiCall = new XmlApiCall();
            apiCall.SetRequestAuthenticationMechanism(new OAuth2AuthenticationMechanism(Configuration.OAuth2Token));
            _response = apiCall.Post(Configuration.ExampleCreateDocUri, newDocumentDetails);

            var doc = XmlConverter.FromXml<Document>(_response.Response);
            var editUrl = doc.GetLinkFor("edit").Href;
            var parentUrl = doc.GetLinkFor("parent").Href;
            var putData = new Document("newTitle", "newDescription")
                {
                    Links = new List<Link>
                        {
                            new Link
                                {
                                     Rel = "parent"
                                    ,Href = parentUrl
                                }
                        } 
                };

            _response = apiCall.Put(editUrl, putData);
        }