public void GetAllNewsCategories() { NewsCategoryCollection newsCategories = TestSetup.KayakoApiService.News.GetNewsCategories(); Assert.IsNotNull(newsCategories, "No news categories were returned"); Assert.IsNotEmpty(newsCategories, "No news categories were returned"); }
public void Setup() { _kayakoApiRequest = new Mock <IKayakoApiRequest>(); _newsController = new NewsController(_kayakoApiRequest.Object); _responseNewsCategoryCollection = new NewsCategoryCollection { new NewsCategory(), new NewsCategory() }; _responseNewsItemCollection = new NewsItemCollection { new NewsItem(), new NewsItem() }; _responseNewsSubscriberCollection = new NewsSubscriberCollection { new NewsSubscriber(), new NewsSubscriber(), new NewsSubscriber() }; _responseNewsItemCommentCollection = new NewsItemCommentCollection { new NewsItemComment(), new NewsItemComment() }; }
public NewsCategory CreateNewsCategory(NewsCategoryRequest newsCategoryRequest) { RequestBodyBuilder parameters = PopulateRequestParameters(newsCategoryRequest, RequestTypes.Create); NewsCategoryCollection newsCategories = Connector.ExecutePost <NewsCategoryCollection>(NewsCategoryBaseUrl, parameters.ToString()); if (newsCategories != null && newsCategories.Count > 0) { return(newsCategories[0]); } return(null); }
public NewsCategory GetNewsCategory(int newsCategoryId) { string apiMethod = String.Format("{0}/{1}", NewsCategoryBaseUrl, newsCategoryId); NewsCategoryCollection newsCategories = Connector.ExecuteGet <NewsCategoryCollection>(apiMethod); if (newsCategories != null && newsCategories.Count > 0) { return(newsCategories[0]); } return(null); }
public NewsCategory UpdateNewsCategory(NewsCategoryRequest newsCategoryRequest) { string apiMethod = String.Format("{0}/{1}", NewsCategoryBaseUrl, newsCategoryRequest.Id); RequestBodyBuilder parameters = PopulateRequestParameters(newsCategoryRequest, RequestTypes.Update); NewsCategoryCollection newsCategories = Connector.ExecutePut <NewsCategoryCollection>(apiMethod, parameters.ToString()); if (newsCategories != null && newsCategories.Count > 0) { return(newsCategories[0]); } return(null); }
public void GetNewsCategory() { NewsCategoryCollection newsCategories = TestSetup.KayakoApiService.News.GetNewsCategories(); Assert.IsNotNull(newsCategories, "No news categories were returned"); Assert.IsNotEmpty(newsCategories, "No news categories were returned"); NewsCategory newsCategoryToGet = newsCategories[new Random().Next(newsCategories.Count)]; Trace.WriteLine("GetNewsCategory using news category id: " + newsCategoryToGet.Id); NewsCategory newsCategory = TestSetup.KayakoApiService.News.GetNewsCategory(newsCategoryToGet.Id); AssertObjectXmlEqual(newsCategory, newsCategoryToGet); }
public void NewsCategoryCollectionDeserialization() { var newsCategoryCollection = new NewsCategoryCollection { new NewsCategory { Id = 1, Title = "First", NewsItemCount = 14, VisibilityType = NewsCategoryVisibilityType.Public }, new NewsCategory { Id = 2, Title = "Second", NewsItemCount = 14, VisibilityType = NewsCategoryVisibilityType.Private } }; var expectedNewsCategoryCollection = XmlDataUtility.ReadFromFile <NewsCategoryCollection>("TestData/NewsCategoryCollection.xml"); AssertUtility.ObjectsEqual(expectedNewsCategoryCollection, newsCategoryCollection); }
public void NewsCategoryCollectionDeserialization() { var newsCategoryCollection = new NewsCategoryCollection { new NewsCategory { Id = 1, Title = "First", NewsItemCount = 14, VisibilityType = NewsCategoryVisibilityType.Public }, new NewsCategory { Id = 2, Title = "Second", NewsItemCount = 14, VisibilityType = NewsCategoryVisibilityType.Private } }; var expectedNewsCategoryCollection = XmlDataUtility.ReadFromFile<NewsCategoryCollection>("TestData/NewsCategoryCollection.xml"); AssertUtility.ObjectsEqual(expectedNewsCategoryCollection, newsCategoryCollection); }
public void Setup() { _kayakoApiRequest = new Mock<IKayakoApiRequest>(); _newsController = new NewsController(_kayakoApiRequest.Object); _responseNewsCategoryCollection = new NewsCategoryCollection { new NewsCategory(), new NewsCategory() }; _responseNewsItemCollection = new NewsItemCollection { new NewsItem(), new NewsItem() }; _responseNewsSubscriberCollection = new NewsSubscriberCollection { new NewsSubscriber(), new NewsSubscriber(), new NewsSubscriber() }; _responseNewsItemCommentCollection = new NewsItemCommentCollection { new NewsItemComment(), new NewsItemComment() }; }