Author: atsushi
Date: 2007-12-10 10:01:58 -0500 (Mon, 10 Dec 2007)
New Revision: 91047
Added:
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Syndication/Atom10ItemFormatterTest.cs
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Syndication/Rss20ItemFormatterTest.cs
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Syndication/SyndicationFeedTest.cs
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Syndication/SyndicationItemTest.cs
Modified:
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/Atom10ItemFormatter.cs
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/ChangeLog
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/Rss20ItemFormatter.cs
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationCategory.cs
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationContent.cs
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationFeed.cs
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationItem.cs
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationItemFormatter.cs
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationPerson.cs
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Web_test.dll.sources
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Syndication/ChangeLog
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Syndication/SyndicationLinkTest.cs
Log:
2007-12-10 Atsushi Enomoto <[EMAIL PROTECTED]>
* Atom10ItemFormatter.cs, Rss20ItemFormatter.cs,
SyndicationCategory.cs, SyndicationContent.cs, SyndicationFeed.cs,
SyndicationItem.cs, SyndicationItemFormatter.cs,
SyndicationPerson.cs : a bunch of implementation.
* Atom10ItemFormatterTest.cs, Rss20ItemFormatterTest.cs,
SyndicationFeedTest.cs, SyndicationItemTest.cs : new tests.
Modified:
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/Atom10ItemFormatter.cs
===================================================================
---
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/Atom10ItemFormatter.cs
2007-12-10 14:30:50 UTC (rev 91046)
+++
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/Atom10ItemFormatter.cs
2007-12-10 15:01:58 UTC (rev 91047)
@@ -40,44 +40,41 @@
[XmlRoot ("entry", Namespace = "http://www.w3.org/2005/Atom")]
public class Atom10ItemFormatter : SyndicationItemFormatter,
IXmlSerializable
{
- [MonoTODO]
+ bool preserve_att_ext, preserve_elem_ext;
+ Type item_type;
+
public Atom10ItemFormatter ()
{
- throw new NotImplementedException ();
}
- [MonoTODO]
public Atom10ItemFormatter (SyndicationItem feedToWrite)
+ : base (feedToWrite)
{
- throw new NotImplementedException ();
}
- [MonoTODO]
- public Atom10ItemFormatter (Type feedTypeToCreate)
+ public Atom10ItemFormatter (Type itemTypeToCreate)
{
- throw new NotImplementedException ();
+ if (itemTypeToCreate == null)
+ throw new ArgumentNullException
("itemTypeToCreate");
+ item_type = itemTypeToCreate;
}
- [MonoTODO]
protected Type ItemType {
- get { throw new NotImplementedException (); }
+ get { return item_type; }
}
- [MonoTODO]
public bool PreserveAttributeExtensions {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ get { return preserve_att_ext; }
+ set { preserve_att_ext = value; }
}
- [MonoTODO]
public bool PreserveElementExtensions {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ get { return preserve_elem_ext; }
+ set { preserve_elem_ext = value; }
}
- [MonoTODO]
public override string Version {
- get { throw new NotImplementedException (); }
+ get { return "Atom10"; }
}
[MonoTODO]
Modified:
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/ChangeLog
===================================================================
---
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/ChangeLog
2007-12-10 14:30:50 UTC (rev 91046)
+++
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/ChangeLog
2007-12-10 15:01:58 UTC (rev 91047)
@@ -1,5 +1,12 @@
2007-12-10 Atsushi Enomoto <[EMAIL PROTECTED]>
+ * Atom10ItemFormatter.cs, Rss20ItemFormatter.cs,
+ SyndicationCategory.cs, SyndicationContent.cs, SyndicationFeed.cs,
+ SyndicationItem.cs, SyndicationItemFormatter.cs,
+ SyndicationPerson.cs : a bunch of implementation.
+
+2007-12-10 Atsushi Enomoto <[EMAIL PROTECTED]>
+
* SyndicationElementExtensionCollection.cs : added copy .ctor().
* SyndicationLink.cs : implemented everything but read/write part.
Modified:
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/Rss20ItemFormatter.cs
===================================================================
---
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/Rss20ItemFormatter.cs
2007-12-10 14:30:50 UTC (rev 91046)
+++
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/Rss20ItemFormatter.cs
2007-12-10 15:01:58 UTC (rev 91047)
@@ -40,56 +40,52 @@
[XmlRoot ("item", Namespace = "")]
public class Rss20ItemFormatter : SyndicationItemFormatter,
IXmlSerializable
{
- [MonoTODO]
+ bool ext_atom_serialization, preserve_att_ext,
preserve_elem_ext;
+ Type item_type;
+
public Rss20ItemFormatter ()
{
- throw new NotImplementedException ();
}
- [MonoTODO]
public Rss20ItemFormatter (SyndicationItem feedToWrite)
+ : this (feedToWrite, true)
{
- throw new NotImplementedException ();
}
- [MonoTODO]
public Rss20ItemFormatter (SyndicationItem feedToWrite, bool
serializeExtensionsAsAtom)
+ : base (feedToWrite)
{
- throw new NotImplementedException ();
+ ext_atom_serialization = serializeExtensionsAsAtom;
}
- [MonoTODO]
- public Rss20ItemFormatter (Type feedTypeToCreate)
+ public Rss20ItemFormatter (Type itemTypeToCreate)
{
- throw new NotImplementedException ();
+ if (itemTypeToCreate == null)
+ throw new ArgumentNullException
("itemTypeToCreate");
+ item_type = itemTypeToCreate;
}
- [MonoTODO]
public bool SerializeExtensionsAsAtom {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ get { return ext_atom_serialization; }
+ set { ext_atom_serialization = value; }
}
- [MonoTODO]
protected Type ItemType {
- get { throw new NotImplementedException (); }
+ get { return item_type; }
}
- [MonoTODO]
public bool PreserveAttributeExtensions {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ get { return preserve_att_ext; }
+ set { preserve_att_ext = value; }
}
- [MonoTODO]
public bool PreserveElementExtensions {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ get { return preserve_elem_ext; }
+ set { preserve_elem_ext = value; }
}
- [MonoTODO]
public override string Version {
- get { throw new NotImplementedException (); }
+ get { return "Rss20"; }
}
[MonoTODO]
Modified:
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationCategory.cs
===================================================================
---
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationCategory.cs
2007-12-10 14:30:50 UTC (rev 91046)
+++
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationCategory.cs
2007-12-10 15:01:58 UTC (rev 91047)
@@ -37,62 +37,61 @@
{
public class SyndicationCategory : ISyndicationElement
{
- [MonoTODO]
+ string name, scheme, label;
+ SyndicationExtensions extensions = new SyndicationExtensions ();
+
public SyndicationCategory ()
{
- throw new NotImplementedException ();
}
- [MonoTODO]
public SyndicationCategory (string name)
{
- throw new NotImplementedException ();
+ Name = name;
}
- [MonoTODO]
public SyndicationCategory (string name, string scheme, string
label)
{
- throw new NotImplementedException ();
+ Name = name;
+ Scheme = scheme;
+ Label = label;
}
- [MonoTODO]
protected SyndicationCategory (SyndicationCategory source)
{
- throw new NotImplementedException ();
+ if (source == null)
+ throw new ArgumentNullException ("source");
+ name = source.name;
+ scheme = source.scheme;
+ label = source.label;
+ extensions = source.extensions.Clone ();
}
- [MonoTODO]
public Dictionary<XmlQualifiedName, string> AttributeExtensions
{
- get { throw new NotImplementedException (); }
+ get { return extensions.Attributes; }
}
- [MonoTODO]
public SyndicationElementExtensionCollection ElementExtensions {
- get { throw new NotImplementedException (); }
+ get { return extensions.Elements; }
}
- [MonoTODO]
public string Label {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ get { return label; }
+ set { label = value; }
}
- [MonoTODO]
public string Name {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ get { return name; }
+ set { name = value; }
}
- [MonoTODO]
public string Scheme {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ get { return scheme; }
+ set { scheme = value; }
}
- [MonoTODO]
public virtual SyndicationCategory Clone ()
{
- throw new NotImplementedException ();
+ return new SyndicationCategory (this);
}
[MonoTODO]
Modified:
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationContent.cs
===================================================================
---
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationContent.cs
2007-12-10 14:30:50 UTC (rev 91046)
+++
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationContent.cs
2007-12-10 15:01:58 UTC (rev 91047)
@@ -38,28 +38,26 @@
{
public abstract class SyndicationContent
{
- [MonoTODO]
+ #region Static members
+
public static TextSyndicationContent CreateHtmlContent (string
content)
{
- throw new NotImplementedException ();
+ return new TextSyndicationContent (content,
TextSyndicationContentKind.Html);
}
- [MonoTODO]
public static TextSyndicationContent CreatePlaintextContent
(string content)
{
- throw new NotImplementedException ();
+ return new TextSyndicationContent (content,
TextSyndicationContentKind.Plaintext);
}
- [MonoTODO]
- public static UrlSyndicationContent CreateUrlContent (Uri url,
string mediaType)
+ public static TextSyndicationContent CreateXhtmlContent (string
content)
{
- throw new NotImplementedException ();
+ return new TextSyndicationContent (content,
TextSyndicationContentKind.XHtml);
}
- [MonoTODO]
- public static TextSyndicationContent CreateXhtmlContent (string
content)
+ public static UrlSyndicationContent CreateUrlContent (Uri url,
string mediaType)
{
- throw new NotImplementedException ();
+ return new UrlSyndicationContent (url, mediaType);
}
[MonoTODO]
@@ -86,30 +84,31 @@
throw new NotImplementedException ();
}
- [MonoTODO]
+ #endregion
+
+ #region Instance members
+
+ SyndicationExtensions extensions = new SyndicationExtensions ();
+
protected SyndicationContent ()
{
- throw new NotImplementedException ();
}
- [MonoTODO]
protected SyndicationContent (SyndicationContent source)
{
- throw new NotImplementedException ();
+ if (source == null)
+ throw new ArgumentNullException ("source");
+ extensions = source.extensions.Clone ();
}
- [MonoTODO]
public Dictionary<XmlQualifiedName, string> AttributeExtensions
{
- get { throw new NotImplementedException (); }
+ get { return extensions.Attributes; }
}
- [MonoTODO]
public abstract string Type { get; }
- [MonoTODO]
public abstract SyndicationContent Clone ();
- [MonoTODO]
protected abstract void WriteContentsTo (XmlWriter writer);
[MonoTODO]
@@ -118,5 +117,6 @@
throw new NotImplementedException ();
}
+ #endregion
}
}
Modified:
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationFeed.cs
===================================================================
---
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationFeed.cs
2007-12-10 14:30:50 UTC (rev 91046)
+++
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationFeed.cs
2007-12-10 15:01:58 UTC (rev 91047)
@@ -37,187 +37,217 @@
{
public class SyndicationFeed : ISyndicationElement
{
- [MonoTODO]
+ SyndicationExtensions extensions = new SyndicationExtensions ();
+ Collection<SyndicationCategory> categories;
+ Collection<SyndicationPerson> authors, contributors;
+ Collection<SyndicationLink> links;
+ Uri base_uri;
+ TextSyndicationContent copyright, title;
+ string id;
+ DateTimeOffset last_updated_time;
+
+ IEnumerable<SyndicationItem> items;
+ TextSyndicationContent description;
+ string generator, language;
+ Uri image_url;
+
public SyndicationFeed ()
{
- throw new NotImplementedException ();
}
- [MonoTODO]
public SyndicationFeed (IEnumerable<SyndicationItem> items)
{
- throw new NotImplementedException ();
+ Items = items;
}
- [MonoTODO]
public SyndicationFeed (string title, string description, Uri
feedAlternateLink)
+ : this (title, description, feedAlternateLink, null)
{
- throw new NotImplementedException ();
}
- [MonoTODO]
public SyndicationFeed (string title, string description, Uri
feedAlternateLink,
IEnumerable<SyndicationItem> items)
+ : this (title, description, feedAlternateLink, null,
default (DateTimeOffset), items)
{
throw new NotImplementedException ();
}
- [MonoTODO]
public SyndicationFeed (string title, string description, Uri
feedAlternateLink, string id,
DateTimeOffset lastUpdatedTime)
+ : this (title, description, feedAlternateLink, id,
lastUpdatedTime, null)
{
- throw new NotImplementedException ();
}
- [MonoTODO]
public SyndicationFeed (string title, string description, Uri
feedAlternateLink, string id,
DateTimeOffset lastUpdatedTime,
IEnumerable<SyndicationItem> items)
{
- throw new NotImplementedException ();
+ Title = title != null ? new TextSyndicationContent
(title) : null;
+ Description = description != null ? new
TextSyndicationContent (description) : null;
+ if (feedAlternateLink != null)
+ Links.Add (SyndicationLink.CreateAlternateLink
(feedAlternateLink));
+ Id = id;
+ LastUpdatedTime = lastUpdatedTime;
+ Items = items;
}
- [MonoTODO]
protected SyndicationFeed (SyndicationFeed source, bool
cloneItems)
{
- throw new NotImplementedException ();
+ extensions = source.extensions.Clone ();
+ categories = source.categories == null ? null : new
Collection<SyndicationCategory> (source.categories);
+ authors = source.authors == null ? null : new
Collection<SyndicationPerson> (source.authors);
+ contributors = source.contributors == null ? null : new
Collection<SyndicationPerson> (source.contributors);
+ links = source.links == null ? null : new
Collection<SyndicationLink> (source.links);
+ base_uri = source.base_uri; // copy by reference !!
+ copyright = source.copyright == null ? null :
source.copyright.Clone () as TextSyndicationContent;
+ title = source.title == null ? null :
source.title.Clone () as TextSyndicationContent;
+ id = source.id;
+ last_updated_time = source.last_updated_time;
+
+ description = source.description == null ? null :
source.description.Clone () as TextSyndicationContent;
+ generator = source.generator;
+ image_url = source.image_url; // copy by reference !!
+ language = source.language;
+
+ if (cloneItems && source.items != null)
+ items = new Collection<SyndicationItem> (new
List<SyndicationItem> (source.items));
}
- [MonoTODO]
public Dictionary<XmlQualifiedName, string> AttributeExtensions
{
- get { throw new NotImplementedException (); }
+ get { return extensions.Attributes; }
}
- [MonoTODO]
public SyndicationElementExtensionCollection ElementExtensions {
- get { throw new NotImplementedException (); }
+ get { return extensions.Elements; }
}
- [MonoTODO]
public Collection<SyndicationPerson> Authors {
- get { throw new NotImplementedException (); }
+ get {
+ if (authors == null)
+ authors = new
Collection<SyndicationPerson> ();
+ return authors;
+ }
}
- [MonoTODO]
public Collection<SyndicationCategory> Categories {
- get { throw new NotImplementedException (); }
+ get {
+ if (categories == null)
+ categories = new
Collection<SyndicationCategory> ();
+ return categories;
+ }
}
- [MonoTODO]
public Collection<SyndicationPerson> Contributors {
- get { throw new NotImplementedException (); }
+ get {
+ if (contributors == null)
+ contributors = new
Collection<SyndicationPerson> ();
+ return contributors;
+ }
}
- [MonoTODO]
- public IEnumerable<SyndicationItem> Items {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
- }
-
- [MonoTODO]
public Collection<SyndicationLink> Links {
- get { throw new NotImplementedException (); }
+ get {
+ if (links == null)
+ links = new Collection<SyndicationLink>
();
+ return links;
+ }
}
- [MonoTODO]
public Uri BaseUri {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ get { return base_uri; }
+ set { base_uri = value; }
}
- [MonoTODO]
public TextSyndicationContent Copyright {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ get { return copyright; }
+ set { copyright = value; }
}
- [MonoTODO]
- public TextSyndicationContent Description {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ public string Id {
+ get { return id; }
+ set { id = value; }
}
- [MonoTODO]
- public string Generator {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ public DateTimeOffset LastUpdatedTime {
+ get { return last_updated_time; }
+ set { last_updated_time = value; }
}
- [MonoTODO]
- public string Id {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ public TextSyndicationContent Title {
+ get { return title; }
+ set { title = value; }
}
- [MonoTODO]
- public Uri ImageUrl {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ public IEnumerable<SyndicationItem> Items {
+ get {
+ if (items == null)
+ items = new Collection<SyndicationItem>
();
+ return items;
+ }
+ set {
+ if (value == null)
+ throw new ArgumentNullException
("value");
+ items = value;
+ }
}
- [MonoTODO]
- public string Language {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ public TextSyndicationContent Description {
+ get { return description; }
+ set { description = value; }
}
- [MonoTODO]
- public DateTimeOffset LastUpdatedTime {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ public string Generator {
+ get { return generator; }
+ set { generator = value; }
}
- [MonoTODO]
- public TextSyndicationContent Title {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ public Uri ImageUrl {
+ get { return image_url; }
+ set { image_url = value; }
}
- [MonoTODO]
+ public string Language {
+ get { return language; }
+ set { language = value; }
+ }
+
public virtual SyndicationFeed Clone (bool cloneItems)
{
- throw new NotImplementedException ();
+ return new SyndicationFeed (this, cloneItems);
}
- [MonoTODO]
protected internal virtual SyndicationCategory CreateCategory ()
{
- throw new NotImplementedException ();
+ return new SyndicationCategory ();
}
- [MonoTODO]
- protected internal virtual SyndicationItem CreateItem ()
+ protected internal virtual SyndicationLink CreateLink ()
{
- throw new NotImplementedException ();
+ return new SyndicationLink ();
}
- [MonoTODO]
- protected internal virtual SyndicationLink CreateLink ()
+ protected internal virtual SyndicationPerson CreatePerson ()
{
- throw new NotImplementedException ();
+ return new SyndicationPerson ();
}
- [MonoTODO]
- protected internal virtual SyndicationPerson CreatePerson ()
+ protected internal virtual SyndicationItem CreateItem ()
{
- throw new NotImplementedException ();
+ return new SyndicationItem ();
}
- [MonoTODO]
public Atom10FeedFormatter GetAtom10Formatter ()
{
- throw new NotImplementedException ();
+ return new Atom10FeedFormatter (this);
}
- [MonoTODO]
public Rss20FeedFormatter GetRss20Formatter ()
{
- throw new NotImplementedException ();
+ return GetRss20Formatter (true);
}
- [MonoTODO]
public Rss20FeedFormatter GetRss20Formatter (bool
serializeExtensionsAsAtom)
{
- throw new NotImplementedException ();
+ return new Rss20FeedFormatter (this,
serializeExtensionsAsAtom);
}
[MonoTODO]
@@ -232,16 +262,14 @@
throw new NotImplementedException ();
}
- [MonoTODO]
public void SaveAsAtom10 (XmlWriter writer)
{
- throw new NotImplementedException ();
+ GetAtom10Formatter ().WriteTo (writer);
}
- [MonoTODO]
public void SaveAsRss20 (XmlWriter writer)
{
- throw new NotImplementedException ();
+ GetRss20Formatter ().WriteTo (writer);
}
[MonoTODO]
Modified:
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationItem.cs
===================================================================
---
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationItem.cs
2007-12-10 14:30:50 UTC (rev 91046)
+++
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationItem.cs
2007-12-10 15:01:58 UTC (rev 91047)
@@ -37,168 +37,209 @@
{
public class SyndicationItem : ISyndicationElement
{
- [MonoTODO]
+ SyndicationExtensions extensions = new SyndicationExtensions ();
+ Collection<SyndicationCategory> categories;
+ Collection<SyndicationPerson> authors, contributors;
+ Collection<SyndicationLink> links;
+ Uri base_uri;
+ TextSyndicationContent copyright, summary, title;
+ SyndicationContent content;
+ string id;
+ DateTimeOffset last_updated_time, published_date;
+ SyndicationFeed source_feed;
+
public SyndicationItem ()
{
- throw new NotImplementedException ();
}
- [MonoTODO]
- public SyndicationItem (string title, string description, Uri
feedAlternateLink)
+ public SyndicationItem (string title, string content, Uri
feedAlternateLink)
+ : this (title, content, feedAlternateLink, null,
default (DateTimeOffset))
{
- throw new NotImplementedException ();
}
- [MonoTODO]
- public SyndicationItem (string title, string description, Uri
feedAlternateLink, string id,
+ public SyndicationItem (string title, string content, Uri
feedAlternateLink, string id,
DateTimeOffset lastUpdatedTime)
+ : this (title, content != null ?
SyndicationContent.CreatePlaintextContent (content) : null, feedAlternateLink,
id, lastUpdatedTime)
{
- throw new NotImplementedException ();
}
- [MonoTODO]
public SyndicationItem (string title, SyndicationContent
content, Uri feedAlternateLink, string id,
DateTimeOffset lastUpdatedTime)
{
- throw new NotImplementedException ();
+ Title = title != null ? new TextSyndicationContent
(title) : null;
+ Content = content;
+ if (feedAlternateLink != null)
+ AddPermalink (feedAlternateLink);
+ Id = id;
+ LastUpdatedTime = lastUpdatedTime;
}
- [MonoTODO]
protected SyndicationItem (SyndicationItem source)
{
- throw new NotImplementedException ();
+ extensions = source.extensions.Clone ();
+ categories = Copy<SyndicationCategory>
(source.categories);
+ authors = Copy<SyndicationPerson> (source.authors);
+ contributors = Copy<SyndicationPerson>
(source.contributors);
+ links = Copy<SyndicationLink> (source.links);
+ base_uri = source.base_uri; // copy by reference !!
+ copyright = source.copyright == null ? null :
source.copyright.Clone () as TextSyndicationContent;
+ summary = source.summary == null ? null :
source.summary.Clone () as TextSyndicationContent;
+ title = source.title == null ? null :
source.title.Clone () as TextSyndicationContent;
+ content = source.content == null ? null :
source.content.Clone ();
+ id = source.id;
+ last_updated_time = source.last_updated_time;
+ published_date = source.published_date;
+ source_feed = source.source_feed == null ? null :
source.source_feed.Clone (false);
}
- [MonoTODO]
+ Collection<T> Copy<T> (Collection<T> source)
+ {
+ if (source == null)
+ return source;
+ Collection<T> ret = new Collection<T> ();
+ foreach (object item in source)
+ ret.Add ((T) CreateCopy (item));
+ return ret;
+ }
+
+ object CreateCopy (object source)
+ {
+ if (source == null)
+ return null;
+ if (source is SyndicationPerson)
+ return ((SyndicationPerson) source).Clone ();
+ if (source is SyndicationLink)
+ return ((SyndicationLink) source).Clone ();
+ if (source is SyndicationCategory)
+ return ((SyndicationCategory) source).Clone ();
+ throw new InvalidOperationException ();
+ }
+
public Dictionary<XmlQualifiedName, string> AttributeExtensions
{
- get { throw new NotImplementedException (); }
+ get { return extensions.Attributes; }
}
- [MonoTODO]
public SyndicationElementExtensionCollection ElementExtensions {
- get { throw new NotImplementedException (); }
+ get { return extensions.Elements; }
}
- [MonoTODO]
public Collection<SyndicationPerson> Authors {
- get { throw new NotImplementedException (); }
+ get {
+ if (authors == null)
+ authors = new
Collection<SyndicationPerson> ();
+ return authors;
+ }
}
- [MonoTODO]
public Collection<SyndicationCategory> Categories {
- get { throw new NotImplementedException (); }
+ get {
+ if (categories == null)
+ categories = new
Collection<SyndicationCategory> ();
+ return categories;
+ }
}
- [MonoTODO]
public Collection<SyndicationPerson> Contributors {
- get { throw new NotImplementedException (); }
+ get {
+ if (contributors == null)
+ contributors = new
Collection<SyndicationPerson> ();
+ return contributors;
+ }
}
- [MonoTODO]
public Collection<SyndicationLink> Links {
- get { throw new NotImplementedException (); }
+ get {
+ if (links == null)
+ links = new Collection<SyndicationLink>
();
+ return links;
+ }
}
- [MonoTODO]
public Uri BaseUri {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ get { return base_uri; }
+ set { base_uri = value; }
}
- [MonoTODO]
public TextSyndicationContent Copyright {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ get { return copyright; }
+ set { copyright = value; }
}
- [MonoTODO]
public SyndicationContent Content {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ get { return content; }
+ set { content = value; }
}
- [MonoTODO]
public string Id {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ get { return id; }
+ set { id = value; }
}
- [MonoTODO]
public DateTimeOffset LastUpdatedTime {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ get { return last_updated_time; }
+ set { last_updated_time = value; }
}
- [MonoTODO]
public DateTimeOffset PublishDate {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ get { return published_date; }
+ set { published_date = value; }
}
- [MonoTODO]
public SyndicationFeed SourceFeed {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ get { return source_feed; }
+ set { source_feed = value; }
}
- [MonoTODO]
public TextSyndicationContent Summary {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ get { return summary; }
+ set { summary = value; }
}
- [MonoTODO]
public TextSyndicationContent Title {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ get { return title; }
+ set { title = value; }
}
- [MonoTODO]
public void AddPermalink (Uri link)
{
- throw new NotImplementedException ();
+ if (link == null)
+ throw new ArgumentNullException ("link");
+ Links.Add (SyndicationLink.CreateAlternateLink (link));
}
- [MonoTODO]
public virtual SyndicationItem Clone ()
{
- throw new NotImplementedException ();
+ return new SyndicationItem (this);
}
- [MonoTODO]
protected internal virtual SyndicationCategory CreateCategory ()
{
- throw new NotImplementedException ();
+ return new SyndicationCategory ();
}
- [MonoTODO]
protected internal virtual SyndicationLink CreateLink ()
{
- throw new NotImplementedException ();
+ return new SyndicationLink ();
}
- [MonoTODO]
protected internal virtual SyndicationPerson CreatePerson ()
{
- throw new NotImplementedException ();
+ return new SyndicationPerson ();
}
- [MonoTODO]
public Atom10ItemFormatter GetAtom10Formatter ()
{
- throw new NotImplementedException ();
+ return new Atom10ItemFormatter (this);
}
- [MonoTODO]
public Rss20ItemFormatter GetRss20Formatter ()
{
- throw new NotImplementedException ();
+ return GetRss20Formatter (true);
}
- [MonoTODO]
public Rss20ItemFormatter GetRss20Formatter (bool
serializeExtensionsAsAtom)
{
- throw new NotImplementedException ();
+ return new Rss20ItemFormatter (this,
serializeExtensionsAsAtom);
}
[MonoTODO]
@@ -213,26 +254,28 @@
throw new NotImplementedException ();
}
- [MonoTODO]
public void SaveAsAtom10 (XmlWriter writer)
{
- throw new NotImplementedException ();
+ if (writer == null)
+ throw new ArgumentNullException ("writer");
+ GetAtom10Formatter ().WriteTo (writer);
}
- [MonoTODO]
public void SaveAsRss20 (XmlWriter writer)
{
- throw new NotImplementedException ();
+ if (writer == null)
+ throw new ArgumentNullException ("writer");
+ GetRss20Formatter ().WriteTo (writer);
}
[MonoTODO]
- protected internal virtual bool TryParseAttribute (string name,
string ns, string value, string version)
+ protected internal virtual bool TryParseContent (XmlReader
reader, string contentType, string version, out SyndicationContent content)
{
throw new NotImplementedException ();
}
[MonoTODO]
- protected internal virtual bool TryParseContent (XmlReader
reader, string contentType, string version, out SyndicationContent content)
+ protected internal virtual bool TryParseAttribute (string name,
string ns, string value, string version)
{
throw new NotImplementedException ();
}
Modified:
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationItemFormatter.cs
===================================================================
---
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationItemFormatter.cs
2007-12-10 14:30:50 UTC (rev 91046)
+++
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationItemFormatter.cs
2007-12-10 15:01:58 UTC (rev 91047)
@@ -188,40 +188,39 @@
#region instance members
- [MonoTODO]
+ SyndicationItem item;
+
protected SyndicationItemFormatter ()
{
- throw new NotImplementedException ();
}
- [MonoTODO]
protected SyndicationItemFormatter (SyndicationItem itemToWrite)
{
- throw new NotImplementedException ();
+ if (itemToWrite == null)
+ throw new ArgumentNullException ("itemToWrite");
+ SetItem (itemToWrite);
}
[MonoTODO]
protected internal virtual void SetItem (SyndicationItem item)
{
- throw new NotImplementedException ();
+ if (item == null)
+ throw new ArgumentNullException ("item");
+ this.item = item;
}
- [MonoTODO]
public SyndicationItem Item {
- get { throw new NotImplementedException (); }
+ get { return item; }
}
- [MonoTODO]
public abstract string Version { get; }
- [MonoTODO]
protected abstract SyndicationItem CreateItemInstance ();
public abstract bool CanRead (XmlReader reader);
public abstract void ReadFrom (XmlReader reader);
- [MonoTODO]
public abstract void WriteTo (XmlWriter writer);
[MonoTODO]
Modified:
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationPerson.cs
===================================================================
---
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationPerson.cs
2007-12-10 14:30:50 UTC (rev 91046)
+++
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationPerson.cs
2007-12-10 15:01:58 UTC (rev 91047)
@@ -37,62 +37,61 @@
{
public class SyndicationPerson : ISyndicationElement
{
- [MonoTODO]
+ string email, name, uri;
+ SyndicationExtensions extensions = new SyndicationExtensions ();
+
public SyndicationPerson ()
{
- throw new NotImplementedException ();
}
- [MonoTODO]
- public SyndicationPerson (string name)
+ public SyndicationPerson (string email)
{
- throw new NotImplementedException ();
+ Email = email;
}
- [MonoTODO]
- public SyndicationPerson (string name, string scheme, string
label)
+ public SyndicationPerson (string email, string name, string uri)
{
- throw new NotImplementedException ();
+ Email = email;
+ Name = name;
+ Uri = uri;
}
- [MonoTODO]
protected SyndicationPerson (SyndicationPerson source)
{
- throw new NotImplementedException ();
+ if (source == null)
+ throw new ArgumentNullException ("source");
+ email = source.email;
+ name = source.name;
+ uri = source.uri;
+ extensions = source.extensions.Clone ();
}
- [MonoTODO]
public Dictionary<XmlQualifiedName, string> AttributeExtensions
{
- get { throw new NotImplementedException (); }
+ get { return extensions.Attributes; }
}
- [MonoTODO]
public SyndicationElementExtensionCollection ElementExtensions {
- get { throw new NotImplementedException (); }
+ get { return extensions.Elements; }
}
- [MonoTODO]
public string Email {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ get { return email; }
+ set { email = value; }
}
- [MonoTODO]
public string Name {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ get { return name; }
+ set { name = value; }
}
- [MonoTODO]
public string Uri {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ get { return uri; }
+ set { uri = value; }
}
- [MonoTODO]
public virtual SyndicationPerson Clone ()
{
- throw new NotImplementedException ();
+ return new SyndicationPerson (this);
}
[MonoTODO]
Modified:
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Web_test.dll.sources
===================================================================
---
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Web_test.dll.sources
2007-12-10 14:30:50 UTC (rev 91046)
+++
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Web_test.dll.sources
2007-12-10 15:01:58 UTC (rev 91047)
@@ -1,4 +1,8 @@
System.Runtime.Serialization.Json/DataContractJsonSerializerTest.cs
System.Runtime.Serialization.Json/JsonReaderTest.cs
System.Runtime.Serialization.Json/JsonWriterTest.cs
+System.ServiceModel.Syndication/Atom10ItemFormatterTest.cs
+System.ServiceModel.Syndication/Rss20ItemFormatterTest.cs
+System.ServiceModel.Syndication/SyndicationFeedTest.cs
+System.ServiceModel.Syndication/SyndicationItemTest.cs
System.ServiceModel.Syndication/SyndicationLinkTest.cs
Added:
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Syndication/Atom10ItemFormatterTest.cs
===================================================================
---
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Syndication/Atom10ItemFormatterTest.cs
2007-12-10 14:30:50 UTC (rev 91046)
+++
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Syndication/Atom10ItemFormatterTest.cs
2007-12-10 15:01:58 UTC (rev 91047)
@@ -0,0 +1,77 @@
+//
+// Atom10ItemFormatterTest.cs
+//
+// Author:
+// Atsushi Enomoto <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.IO;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Xml;
+using System.ServiceModel.Syndication;
+using NUnit.Framework;
+
+using QName = System.Xml.XmlQualifiedName;
+
+namespace MonoTests.System.ServiceModel.Syndication
+{
+ [TestFixture]
+ public class Atom10ItemFormatterTest
+ {
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void ConstructorNullItem ()
+ {
+ new Atom10ItemFormatter ((SyndicationItem) null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void ConstructorNullType ()
+ {
+ new Atom10ItemFormatter ((Type) null);
+ }
+
+ /*
+ [Test]
+ public void ItemType ()
+ {
+ Atom10ItemFormatter f = new Atom10ItemFormatter ();
+ Assert.IsNull (f.ItemType, "#1");
+ f = new Atom10ItemFormatter (new SyndicationItem ());
+ Assert.IsNull (f.ItemType, "#2");
+ }
+ */
+
+ [Test]
+ public void Version ()
+ {
+ Atom10ItemFormatter f = new Atom10ItemFormatter ();
+ Assert.AreEqual ("Atom10", f.Version, "#1");
+ }
+ }
+}
Property changes on:
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Syndication/Atom10ItemFormatterTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Modified:
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Syndication/ChangeLog
===================================================================
---
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Syndication/ChangeLog
2007-12-10 14:30:50 UTC (rev 91046)
+++
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Syndication/ChangeLog
2007-12-10 15:01:58 UTC (rev 91047)
@@ -1,5 +1,10 @@
2007-12-10 Atsushi Enomoto <[EMAIL PROTECTED]>
+ * Atom10ItemFormatterTest.cs, Rss20ItemFormatterTest.cs,
+ SyndicationFeedTest.cs, SyndicationItemTest.cs : new tests.
+
+2007-12-10 Atsushi Enomoto <[EMAIL PROTECTED]>
+
* SyndicationLinkTest.cs : test RelationshipType too. Tiny renaming.
2007-12-10 Atsushi Enomoto <[EMAIL PROTECTED]>
Added:
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Syndication/Rss20ItemFormatterTest.cs
===================================================================
---
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Syndication/Rss20ItemFormatterTest.cs
2007-12-10 14:30:50 UTC (rev 91046)
+++
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Syndication/Rss20ItemFormatterTest.cs
2007-12-10 15:01:58 UTC (rev 91047)
@@ -0,0 +1,84 @@
+//
+// Rss20ItemFormatterTest.cs
+//
+// Author:
+// Atsushi Enomoto <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.IO;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Xml;
+using System.ServiceModel.Syndication;
+using NUnit.Framework;
+
+using QName = System.Xml.XmlQualifiedName;
+
+namespace MonoTests.System.ServiceModel.Syndication
+{
+ [TestFixture]
+ public class Rss20ItemFormatterTest
+ {
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void ConstructorNullItem ()
+ {
+ new Rss20ItemFormatter ((SyndicationItem) null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void ConstructorNullType ()
+ {
+ new Rss20ItemFormatter ((Type) null);
+ }
+
+ /*
+ [Test]
+ public void ItemType ()
+ {
+ Rss20ItemFormatter f = new Rss20ItemFormatter ();
+ Assert.IsNull (f.ItemType, "#1");
+ f = new Rss20ItemFormatter (new SyndicationItem ());
+ Assert.IsNull (f.ItemType, "#2");
+ }
+ */
+
+ [Test]
+ public void Version ()
+ {
+ Rss20ItemFormatter f = new Rss20ItemFormatter ();
+ Assert.AreEqual ("Rss20", f.Version, "#1");
+ }
+
+ [Test]
+ public void SerializeExtensionsAsAtom ()
+ {
+ Rss20ItemFormatter f = new Rss20ItemFormatter ();
+ Assert.IsTrue (f.SerializeExtensionsAsAtom, "#1");
+ }
+ }
+}
Property changes on:
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Syndication/Rss20ItemFormatterTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Syndication/SyndicationFeedTest.cs
===================================================================
---
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Syndication/SyndicationFeedTest.cs
2007-12-10 14:30:50 UTC (rev 91046)
+++
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Syndication/SyndicationFeedTest.cs
2007-12-10 15:01:58 UTC (rev 91047)
@@ -0,0 +1,90 @@
+//
+// SyndicationFeedTest.cs
+//
+// Author:
+// Atsushi Enomoto <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.IO;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Xml;
+using System.ServiceModel.Syndication;
+using NUnit.Framework;
+
+using QName = System.Xml.XmlQualifiedName;
+
+namespace MonoTests.System.ServiceModel.Syndication
+{
+ [TestFixture]
+ public class SyndicationFeedTest
+ {
+ [Test]
+ public void ConstructorItemsNull ()
+ {
+ Assert.IsNotNull (new SyndicationFeed (null).Items,
"#1");
+ Assert.IsNotNull (new SyndicationFeed (null, null,
null, null).Items, "#2");
+ Assert.IsNotNull (new SyndicationFeed (null, null,
null, null, default (DateTimeOffset), null).Items, "#3");
+ }
+
+ [Test]
+ public void SetNullForProperties ()
+ {
+ SyndicationFeed feed = new SyndicationFeed ();
+ feed.BaseUri = null;
+ feed.Copyright = null;
+ feed.Id = null;
+ feed.Title = null;
+
+ feed.Description = null;
+ feed.Generator = null;
+ feed.ImageUrl = null;
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void SetItemsNull ()
+ {
+ SyndicationFeed feed = new SyndicationFeed ();
+ feed.Items = null;
+ }
+
+ [Test]
+ public void Items ()
+ {
+ SyndicationFeed feed = new SyndicationFeed ();
+ Assert.IsNotNull (feed.Items, "#1");
+ feed.Items = new SyndicationItem [] {new
SyndicationItem ()};
+ Assert.IsTrue (feed.Items.GetEnumerator ().MoveNext (),
"#2");
+ /*
+ feed.Items = null;
+ // even after setting null, it autofills a collection.
+ Assert.IsNotNull (feed.Items, "#3");
+ Assert.IsFalse (feed.Items.GetEnumerator ().MoveNext
(), "#4"); // make sure we reset it
+ */
+ }
+ }
+}
Property changes on:
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Syndication/SyndicationFeedTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Syndication/SyndicationItemTest.cs
===================================================================
---
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Syndication/SyndicationItemTest.cs
2007-12-10 14:30:50 UTC (rev 91046)
+++
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Syndication/SyndicationItemTest.cs
2007-12-10 15:01:58 UTC (rev 91047)
@@ -0,0 +1,125 @@
+//
+// SyndicationItemTest.cs
+//
+// Author:
+// Atsushi Enomoto <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.IO;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Xml;
+using System.ServiceModel.Syndication;
+using NUnit.Framework;
+
+using QName = System.Xml.XmlQualifiedName;
+
+namespace MonoTests.System.ServiceModel.Syndication
+{
+ [TestFixture]
+ public class SyndicationItemTest
+ {
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void AddPermalinkNull ()
+ {
+ SyndicationItem item = new SyndicationItem ();
+ item.AddPermalink (null);
+ }
+
+ [Test]
+ public void SetNullForProperties ()
+ {
+ SyndicationItem item = new SyndicationItem ();
+ item.BaseUri = null;
+ item.Copyright = null;
+ item.Content = null;
+ item.Id = null;
+ item.SourceFeed = null;
+ item.Summary = null;
+ item.Title = null;
+ }
+
+ [Test]
+ public void LastUpdatedTimeBeforePublishDate ()
+ {
+ SyndicationItem item = new SyndicationItem ();
+ item.PublishDate = new DateTimeOffset (new DateTime
(2007, 12, 10));
+ item.LastUpdatedTime = new DateTimeOffset (new DateTime
(2007, 12, 9));
+ }
+
+ [Test]
+ public void AddPermalink ()
+ {
+ SyndicationItem item = new SyndicationItem ();
+ Assert.AreEqual (0, item.Links.Count, "#1");
+ item.AddPermalink (new Uri
("http://mono-project.com/index.rss.20071210"));
+ Assert.AreEqual (1, item.Links.Count, "#2");
+ SyndicationLink link = item.Links [0];
+ Assert.AreEqual
("http://mono-project.com/index.rss.20071210", link.Uri.ToString (), "#3");
+ Assert.AreEqual ("alternate", link.RelationshipType,
"#4");
+ }
+
+ [Test]
+ public void Clone ()
+ {
+ SyndicationItem item = new SyndicationItem ();
+ item.AddPermalink (new Uri
("http://mono-project.com/index.rss.20071210"));
+ item.Id = Guid.NewGuid ().ToString ();
+ item.BaseUri = new Uri ("http://mono-project.com");
+ item.Authors.Add (new SyndicationPerson ("[EMAIL
PROTECTED]"));
+ item.SourceFeed = new SyndicationFeed ();
+ item.SourceFeed.Items = new SyndicationItem [] {new
SyndicationItem ()};
+
+ SyndicationItem clone = item.Clone ();
+ Assert.AreEqual (1, clone.Links.Count, "#1");
+ Assert.AreEqual (item.Id, clone.Id, "#2"); // hmm ...
+ Assert.AreEqual ("http://mono-project.com/",
clone.BaseUri.ToString (), "#3");
+
+ // LAMESPEC: .NET fails to clone it
+ // Assert.IsFalse (Object.ReferenceEquals
(item.BaseUri, clone.BaseUri), "#4"); // should not be just a shallow copy
+
+ Assert.IsNull (clone.Title, "#5");
+ Assert.IsNotNull (clone.SourceFeed, "#6");
+ Assert.IsFalse (Object.ReferenceEquals
(item.SourceFeed, clone.SourceFeed), "#7"); // ... not just a shallow copy??
+ // items in the SourceFeed are not cloned, but Items
property is not null
+ Assert.IsNotNull (clone.SourceFeed.Items, "#8-1");
+ Assert.IsFalse (clone.SourceFeed.Items.GetEnumerator
().MoveNext (), "#8-2");
+ Assert.AreEqual (1, clone.Authors.Count, "#9");
+ SyndicationPerson person = clone.Authors [0];
+ Assert.IsFalse (Object.ReferenceEquals (item.Authors
[0], person), "#10"); // should not be just a shallow copy
+ Assert.AreEqual ("[EMAIL PROTECTED]", person.Email,
"#11");
+ }
+
+ [Test]
+ public void GetRss20Formatter ()
+ {
+ SyndicationItem item = new SyndicationItem ();
+ Rss20ItemFormatter f = item.GetRss20Formatter ();
+ Assert.AreEqual (true, f.SerializeExtensionsAsAtom,
"#1");
+ }
+ }
+}
Property changes on:
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Syndication/SyndicationItemTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on:
trunk/olive/class/System.ServiceModel.Web/Test/System.ServiceModel.Syndication/SyndicationLinkTest.cs
___________________________________________________________________
Name: svn:executable
- *
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches