public void InsertAndGetMediaCategoryTest() { MediaCategory mediaCat = new MediaCategory(0, "testCategory", "some Description"); int id = restService.postMediaCategory(mediaCat); mediaCatIdList.Add(id); MediaCategory checkMediaCat = restService.getMediaCategory(id.ToString()); Assert.AreEqual(mediaCat.name, checkMediaCat.name); }
public void deleteMediaCategoryTest() { MediaCategory mediaCat = new MediaCategory(0, "testCategory", "some Description"); int id = restService.postMediaCategory(mediaCat); restService.deleteMediaCategory(id.ToString()); MediaCategory checkMediaCat = restService.getMediaCategory(id.ToString()); Assert.AreEqual(null, checkMediaCat); }
public Response<MediaCategory> postMediaCategory(MediaCategory mediaCategory) { IncomingWebRequestContext requestContext = WebOperationContext.Current.IncomingRequest; Dictionary<string, string> data = new Dictionary<string, string>(); string authString = requestContext.Headers[HttpRequestHeader.Authorization]; data.Add("description", mediaCategory.description); data.Add("name", mediaCategory.name); Request request = makeRequest(requestContext, trimData(data), authString); MediaCategoryController controller = new MediaCategoryController(); return controller.Call(request); }
public void putMediaCategoryTest() { MediaCategory mediaCat = new MediaCategory(0, "testCategory", "some Description"); int id = restService.postMediaCategory(mediaCat); mediaCatIdList.Add(id); MediaCategory mediaCatEdit = new MediaCategory(id, "testCategoryEdited", "desc Edited"); restService.putMediaCategory(id.ToString(), mediaCatEdit); MediaCategory checkMediaCat = restService.getMediaCategory(id.ToString()); Assert.AreEqual(mediaCatEdit, mediaCatEdit); }