/////////////////////////////////////////////////////////////////////// /// <summary>Removes all Google Base attributes.</summary> /////////////////////////////////////////////////////////////////////// public void Clear() { ExtensionList toRemove = ExtensionList.NotVersionAware(); foreach (GBaseAttribute attribute in this) { toRemove.Add(attribute); } RemoveAll(toRemove); }
private ExtensionList GetAttributeList(string name, GBaseAttributeType type) { ExtensionList retval = ExtensionList.NotVersionAware(); foreach (GBaseAttribute attribute in this) { if (HasNameAndType(attribute, name, type)) { retval.Add(attribute); } } return(retval); }
private ExtensionList GetAttributeList(string name) { ExtensionList retval = ExtensionList.NotVersionAware(); foreach (GBaseAttribute attribute in this) { if (name == attribute.Name) { retval.Add(attribute); } } return(retval); }
public void ItemTypeDefinitionTest() { AttributeId[] ids = { new AttributeId("x", GBaseAttributeType.Int) }; ExtensionList extList = ExtensionList.NotVersionAware(); //extList.Add("garbage"); //extList.Add(12); ItemTypeDefinition defs = new ItemTypeDefinition(extList); Assert.IsNull(defs.ItemType); Assert.IsNotNull(defs.Attributes); Assert.AreEqual(0, defs.Attributes.Count); extList.Add(new MetadataItemType("hello")); Assert.AreEqual("hello", defs.ItemType); extList.Add(new ItemTypeAttributes(new List <AttributeId>(ids))); Assert.AreEqual(1, defs.Attributes.Count); Assert.AreEqual("x", defs.Attributes[0].Name); }
public void YouTubeInsertTest() { Tracing.TraceMsg("Entering YouTubeInsertTest"); YouTubeService service = new YouTubeService("NETUnittests", this.ytDevKey); if (!string.IsNullOrEmpty(this.ytUser)) { service.Credentials = new GDataCredentials(this.ytUser, this.ytPwd); } GDataRequestFactory factory = service.RequestFactory as GDataRequestFactory; factory.Timeout = 1000000; YouTubeEntry entry = new YouTubeEntry(); entry.MediaSource = new MediaFileSource(Path.Combine(this.resourcePath, "test_movie.mov"), "video/quicktime"); entry.Media = new YouTube.MediaGroup(); entry.Media.Description = new MediaDescription("This is a test with and & in it"); entry.Media.Title = new MediaTitle("Sample upload"); entry.Media.Keywords = new MediaKeywords("math"); // entry.Media.Categories MediaCategory category = new MediaCategory("Nonprofit"); category.Attributes["scheme"] = YouTubeService.DefaultCategory; entry.Media.Categories.Add(category); YouTubeEntry newEntry = service.Upload(this.ytUser, entry); Assert.AreEqual(newEntry.Media.Description.Value, entry.Media.Description.Value, "Description should be equal"); Assert.AreEqual(newEntry.Media.Keywords.Value, entry.Media.Keywords.Value, "Keywords should be equal"); // now change the entry newEntry.Title.Text = "This test upload will soon be deleted"; YouTubeEntry anotherEntry = newEntry.Update() as YouTubeEntry; // bugbug in YouTube server. Returns empty category that the service DOES not like on reuse. so remove ExtensionList a = ExtensionList.NotVersionAware(); foreach (MediaCategory m in anotherEntry.Media.Categories) { if (String.IsNullOrEmpty(m.Value)) { a.Add(m); } } foreach (MediaCategory m in a) { anotherEntry.Media.Categories.Remove(m); } Assert.AreEqual(newEntry.Media.Description.Value, anotherEntry.Media.Description.Value, "Description should be equal"); Assert.AreEqual(newEntry.Media.Keywords.Value, anotherEntry.Media.Keywords.Value, "Keywords should be equal"); // now update the video anotherEntry.MediaSource = new MediaFileSource(Path.Combine(this.resourcePath, "test.mp4"), "video/mp4"); anotherEntry.Update(); // now delete the guy again newEntry.Delete(); }
public virtual void setUp() { extList = ExtensionList.NotVersionAware(); attrs = new GBaseAttributeCollection(extList); }
public virtual void SetUp() { list = ExtensionList.NotVersionAware(); attrs = new GBaseAttributeCollectionWithTypeConversion(list); }