public void AddTest() { AtomCategoryCollection target = new AtomCategoryCollection(); // TODO: Initialize to an appropriate value AtomCategory value = new AtomCategory("test"); target.Add(value); Assert.IsTrue(target.Contains(value)); }
/// <summary> /// retrieves a category collection from the given URL /// The owner should be a new Collection object, like: /// <code> /// GetCategories(new Uri("http://gdata.youtube.com/schemas/2007/categories.cat"), /// new YouTubeCategoryCollection()) /// </code> /// </summary> /// <returns></returns> public static AtomCategoryCollection GetCategories(Uri uri, AtomBase owner) { // first order is to get the document into an xml dom XmlTextReader textReader = new XmlTextReader(uri.AbsoluteUri); AtomFeedParser parser = new AtomFeedParser(); AtomCategoryCollection collection = parser.ParseCategories(textReader, owner); return(collection); }
public void InsertTest() { AtomCategoryCollection target = new AtomCategoryCollection(); // TODO: Initialize to an appropriate value AtomCategory value = new AtomCategory("test"); int index = 0; Assert.IsTrue(target.Count == 0); target.Insert(index, value); Assert.IsTrue(target.Count == 1); }
public String getCategoryLabel(AtomCategoryCollection categories) { foreach (AtomCategory cat in categories) { if (cat.Scheme == SitesService.KIND_SCHEME) { return(cat.Label); } } return(null); }
public void RemoveTest() { AtomCategoryCollection target = new AtomCategoryCollection(); // TODO: Initialize to an appropriate value AtomCategory expected = new AtomCategory("test"); Assert.IsTrue(target.Count == 0); target.Add(expected); Assert.IsTrue(target.Count == 1); target.Remove(expected); Assert.IsTrue(target.Count == 0); }
public void ItemTest() { AtomCategoryCollection target = new AtomCategoryCollection(); int index = 0; AtomCategory expected = new AtomCategory("test"); AtomCategory actual; target.Add(expected); target[index] = expected; actual = target[index]; Assert.AreEqual(expected, actual); }
public void FindTest() { AtomCategoryCollection target = new AtomCategoryCollection(); // TODO: Initialize to an appropriate value AtomCategory value = new AtomCategory("test"); target.Add(value); string term = "test"; AtomCategory actual; actual = target.Find(term); Assert.AreEqual(value, actual); }
public void IndexOfTest() { AtomCategoryCollection target = new AtomCategoryCollection(); // TODO: Initialize to an appropriate value AtomCategory value = new AtomCategory("test"); target.Add(value); int expected = 0; // TODO: Initialize to an appropriate value int actual; actual = target.IndexOf(value); Assert.AreEqual(expected, actual); }
public void YouTubeGetCategoriesTest() { Tracing.TraceMsg("Entering YouTubeGetCategoriesTest"); AtomCategoryCollection collection = YouTubeQuery.GetYouTubeCategories(); foreach (YouTubeCategory cat in collection) { Assert.IsTrue(cat.Term != null); Assert.IsTrue(cat.Assignable || cat.Deprecated || cat.Browsable != null); if (cat.Assignable) { Assert.IsTrue(cat.Browsable != null, "Assumption, if its assignable, it's browsable"); } } }
private string[] GetLabelsArray(AtomCategoryCollection postCategories) { if (postCategories != null && postCategories.Count > 0) { string[] labels = new string[postCategories.Count]; for (int i = 0; i < postCategories.Count; i++) { labels[i] = postCategories[i].Term; } return(labels); } else { return new string[] { } }; }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>verifies the categroy collection</summary> /// <param name="theOne">the One Collection </param> /// <param name="theOther">the Other Collection </param> /// <returns>true if identical </returns> ////////////////////////////////////////////////////////////////////// public static bool IsCategoryCollectionIdentical(AtomCategoryCollection theOne, AtomCategoryCollection theOther) { if (theOne == null && theOther == null) { return(true); } if (theOne.Count != theOther.Count) { return(false); } for (int i = 0; i < theOne.Count; i++) { if (!IsCategoryIdentical(theOne[i], theOther[i])) { return(false); } } return(true); }