Exemplo n.º 1
0
 public void deleteTagTest()
 {
     Tag testTag = new Tag(0, 1, "tagName", "tName");
     int id = restService.postTag(testTag);
     restService.deleteTag(id.ToString());
     Tag tag = restService.getTag(id.ToString());
     Assert.AreEqual(null, tag);
 }
        public Response<Tag> postTag(Tag tag)
        {
            IncomingWebRequestContext requestContext = WebOperationContext.Current.IncomingRequest;

            Dictionary<string, string> data = new Dictionary<string, string>();

            string authString = requestContext.Headers[HttpRequestHeader.Authorization];

            data.Add("name", tag.name);
            data.Add("simple_name", tag.simple_name);
            data.Add("tag_group_id", tag.tag_group.ToString());

            Request request = makeRequest(requestContext, trimData(data), authString);

            TagController controller = new TagController();

            return controller.Call(request);
        }
Exemplo n.º 3
0
 public void postAndGetTagTest()
 {
     Tag testTag = new Tag(0, 1, "tagName", "tName");
     int id = restService.postTag(testTag);
     idList.Add(id);
     Tag checkTag = restService.getTag(id.ToString());
     Assert.AreEqual(testTag.name, checkTag.name);
 }
Exemplo n.º 4
0
 public void putTagTest()
 {
     Tag testTag = new Tag(0, 1, "tagName", "tName");
     int id = restService.postTag(testTag);
     idList.Add(id);
     Tag editTag = new Tag(id, 1, "editName", "eName");
     restService.putTag(id.ToString(), editTag);
     testTag = restService.getTag(id.ToString());
     Assert.AreEqual(editTag.name, testTag.name);
 }