///////////////////////////////////////////////////////////////////////////// protected void DisplayExtensions(AtomBase obj) { foreach (Object o in obj.ExtensionElements) { IExtensionElementFactory e = o as IExtensionElementFactory; SimpleElement s = o as SimpleElement; XmlElement x = o as XmlElement; if (s != null) { DumpSimpleElement(s); SimpleContainer sc = o as SimpleContainer; if (sc != null) { foreach (SimpleElement se in sc.ExtensionElements) { DumpSimpleElement(se); } } } else if (e != null) { Tracing.TraceMsg("Found an extension Element " + e.ToString()); } else if (x != null) { Tracing.TraceMsg("Found an XmlElement " + x.ToString() + " " + x.LocalName + " " + x.NamespaceURI); } else { Tracing.TraceMsg("Found an object " + o.ToString()); } } }
/// <summary> /// helper to add all picasa photo extensions to the base object /// </summary> /// <param name="baseObject"></param> public static void AddExtension(AtomBase baseObject) { baseObject.AddExtension(new GPhotoAlbumId()); baseObject.AddExtension(new GPhotoCommentCount()); baseObject.AddExtension(new GPhotoCommentingEnabled()); baseObject.AddExtension(new GPhotoId()); baseObject.AddExtension(new GPhotoMaxPhotosPerAlbum()); baseObject.AddExtension(new GPhotoNickName()); baseObject.AddExtension(new GPhotoQuotaCurrent()); baseObject.AddExtension(new GPhotoQuotaLimit()); baseObject.AddExtension(new GPhotoThumbnail()); baseObject.AddExtension(new GPhotoUser()); baseObject.AddExtension(new GPhotoAccess()); baseObject.AddExtension(new GPhotoBytesUsed()); baseObject.AddExtension(new GPhotoLocation()); baseObject.AddExtension(new GPhotoNumPhotos()); baseObject.AddExtension(new GPhotoNumPhotosRemaining()); baseObject.AddExtension(new GPhotoChecksum()); baseObject.AddExtension(new GPhotoHeight()); baseObject.AddExtension(new GPhotoRotation()); baseObject.AddExtension(new GPhotoSize()); baseObject.AddExtension(new GPhotoTimestamp()); baseObject.AddExtension(new GPhotoWidth()); baseObject.AddExtension(new GPhotoPhotoId()); baseObject.AddExtension(new GPhotoWeight()); baseObject.AddExtension(new GPhotoAlbumDesc()); baseObject.AddExtension(new GPhotoAlbumTitle()); baseObject.AddExtension(new GPhotoSnippet()); baseObject.AddExtension(new GPhotoSnippetType()); baseObject.AddExtension(new GPhotoTruncated()); }
/// <summary> /// Declares provisioning extension elements for an atom base object. /// </summary> /// <param name="baseObject">the <code>AtomBase</code> object, /// e.g. <code>UserEntry</code> or <code>UserFeed</code></param> public static void AddProvisioningExtensions(AtomBase baseObject) { baseObject.AddExtension(new LoginElement()); baseObject.AddExtension(new NameElement()); baseObject.AddExtension(new NicknameElement()); baseObject.AddExtension(new QuotaElement()); }
public void SaveToXmlTestStream() { AtomBase target = CreateAtomBase(); Stream stream = new MemoryStream(); target.SaveToXml(stream); Assert.IsTrue(stream.Length > 0); }
////////////////////////////////////////////////////////////////////// /// <summary>Writes a feed or entry to stdout.</summary> ////////////////////////////////////////////////////////////////////// protected void WriteToStandardOutput(AtomBase atomBase) { XmlTextWriter xmlWriter = new XmlTextWriter(Console.Out); xmlWriter.Formatting = Formatting.Indented; xmlWriter.Indentation = 2; atomBase.SaveToXml(xmlWriter); xmlWriter.Flush(); }
/// <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 LanguageTest() { AtomBase target = CreateAtomBase(); // TODO: Initialize to an appropriate value string expected = "TestValue"; string actual; target.Language = expected; actual = target.Language; Assert.AreEqual(expected, actual); }
public void AddExtensionTest() { AtomBase target = CreateAtomBase(); Assert.IsTrue(target.ExtensionFactories.Count == 0); AppDraft draft = new AppDraft(); target.AddExtension(draft); Assert.AreEqual(draft, target.FindExtensionFactory(draft.XmlName, draft.XmlNameSpace)); }
public void FindExtensionTest() { AtomBase target = CreateAtomBase(); // TODO: Initialize to an appropriate value Assert.IsTrue(target.ExtensionElements.Count == 0); AppDraft draft = new AppDraft(); target.ExtensionElements.Add(draft); Assert.AreEqual(draft, target.FindExtension(draft.XmlName, draft.XmlNameSpace)); }
public void BaseTest() { AtomBase target = CreateAtomBase(); // TODO: Initialize to an appropriate value AtomUri expected = new AtomUri("http://www.test.com/"); AtomUri actual; target.Base = expected; actual = target.Base; Assert.AreEqual(expected, actual); }
public void DirtyTest() { AtomBase target = CreateAtomBase(); // TODO: Initialize to an appropriate value bool expected = true; bool actual; target.Dirty = expected; actual = target.Dirty; Assert.AreEqual(expected, actual); }
private static bool TryFind(AtomBase[] array, int count, AtomBase target) { for (int i = 0; i < count; i++) { if (array[i] == target) { return(true); } } return(false); }
public void CreateExtensionTest() { AtomBase target = CreateAtomBase(); Assert.IsTrue(target.ExtensionFactories.Count == 0); AppDraft draft = new AppDraft(); target.ExtensionFactories.Add(draft); Object actual = target.CreateExtension(draft.XmlName, draft.XmlNameSpace); Assert.IsTrue(actual is AppDraft); }
public void DeleteExtensionsTest() { AtomBase target = CreateAtomBase(); Assert.IsTrue(target.ExtensionElements.Count == 0); AppDraft draft = new AppDraft(); target.ExtensionElements.Add(draft); Assert.IsTrue(target.ExtensionElements.Count == 1); target.DeleteExtensions(draft.XmlName, draft.XmlNameSpace); Assert.IsTrue(target.ExtensionElements.Count == 0); }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>dump feeds</summary> /// <param name="theOne">the filenam</param> ////////////////////////////////////////////////////////////////////// public static void DumpAtomObject(AtomBase atom, string baseName) { if (atom != null) { StreamWriter stream = new StreamWriter(baseName, false, System.Text.Encoding.UTF8); XmlTextWriter writer = new XmlTextWriter(stream); writer.Formatting = Formatting.Indented; writer.WriteStartDocument(false); atom.SaveToXml(writer); writer.Flush(); writer.Close(); stream.Close(); } }
public void ReplaceExtensionTest() { AtomBase target = CreateAtomBase(); Assert.IsTrue(target.ExtensionElements.Count == 0); AppDraft draft = new AppDraft(); target.ExtensionElements.Add(draft); Assert.IsTrue(target.ExtensionElements.Count == 1); AppDraft draft2 = new AppDraft(); target.ReplaceExtension(draft2.XmlName, draft2.XmlNameSpace, draft2); Assert.IsTrue(target.ExtensionElements.Count == 1); Assert.AreEqual(draft2, target.ExtensionElements[0]); }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>public static bool IsBaseIdentical(AtomBase base, AtomBase base2)</summary> /// <param name="theOne">the One base </param> /// <param name="theOther">the Other base</param> /// <returns>true if identical </returns> ////////////////////////////////////////////////////////////////////// public static bool IsBaseIdentical(AtomBase theOne, AtomBase theOther) { if (theOne == null && theOther == null) { return(true); } if (AtomUri.Compare(theOne.Base, theOther.Base) != 0) { return(false); } if (String.Compare(theOne.Language, theOther.Language) != 0) { return(false); } return(true); }
/// <summary> /// adds all ExifExtensions to the passed in baseObject /// </summary> /// <param name="baseObject"></param> public static void AddExtension(AtomBase baseObject) { baseObject.AddExtension(new ExifTags()); }
public void ShouldBePersistedTest() { AtomBase target = CreateAtomBase(); Assert.IsTrue(target.ShouldBePersisted() == true); }
/////////////////////////////////////////////////////////////////////// /// <summary>Creates an attribute collection and link it to an /// extension list.</summary> /// <param name="atomElement">atom element, usually a feed or /// an entry.</param> /////////////////////////////////////////////////////////////////////// public GBaseAttributeCollection(AtomBase atomElement) : this(atomElement.ExtensionElements) { }
/// <summary> /// helper to add all MediaRss extensions to a base object /// </summary> /// <param name="baseObject"></param> public static void AddExtension(AtomBase baseObject) { baseObject.AddExtension(new GeoRssWhere()); }
/// <summary> /// helper to add all MediaRss extensions to a base object /// </summary> /// <param name="baseObject"></param> public static void AddExtension(AtomBase baseObject) { baseObject.AddExtension(new MediaGroup()); }
public void ExtensionElementsTest() { AtomBase target = CreateAtomBase(); // TODO: Initialize to an appropriate value Assert.IsNotNull(target.ExtensionElements); }
/// <summary>constructor</summary> public CustomElementCollection(AtomBase atomElement) : base() { this.atomElement = atomElement; }
/// <summary> /// Declares mail item extension elements for an atom base object. /// </summary> /// <param name="baseObject">the <code>AtomBase</code> object, /// e.g. <code>MailItemEntry</code> or <code>MailItemFeed</code></param> public static void AddMailItemExtensions(AtomBase baseObject) { baseObject.AddExtension(new LabelElement()); baseObject.AddExtension(new MailItemPropertyElement()); baseObject.AddExtension(new Rfc822MsgElement()); }
////////////////////////////////////////////////////////////////////// /// <summary>public bool Go(AtomBase baseObject)</summary> /// <param name="baseObject">object to do something with </param> /// <returns>true if we are done walking the tree</returns> ////////////////////////////////////////////////////////////////////// public bool Go(AtomBase baseObject) { Tracing.TraceInfo("inside go: " + baseObject.ToString() + " is dirty set: " + baseObject.IsDirty().ToString()); return(false); }
public Builder(AtomBase atom) => _atom = atom;
/// <summary> /// Declares Google item extension elements for an atom base object. /// </summary> /// <param name="baseObject">the <code>AtomBase</code> object, /// e.g. <code>MailItemEntry</code> or <code>MailItemFeed</code></param> public static void AddPropertyElementExtensions(AtomBase baseObject) { baseObject.AddExtension(new PropertyElement()); }
/// <summary>constructor</summary> public MatchCollection(AtomBase atomElement) : base() { this.atomElement = atomElement; }