Author: joelreed
Date: 2007-05-30 20:52:47 -0400 (Wed, 30 May 2007)
New Revision: 78283
Added:
trunk/olive/class/System.ServiceModel.Web/
trunk/olive/class/System.ServiceModel.Web/Assembly/
trunk/olive/class/System.ServiceModel.Web/Assembly/AssemblyInfo.cs
trunk/olive/class/System.ServiceModel.Web/Atom10Serializer.cs
trunk/olive/class/System.ServiceModel.Web/Makefile
trunk/olive/class/System.ServiceModel.Web/README
trunk/olive/class/System.ServiceModel.Web/Rss20Serializer.cs
trunk/olive/class/System.ServiceModel.Web/SyndicationContent.cs
trunk/olive/class/System.ServiceModel.Web/SyndicationFeed.cs
trunk/olive/class/System.ServiceModel.Web/SyndicationItem.cs
trunk/olive/class/System.ServiceModel.Web/SyndicationLink.cs
trunk/olive/class/System.ServiceModel.Web/SyndicationSerializer.cs
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Web.dll.sources
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Web_test.dll.sources
trunk/olive/class/System.ServiceModel.Web/Test/
trunk/olive/class/System.ServiceModel.Web/Test/EmptyFeed.atom.xml
trunk/olive/class/System.ServiceModel.Web/Test/EmptyFeed.rss.xml
trunk/olive/class/System.ServiceModel.Web/Test/FeedLib.cs
trunk/olive/class/System.ServiceModel.Web/Test/FeedNoItems.atom.xml
trunk/olive/class/System.ServiceModel.Web/Test/FeedNoItems.rss.xml
trunk/olive/class/System.ServiceModel.Web/Test/FeedWithItems.atom.xml
trunk/olive/class/System.ServiceModel.Web/Test/FeedWithItems.rss.xml
trunk/olive/class/System.ServiceModel.Web/Test/SyndicationFeedTest.cs
trunk/olive/class/System.ServiceModel.Web/Test/SyndicationItemTest.cs
trunk/olive/class/System.ServiceModel.Web/Test/SyndicationSerializerTest.cs
trunk/olive/class/System.ServiceModel.Web/Test/SyndicationSerializerUtil.cs
trunk/olive/class/System.ServiceModel.Web/TextSyndicationContent.cs
trunk/olive/class/System.ServiceModel.Web/TextSyndicationContentKind.cs
Modified:
trunk/olive/class/ChangeLog
trunk/olive/class/Makefile
Log:
initial cut of System.ServiceModel.Web.dll
Modified: trunk/olive/class/ChangeLog
===================================================================
--- trunk/olive/class/ChangeLog 2007-05-31 00:44:13 UTC (rev 78282)
+++ trunk/olive/class/ChangeLog 2007-05-31 00:52:47 UTC (rev 78283)
@@ -1,3 +1,8 @@
+2007-05-30 Joel Reed <[EMAIL PROTECTED]>
+
+ * add initial code for System.ServiceModel.Web.dll, with
+ some initial Atom and Rss syndication feed writing code and tests
+
2007-05-28 Olivier Dufour <[EMAIL PROTECTED]>
* initial commit for javascript runtime and scripting lib
Modified: trunk/olive/class/Makefile
===================================================================
--- trunk/olive/class/Makefile 2007-05-31 00:44:13 UTC (rev 78282)
+++ trunk/olive/class/Makefile 2007-05-31 00:52:47 UTC (rev 78283)
@@ -16,7 +16,8 @@
System.Runtime.Serialization \
System.IdentityModel \
System.IdentityModel.Selectors \
- System.ServiceModel
+ System.ServiceModel \
+ System.ServiceModel.Web
DIST_PROFILE_DIRS = net_3_0
Added: trunk/olive/class/System.ServiceModel.Web/Assembly/AssemblyInfo.cs
===================================================================
--- trunk/olive/class/System.ServiceModel.Web/Assembly/AssemblyInfo.cs
2007-05-31 00:44:13 UTC (rev 78282)
+++ trunk/olive/class/System.ServiceModel.Web/Assembly/AssemblyInfo.cs
2007-05-31 00:52:47 UTC (rev 78283)
@@ -0,0 +1,57 @@
+//
+// AssemblyInfo.cs
+//
+// Author:
+// Joel W. Reed ([EMAIL PROTECTED])
+//
+
+//
+// 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.Reflection;
+using System.Resources;
+using System.Security;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about the System.ServiceModel assembly
+
+[assembly: AssemblyVersion (Consts.FxVersion)]
+[assembly: SatelliteContractVersion (Consts.FxVersion)]
+
+[assembly: AssemblyTitle ("System.ServiceModel.Web.dll")]
+[assembly: AssemblyDescription ("System.ServiceModel.Web.dll")]
+[assembly: AssemblyConfiguration ("Development version")]
+[assembly: AssemblyCompany ("MONO development team")]
+[assembly: AssemblyProduct ("MONO CLI")]
+[assembly: AssemblyCopyright ("(c) 2003 Various Authors")]
+[assembly: AssemblyTrademark ("")]
+
+[assembly: CLSCompliant (true)]
+[assembly: AssemblyDefaultAlias ("System.ServiceModel.Web.dll")]
+[assembly: AssemblyInformationalVersion ("0.0.0.1")]
+[assembly: NeutralResourcesLanguage ("en-US")]
+
+[assembly: ComVisible (false)]
+
+[assembly: AssemblyDelaySign (true)]
+[assembly: AssemblyKeyFile("../winfx.pub")]
Added: trunk/olive/class/System.ServiceModel.Web/Atom10Serializer.cs
===================================================================
--- trunk/olive/class/System.ServiceModel.Web/Atom10Serializer.cs
2007-05-31 00:44:13 UTC (rev 78282)
+++ trunk/olive/class/System.ServiceModel.Web/Atom10Serializer.cs
2007-05-31 00:52:47 UTC (rev 78283)
@@ -0,0 +1,84 @@
+//
+// System.ServiceModel.Syndication.Atom10Serializer
+//
+// Authors:
+// Joel Reed ([EMAIL PROTECTED])
+//
+
+//
+// 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.Globalization;
+using System.Xml;
+
+namespace System.ServiceModel.Syndication
+{
+ public class Atom10Serializer : SyndicationSerializer
+ {
+ internal override void WriteXml(XmlWriter writer,
SyndicationFeed feed)
+ {
+ writer.WriteStartElement(FeedName, FeedNamespace);
+
+ WriteXml(writer, feed.Title, "title", true);
+ writer.WriteElementString("id", feed.Id);
+
+ string updated =
feed.LastUpdatedTime.ToUniversalTime().ToString("s");
+ writer.WriteElementString("updated", updated + "Z");
+
+ WriteXml(writer, feed.Description, "summary");
+
+ foreach (SyndicationItem item in feed.Items)
+ {
+ WriteTo(writer, item);
+ }
+
+ writer.WriteEndElement();
+ }
+
+ internal override void WriteXml(XmlWriter writer,
SyndicationItem item)
+ {
+ writer.WriteStartElement(ItemName, ItemNamespace);
+ writer.WriteElementString("id", item.Id);
+ WriteXml(writer, item.Title, "title");
+ WriteXml(writer, item.Summary, "summary");
+ writer.WriteEndElement();
+ }
+
+ protected override string FeedName {
+ get { return "feed"; }
+ }
+
+ protected override string FeedNamespace {
+ get { return "http://www.w3.org/2005/Atom"; }
+ }
+
+ protected override string ItemName {
+ get { return "entry"; }
+ }
+
+ protected override string ItemNamespace {
+ get { return "http://www.w3.org/2005/Atom"; }
+ }
+
+ }
+}
+
Added: trunk/olive/class/System.ServiceModel.Web/Makefile
===================================================================
--- trunk/olive/class/System.ServiceModel.Web/Makefile 2007-05-31 00:44:13 UTC
(rev 78282)
+++ trunk/olive/class/System.ServiceModel.Web/Makefile 2007-05-31 00:52:47 UTC
(rev 78283)
@@ -0,0 +1,29 @@
+thisdir = class/System.ServiceModel.Web
+SUBDIRS =
+include ../../build/rules.make
+
+LIBRARY = System.ServiceModel.Web.dll
+LIB_MCS_FLAGS = -r:System.dll -r:System.Xml.dll
+
+TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
+
+EXTRA_DISTFILES = $(RESOURCE_FILES)
+
+# This is a WinFX only assembly
+VALID_PROFILE := $(filter net_3_0, $(PROFILE))
+ifndef VALID_PROFILE
+LIBRARY_NAME = dummy-System.ServiceModel.Web.dll
+NO_INSTALL = yes
+NO_SIGN_ASSEMBLY = yes
+NO_TEST = yes
+endif
+
+test-data-ondotnet:
+ csc -out:SyndicationSerializerUtil.exe -r:System.ServiceModel.Web.dll
$(LIB_MCS_FLAGS) Test\\SyndicationSerializerUtil.cs
Test\\SyndicationSerializerLib.cs
+ ./SyndicationSerializerUtil.exe
+
+test-data:
+ $(LIBRARY_COMPILE) Test/SyndicationSerializerUtil.cs
Test/SyndicationSerializerLib.cs -out:SyndicationSerializerUtil.exe
-r:System.ServiceModel.Web.dll $(LIB_MCS_FLAGS)
+ ./SyndicationSerializerUtil.exe
+
+include ../../build/library.make
Added: trunk/olive/class/System.ServiceModel.Web/README
===================================================================
--- trunk/olive/class/System.ServiceModel.Web/README 2007-05-31 00:44:13 UTC
(rev 78282)
+++ trunk/olive/class/System.ServiceModel.Web/README 2007-05-31 00:52:47 UTC
(rev 78283)
@@ -0,0 +1,4 @@
+Some documentation on the System.ServiceModel.Syndication namespace
+can be found here:
+
+http://msdn2.microsoft.com/en-us/library/bb357210(VS.90).aspx
\ No newline at end of file
Added: trunk/olive/class/System.ServiceModel.Web/Rss20Serializer.cs
===================================================================
--- trunk/olive/class/System.ServiceModel.Web/Rss20Serializer.cs
2007-05-31 00:44:13 UTC (rev 78282)
+++ trunk/olive/class/System.ServiceModel.Web/Rss20Serializer.cs
2007-05-31 00:52:47 UTC (rev 78283)
@@ -0,0 +1,79 @@
+//
+// System.ServiceModel.Syndication.Rss20Serializer
+//
+// Authors:
+// Joel Reed ([EMAIL PROTECTED])
+//
+
+//
+// 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.Xml;
+
+namespace System.ServiceModel.Syndication
+{
+ public class Rss20Serializer : SyndicationSerializer
+ {
+ internal override void WriteXml(XmlWriter writer,
SyndicationFeed feed)
+ {
+ writer.WriteStartElement(FeedName, FeedNamespace);
+ writer.WriteElementString("id", feed.Id);
+
+ WriteXml(writer, feed.Title, "title");
+ WriteXml(writer, feed.Description, "description");
+
+ foreach (SyndicationItem item in feed.Items)
+ {
+ WriteTo(writer, item);
+ }
+
+ writer.WriteEndElement();
+ }
+
+ internal override void WriteXml(XmlWriter writer,
SyndicationItem item)
+ {
+ writer.WriteStartElement(ItemName, ItemNamespace);
+ writer.WriteElementString("guid", item.Id);
+ WriteXml(writer, item.Title, "title");
+ WriteXml(writer, item.Summary, "description");
+ writer.WriteEndElement();
+ }
+
+ protected override string FeedName {
+ get { return "channel"; }
+ }
+
+ protected override string FeedNamespace {
+ get { return ""; }
+ }
+
+ protected override string ItemName {
+ get { return "item"; }
+ }
+
+ protected override string ItemNamespace {
+ get { return ""; }
+ }
+
+ }
+}
+
Added: trunk/olive/class/System.ServiceModel.Web/SyndicationContent.cs
===================================================================
--- trunk/olive/class/System.ServiceModel.Web/SyndicationContent.cs
2007-05-31 00:44:13 UTC (rev 78282)
+++ trunk/olive/class/System.ServiceModel.Web/SyndicationContent.cs
2007-05-31 00:52:47 UTC (rev 78283)
@@ -0,0 +1,55 @@
+//
+// System.ServiceModel.Syndication.SyndicationContent
+//
+// Authors:
+// Joel Reed ([EMAIL PROTECTED])
+//
+
+//
+// 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.Xml;
+
+namespace System.ServiceModel.Syndication
+{
+ public abstract class SyndicationContent
+ {
+ public static TextSyndicationContent
CreatePlaintextTextSyndicationContent (string content)
+ {
+ return new TextSyndicationContent(content);
+ }
+
+ public void WriteTo (XmlWriter writer, string outerElementName,
+
string outerElementNameNs)
+ {
+ writer.WriteStartElement(outerElementName,
outerElementNameNs);
+ writer.WriteAttributeString("type", Type);
+ WriteContentsTo(writer);
+ writer.WriteEndElement();
+ }
+
+ public abstract string Type { get; }
+
+ protected abstract void WriteContentsTo (XmlWriter writer);
+ }
+}
+
Added: trunk/olive/class/System.ServiceModel.Web/SyndicationFeed.cs
===================================================================
--- trunk/olive/class/System.ServiceModel.Web/SyndicationFeed.cs
2007-05-31 00:44:13 UTC (rev 78282)
+++ trunk/olive/class/System.ServiceModel.Web/SyndicationFeed.cs
2007-05-31 00:52:47 UTC (rev 78283)
@@ -0,0 +1,123 @@
+//
+// System.ServiceModel.Syndication.SyndicationFeed
+//
+// Authors:
+// Joel Reed ([EMAIL PROTECTED])
+//
+
+//
+// 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.Xml;
+using System.Collections.ObjectModel;
+
+namespace System.ServiceModel.Syndication
+{
+ public class SyndicationFeed
+ {
+ private string id;
+ private TextSyndicationContent description;
+ private TextSyndicationContent title;
+ private Collection<SyndicationItem> items;
+ private DateTime lastUpdatedTime;
+ private TextSyndicationContent copyright;
+ private string generator;
+ private string language;
+ private Uri imageUrl;
+ private Collection<SyndicationLink> links;
+
+ public SyndicationFeed()
+ {
+ items = new Collection<SyndicationItem>();
+ links = new Collection<SyndicationLink>();
+ lastUpdatedTime = DateTime.Now.ToUniversalTime();
+ }
+
+ public SyndicationFeed(string title, string description,
+
Uri feedAlternateLink) : this()
+ {
+ this.title = new TextSyndicationContent(title);
+ this.description = new
TextSyndicationContent(description);
+
links.Add(SyndicationLink.CreateAlternateLink(feedAlternateLink));
+ }
+
+ public void WriteTo(XmlWriter writer, SyndicationSerializer
serializer)
+ {
+ serializer.WriteTo(writer, this);
+ }
+
+ public string Id
+ {
+ get { return id; }
+ set { id = value; }
+ }
+
+ public TextSyndicationContent Copyright
+ {
+ get { return copyright; }
+ set { copyright = value; }
+ }
+
+ public string Generator
+ {
+ get { return generator; }
+ set { generator = value; }
+ }
+
+ public string Language
+ {
+ get { return language; }
+ set { language = value; }
+ }
+
+ public DateTime LastUpdatedTime
+ {
+ get { return lastUpdatedTime; }
+ set { lastUpdatedTime = value; }
+ }
+
+ public Uri ImageUrl
+ {
+ get { return imageUrl; }
+ set { imageUrl = value; }
+ }
+
+ public Collection<SyndicationItem> Items {
+ get { return items; }
+ }
+
+ public Collection<SyndicationLink> Links {
+ get { return links; }
+ }
+
+ public TextSyndicationContent Description {
+ get { return description; }
+ set { description = value; }
+ }
+
+ public TextSyndicationContent Title {
+ get { return title; }
+ set { title = value; }
+ }
+ }
+}
+
Added: trunk/olive/class/System.ServiceModel.Web/SyndicationItem.cs
===================================================================
--- trunk/olive/class/System.ServiceModel.Web/SyndicationItem.cs
2007-05-31 00:44:13 UTC (rev 78282)
+++ trunk/olive/class/System.ServiceModel.Web/SyndicationItem.cs
2007-05-31 00:52:47 UTC (rev 78283)
@@ -0,0 +1,98 @@
+//
+// System.ServiceModel.Syndication.SyndicationItem
+//
+// Authors:
+// Joel Reed ([EMAIL PROTECTED])
+//
+
+//
+// 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.Xml;
+
+namespace System.ServiceModel.Syndication
+{
+ public class SyndicationItem
+ {
+ private string id;
+ private TextSyndicationContent summary;
+ private TextSyndicationContent title;
+ private SyndicationContent content;
+ private SyndicationFeed sourceFeed;
+ private DateTime publishDate;
+ private DateTime lastUpdatedTime;
+ private TextSyndicationContent copyright;
+
+ public void WriteTo(XmlWriter writer, SyndicationSerializer
serializer)
+ {
+ serializer.WriteTo(writer, this);
+ }
+
+ public string Id
+ {
+ get { return id; }
+ set { id = value; }
+ }
+
+ public SyndicationContent Content
+ {
+ get { return content; }
+ set { content = value; }
+ }
+
+ public TextSyndicationContent Copyright
+ {
+ get { return copyright; }
+ set { copyright = value; }
+ }
+
+ public DateTime LastUpdatedTime
+ {
+ get { return lastUpdatedTime; }
+ set { lastUpdatedTime = value; }
+ }
+
+ public DateTime PublishDate
+ {
+ get { return publishDate; }
+ set { publishDate = value; }
+ }
+
+ public SyndicationFeed SourceFeed
+ {
+ get { return sourceFeed; }
+ set { sourceFeed = value; }
+ }
+
+ public TextSyndicationContent Summary {
+ get { return summary; }
+ set { summary = value; }
+ }
+
+ public TextSyndicationContent Title {
+ get { return title; }
+ set { title = value; }
+ }
+
+ }
+}
+
Added: trunk/olive/class/System.ServiceModel.Web/SyndicationLink.cs
===================================================================
--- trunk/olive/class/System.ServiceModel.Web/SyndicationLink.cs
2007-05-31 00:44:13 UTC (rev 78282)
+++ trunk/olive/class/System.ServiceModel.Web/SyndicationLink.cs
2007-05-31 00:52:47 UTC (rev 78283)
@@ -0,0 +1,62 @@
+//
+// System.ServiceModel.Syndication.SyndicationLink
+//
+// Authors:
+// Joel Reed ([EMAIL PROTECTED])
+//
+
+//
+// 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.Xml;
+
+namespace System.ServiceModel.Syndication
+{
+ public class SyndicationLink
+ {
+ private Uri uri;
+ private string relationshipType;
+
+ public SyndicationLink(Uri uri)
+ {
+ this.uri = uri;
+ }
+
+ public Uri Uri
+ {
+ get { return uri; }
+ set { uri = value; }
+ }
+
+ public string RelationshipType
+ {
+ get { return relationshipType; }
+ set { relationshipType = value; }
+ }
+
+ public static SyndicationLink CreateAlternateLink(Uri uri)
+ {
+ return new SyndicationLink(uri);
+ }
+ }
+}
+
Added: trunk/olive/class/System.ServiceModel.Web/SyndicationSerializer.cs
===================================================================
--- trunk/olive/class/System.ServiceModel.Web/SyndicationSerializer.cs
2007-05-31 00:44:13 UTC (rev 78282)
+++ trunk/olive/class/System.ServiceModel.Web/SyndicationSerializer.cs
2007-05-31 00:52:47 UTC (rev 78283)
@@ -0,0 +1,78 @@
+//
+// System.ServiceModel.Syndication.SyndicationSerializer
+//
+// Authors:
+// Joel Reed ([EMAIL PROTECTED])
+//
+
+//
+// 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.Xml;
+
+namespace System.ServiceModel.Syndication
+{
+ public abstract class SyndicationSerializer
+ {
+ protected abstract string FeedName { get; }
+ protected abstract string FeedNamespace { get; }
+
+ protected abstract string ItemName { get; }
+ protected abstract string ItemNamespace { get; }
+
+ internal abstract void WriteXml(XmlWriter writer,
SyndicationFeed feed);
+ internal abstract void WriteXml(XmlWriter writer,
SyndicationItem item);
+
+ public void WriteTo(XmlWriter writer, SyndicationFeed feed)
+ {
+ WriteXml(writer, feed);
+ }
+
+ public void WriteTo(XmlWriter writer, SyndicationItem item)
+ {
+ WriteXml(writer, item);
+ }
+
+ internal void WriteXml(XmlWriter writer, SyndicationContent
content,
+
string outerElementName)
+ {
+ WriteXml(writer, content, outerElementName, false);
+ }
+
+ internal void WriteXml(XmlWriter writer, SyndicationContent
content,
+
string outerElementName, bool writeEmptyNodes)
+ {
+ if (content != null)
+ {
+ content.WriteTo(writer,
outerElementName, FeedNamespace);
+ return;
+ }
+
+ if (!writeEmptyNodes) return;
+
+ // write out empty node if necessary
+ TextSyndicationContent emptyNode = new
TextSyndicationContent("");
+ emptyNode.WriteTo(writer, outerElementName,
FeedNamespace);
+ }
+ }
+}
+
Added:
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Web.dll.sources
===================================================================
---
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Web.dll.sources
2007-05-31 00:44:13 UTC (rev 78282)
+++
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Web.dll.sources
2007-05-31 00:52:47 UTC (rev 78283)
@@ -0,0 +1,13 @@
+../../build/common/Consts.cs
+../../build/common/Locale.cs
+../../build/common/MonoTODOAttribute.cs
+Assembly/AssemblyInfo.cs
+SyndicationFeed.cs
+SyndicationItem.cs
+Atom10Serializer.cs
+TextSyndicationContent.cs
+SyndicationContent.cs
+TextSyndicationContentKind.cs
+SyndicationSerializer.cs
+Rss20Serializer.cs
+SyndicationLink.cs
Added:
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-05-31 00:44:13 UTC (rev 78282)
+++
trunk/olive/class/System.ServiceModel.Web/System.ServiceModel.Web_test.dll.sources
2007-05-31 00:52:47 UTC (rev 78283)
@@ -0,0 +1,4 @@
+SyndicationFeedTest.cs
+SyndicationItemTest.cs
+FeedLib.cs
+SyndicationSerializerTest.cs
Added: trunk/olive/class/System.ServiceModel.Web/Test/EmptyFeed.atom.xml
===================================================================
--- trunk/olive/class/System.ServiceModel.Web/Test/EmptyFeed.atom.xml
2007-05-31 00:44:13 UTC (rev 78282)
+++ trunk/olive/class/System.ServiceModel.Web/Test/EmptyFeed.atom.xml
2007-05-31 00:52:47 UTC (rev 78283)
@@ -0,0 +1,5 @@
+<feed xmlns="http://www.w3.org/2005/Atom">
+ <title type="text" />
+ <id>Id should be guid if not set</id>
+ <updated>2000-05-12T04:00:00Z</updated>
+</feed>
\ No newline at end of file
Added: trunk/olive/class/System.ServiceModel.Web/Test/EmptyFeed.rss.xml
===================================================================
--- trunk/olive/class/System.ServiceModel.Web/Test/EmptyFeed.rss.xml
2007-05-31 00:44:13 UTC (rev 78282)
+++ trunk/olive/class/System.ServiceModel.Web/Test/EmptyFeed.rss.xml
2007-05-31 00:52:47 UTC (rev 78283)
@@ -0,0 +1,8 @@
+<rss xmlns:a10="http://www.w3.org/2005/Atom" version="2.0">
+ <channel>
+ <title />
+ <description />
+ <lastBuildDate>Fri, 12 May 2000 04:00:00 Z</lastBuildDate>
+ <a10:id>Id should be guid if not set</a10:id>
+ </channel>
+</rss>
\ No newline at end of file
Added: trunk/olive/class/System.ServiceModel.Web/Test/FeedLib.cs
===================================================================
--- trunk/olive/class/System.ServiceModel.Web/Test/FeedLib.cs 2007-05-31
00:44:13 UTC (rev 78282)
+++ trunk/olive/class/System.ServiceModel.Web/Test/FeedLib.cs 2007-05-31
00:52:47 UTC (rev 78283)
@@ -0,0 +1,54 @@
+using System;
+using System.IO;
+using System.Xml;
+using System.ServiceModel.Syndication;
+
+class FeedLib
+{
+ public static readonly DateTime FixedChangedDate = new DateTime(2000,
5, 12, 0, 0, 0);
+
+ public static SyndicationFeed EmptyFeed
+ {
+ get {
+ SyndicationFeed f = new SyndicationFeed();
+ f.Id = "Id should be guid if not set";
+ return f;
+ }
+ }
+
+ public static SyndicationFeed FeedNoItems
+ {
+ get {
+ SyndicationFeed f = new SyndicationFeed();
+ f.Id = "FeedNoItems";
+ f.Title =
SyndicationContent.CreatePlaintextTextSyndicationContent("Sample Title");
+ return f;
+ }
+ }
+
+ public static SyndicationFeed FeedWithItems
+ {
+ get {
+ SyndicationFeed f = new SyndicationFeed();
+ f.Id = "Id should be guid if not set";
+ f.Title =
SyndicationContent.CreatePlaintextTextSyndicationContent("Words in a popular
panagram.");
+
+ string words = "The quick brown fox jumps over the lazy
dog";
+ int indx = 0;
+ foreach (string p in words.Split(' '))
+ {
+ SyndicationItem i = new
SyndicationItem();
+
+ i.Id = indx.ToString();
+ indx++;
+
+ i.Title =
SyndicationContent.CreatePlaintextTextSyndicationContent(p);
+ i.Summary = new
TextSyndicationContent(String.Format("<b>{0} in bold letters</b>", p),
TextSyndicationContentKind.Html);
+
+ f.Items.Add(i);
+ }
+
+ return f;
+ }
+ }
+}
Added: trunk/olive/class/System.ServiceModel.Web/Test/FeedNoItems.atom.xml
===================================================================
--- trunk/olive/class/System.ServiceModel.Web/Test/FeedNoItems.atom.xml
2007-05-31 00:44:13 UTC (rev 78282)
+++ trunk/olive/class/System.ServiceModel.Web/Test/FeedNoItems.atom.xml
2007-05-31 00:52:47 UTC (rev 78283)
@@ -0,0 +1,5 @@
+<feed xmlns="http://www.w3.org/2005/Atom">
+ <title type="text">Sample Title</title>
+ <id>FeedNoItems</id>
+ <updated>2000-05-12T04:00:00Z</updated>
+</feed>
\ No newline at end of file
Added: trunk/olive/class/System.ServiceModel.Web/Test/FeedNoItems.rss.xml
===================================================================
--- trunk/olive/class/System.ServiceModel.Web/Test/FeedNoItems.rss.xml
2007-05-31 00:44:13 UTC (rev 78282)
+++ trunk/olive/class/System.ServiceModel.Web/Test/FeedNoItems.rss.xml
2007-05-31 00:52:47 UTC (rev 78283)
@@ -0,0 +1,8 @@
+<rss xmlns:a10="http://www.w3.org/2005/Atom" version="2.0">
+ <channel>
+ <title>Sample Title</title>
+ <description />
+ <lastBuildDate>Fri, 12 May 2000 04:00:00 Z</lastBuildDate>
+ <a10:id>FeedNoItems</a10:id>
+ </channel>
+</rss>
\ No newline at end of file
Added: trunk/olive/class/System.ServiceModel.Web/Test/FeedWithItems.atom.xml
===================================================================
--- trunk/olive/class/System.ServiceModel.Web/Test/FeedWithItems.atom.xml
2007-05-31 00:44:13 UTC (rev 78282)
+++ trunk/olive/class/System.ServiceModel.Web/Test/FeedWithItems.atom.xml
2007-05-31 00:52:47 UTC (rev 78283)
@@ -0,0 +1,50 @@
+<feed xmlns="http://www.w3.org/2005/Atom">
+ <title type="text">Words in a popular panagram.</title>
+ <id>Id should be guid if not set</id>
+ <updated>2000-05-12T04:00:00Z</updated>
+ <entry>
+ <id>0</id>
+ <title type="text">The</title>
+ <summary type="html"><b>The in bold letters</b></summary>
+ </entry>
+ <entry>
+ <id>1</id>
+ <title type="text">quick</title>
+ <summary type="html"><b>quick in bold letters</b></summary>
+ </entry>
+ <entry>
+ <id>2</id>
+ <title type="text">brown</title>
+ <summary type="html"><b>brown in bold letters</b></summary>
+ </entry>
+ <entry>
+ <id>3</id>
+ <title type="text">fox</title>
+ <summary type="html"><b>fox in bold letters</b></summary>
+ </entry>
+ <entry>
+ <id>4</id>
+ <title type="text">jumps</title>
+ <summary type="html"><b>jumps in bold letters</b></summary>
+ </entry>
+ <entry>
+ <id>5</id>
+ <title type="text">over</title>
+ <summary type="html"><b>over in bold letters</b></summary>
+ </entry>
+ <entry>
+ <id>6</id>
+ <title type="text">the</title>
+ <summary type="html"><b>the in bold letters</b></summary>
+ </entry>
+ <entry>
+ <id>7</id>
+ <title type="text">lazy</title>
+ <summary type="html"><b>lazy in bold letters</b></summary>
+ </entry>
+ <entry>
+ <id>8</id>
+ <title type="text">dog</title>
+ <summary type="html"><b>dog in bold letters</b></summary>
+ </entry>
+</feed>
\ No newline at end of file
Added: trunk/olive/class/System.ServiceModel.Web/Test/FeedWithItems.rss.xml
===================================================================
--- trunk/olive/class/System.ServiceModel.Web/Test/FeedWithItems.rss.xml
2007-05-31 00:44:13 UTC (rev 78282)
+++ trunk/olive/class/System.ServiceModel.Web/Test/FeedWithItems.rss.xml
2007-05-31 00:52:47 UTC (rev 78283)
@@ -0,0 +1,53 @@
+<rss xmlns:a10="http://www.w3.org/2005/Atom" version="2.0">
+ <channel>
+ <title>Words in a popular panagram.</title>
+ <description />
+ <lastBuildDate>Fri, 12 May 2000 04:00:00 Z</lastBuildDate>
+ <a10:id>Id should be guid if not set</a10:id>
+ <item>
+ <guid isPermaLink="false">0</guid>
+ <title>The</title>
+ <description><b>The in bold letters</b></description>
+ </item>
+ <item>
+ <guid isPermaLink="false">1</guid>
+ <title>quick</title>
+ <description><b>quick in bold letters</b></description>
+ </item>
+ <item>
+ <guid isPermaLink="false">2</guid>
+ <title>brown</title>
+ <description><b>brown in bold letters</b></description>
+ </item>
+ <item>
+ <guid isPermaLink="false">3</guid>
+ <title>fox</title>
+ <description><b>fox in bold letters</b></description>
+ </item>
+ <item>
+ <guid isPermaLink="false">4</guid>
+ <title>jumps</title>
+ <description><b>jumps in bold letters</b></description>
+ </item>
+ <item>
+ <guid isPermaLink="false">5</guid>
+ <title>over</title>
+ <description><b>over in bold letters</b></description>
+ </item>
+ <item>
+ <guid isPermaLink="false">6</guid>
+ <title>the</title>
+ <description><b>the in bold letters</b></description>
+ </item>
+ <item>
+ <guid isPermaLink="false">7</guid>
+ <title>lazy</title>
+ <description><b>lazy in bold letters</b></description>
+ </item>
+ <item>
+ <guid isPermaLink="false">8</guid>
+ <title>dog</title>
+ <description><b>dog in bold letters</b></description>
+ </item>
+ </channel>
+</rss>
\ No newline at end of file
Added: trunk/olive/class/System.ServiceModel.Web/Test/SyndicationFeedTest.cs
===================================================================
--- trunk/olive/class/System.ServiceModel.Web/Test/SyndicationFeedTest.cs
2007-05-31 00:44:13 UTC (rev 78282)
+++ trunk/olive/class/System.ServiceModel.Web/Test/SyndicationFeedTest.cs
2007-05-31 00:52:47 UTC (rev 78283)
@@ -0,0 +1,72 @@
+//
+// Microsoft.TeamFoundation.VersionControl.Client.SyndicationFeedTest
+//
+// Authors:
+// Joel Reed ([EMAIL PROTECTED])
+//
+
+//
+// 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.IO;
+using System.Net;
+using System.ServiceModel.Syndication;
+
+namespace System.ServiceModel.Syndication
+{
+ using NUnit.Framework;
+
+ [TestFixture]
+ public class SyndicationFeedTest
+ {
+ [Test]
+ public void SyndicationFeed_EmptyConstructor()
+ {
+ SyndicationFeed feed = new SyndicationFeed();
+ Assert.IsNull(feed.Id);
+ Assert.IsNull(feed.Title);
+ Assert.IsNull(feed.Description);
+ Assert.IsNotNull(feed.LastUpdatedTime);
+ Assert.IsNull(feed.Copyright);
+ Assert.IsNull(feed.Generator);
+ Assert.IsNull(feed.Language);
+ Assert.IsNull(feed.ImageUrl);
+ }
+
+ [Test]
+ public void SyndicationFeed_3ArgConstructor()
+ {
+ SyndicationFeed feed = new SyndicationFeed("title",
"description", new Uri("http://www.go-mono.com"));
+ Assert.IsNull(feed.Id);
+ Assert.IsNotNull(feed.LastUpdatedTime);
+ Assert.IsNull(feed.Copyright);
+ Assert.IsNull(feed.Generator);
+ Assert.IsNull(feed.Language);
+ Assert.IsNull(feed.ImageUrl);
+
+ Assert.AreEqual(feed.Title.Text, "title");
+ Assert.AreEqual(feed.Description.Text, "description");
+ Assert.AreEqual(feed.Links.Count, 1);
+ }
+ }
+}
+
Added: trunk/olive/class/System.ServiceModel.Web/Test/SyndicationItemTest.cs
===================================================================
--- trunk/olive/class/System.ServiceModel.Web/Test/SyndicationItemTest.cs
2007-05-31 00:44:13 UTC (rev 78282)
+++ trunk/olive/class/System.ServiceModel.Web/Test/SyndicationItemTest.cs
2007-05-31 00:52:47 UTC (rev 78283)
@@ -0,0 +1,56 @@
+//
+// Microsoft.TeamFoundation.VersionControl.Client.SyndicationItemTest
+//
+// Authors:
+// Joel Reed ([EMAIL PROTECTED])
+//
+
+//
+// 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.IO;
+using System.Net;
+using System.ServiceModel.Syndication;
+
+namespace System.ServiceModel.Syndication
+{
+ using NUnit.Framework;
+
+ [TestFixture]
+ public class SyndicationItemTest
+ {
+ [Test]
+ public void SyndicationItem_EmptyConstructor()
+ {
+ SyndicationItem item = new SyndicationItem();
+ Assert.IsNull(item.Id);
+ Assert.IsNull(item.Title);
+ Assert.IsNull(item.Summary);
+ Assert.IsNull(item.Content);
+ Assert.IsNull(item.SourceFeed);
+ Assert.IsNotNull(item.PublishDate);
+ Assert.IsNotNull(item.LastUpdatedTime);
+ Assert.IsNull(item.Copyright);
+ }
+ }
+}
+
Added:
trunk/olive/class/System.ServiceModel.Web/Test/SyndicationSerializerTest.cs
===================================================================
--- trunk/olive/class/System.ServiceModel.Web/Test/SyndicationSerializerTest.cs
2007-05-31 00:44:13 UTC (rev 78282)
+++ trunk/olive/class/System.ServiceModel.Web/Test/SyndicationSerializerTest.cs
2007-05-31 00:52:47 UTC (rev 78283)
@@ -0,0 +1,105 @@
+//
+// Microsoft.TeamFoundation.VersionControl.Client.SyndicationSerializerTest
+//
+// Authors:
+// Joel Reed ([EMAIL PROTECTED])
+//
+
+//
+// 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.IO;
+using System.Net;
+using System.Xml;
+using System.ServiceModel.Syndication;
+
+namespace System.ServiceModel.Syndication
+{
+ using NUnit.Framework;
+
+ [TestFixture]
+ public class SyndicationSerializerTest
+ {
+ string FileToString(string path)
+ {
+ string x;
+
+ using (StreamReader sr = new StreamReader(path))
+ {
+ x = sr.ReadToEnd();
+ }
+
+ return x;
+ }
+
+ string AtomFeedToString(string id)
+ {
+ return FileToString(String.Format("Test/{0}.atom.xml",
id));
+ }
+
+ string RssFeedToString(string id)
+ {
+ return FileToString(String.Format("Test/{0}.rss.xml",
id));
+ }
+
+ string SyndicationFeedToString(SyndicationFeed f)
+ {
+ // try to keep the time here stable so it doesn't trip
up the string compare
+ f.LastUpdatedTime = FeedLib.FixedChangedDate;
+
+ StringWriter strWriter = new StringWriter();
+ using (XmlTextWriter writer = new
XmlTextWriter(strWriter))
+ {
+ writer.Formatting = Formatting.Indented;
+ Atom10Serializer serializer = new
Atom10Serializer();
+ serializer.WriteTo(writer, f);
+ }
+
+ return strWriter.ToString();
+ }
+
+ [Test]
+ public void Serialize_EmptyFeed()
+ {
+ string a1 = AtomFeedToString("EmptyFeed");
+ string a2 = SyndicationFeedToString(FeedLib.EmptyFeed);
+ Assert.AreEqual(a1, a2);
+ }
+
+ [Test]
+ public void Serialize_FeedNoItems()
+ {
+ string a1 = AtomFeedToString("FeedNoItems");
+ string a2 =
SyndicationFeedToString(FeedLib.FeedNoItems);
+ Assert.AreEqual(a1, a2);
+ }
+
+ [Test]
+ public void Serialize_FeedWithItems()
+ {
+ string a1 = AtomFeedToString("FeedWithItems");
+ string a2 =
SyndicationFeedToString(FeedLib.FeedWithItems);
+ Assert.AreEqual(a1, a2);
+ }
+ }
+}
+
Added:
trunk/olive/class/System.ServiceModel.Web/Test/SyndicationSerializerUtil.cs
===================================================================
--- trunk/olive/class/System.ServiceModel.Web/Test/SyndicationSerializerUtil.cs
2007-05-31 00:44:13 UTC (rev 78282)
+++ trunk/olive/class/System.ServiceModel.Web/Test/SyndicationSerializerUtil.cs
2007-05-31 00:52:47 UTC (rev 78283)
@@ -0,0 +1,36 @@
+using System;
+
+class SyndicationSerializerUtil
+{
+ private static int feedIndx = 0;
+
+ public static void DumpFeed(SyndicationFeed f, string label)
+ {
+ string path = Path.Combine("Test", label);
+ f.LastUpdatedTime = FeedLib.FixedChangedDate
+
+ using (XmlTextWriter writer = new XmlTextWriter(path +
".atom.xml", null))
+ {
+ Console.WriteLine("Writing " + path +
".atom.xml");
+ writer.Formatting = Formatting.Indented;
+ Atom10Serializer serializer = new
Atom10Serializer();
+ serializer.WriteTo(writer, f);
+ }
+
+ using (XmlTextWriter writer = new XmlTextWriter(path +
".rss.xml", null))
+ {
+ Console.WriteLine("Writing " + path +
".rss.xml");
+ writer.Formatting = Formatting.Indented;
+ Rss20Serializer serializer = new
Rss20Serializer();
+ serializer.WriteTo(writer, f);
+ }
+ }
+
+ static int Main (string[] args)
+ {
+ DumpFeed(FeedLib.EmptyFeed, "EmptyFeed");
+ DumpFeed(FeedLib.FeedNoItems, "FeedNoItems");
+ DumpFeed(FeedLib.FeedWithItems, "FeedWithItems");
+ return 0;
+ }
+}
Added: trunk/olive/class/System.ServiceModel.Web/TextSyndicationContent.cs
===================================================================
--- trunk/olive/class/System.ServiceModel.Web/TextSyndicationContent.cs
2007-05-31 00:44:13 UTC (rev 78282)
+++ trunk/olive/class/System.ServiceModel.Web/TextSyndicationContent.cs
2007-05-31 00:52:47 UTC (rev 78283)
@@ -0,0 +1,71 @@
+//
+// System.ServiceModel.Syndication.TextSyndicationContent
+//
+// Authors:
+// Joel Reed ([EMAIL PROTECTED])
+//
+
+//
+// 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.Xml;
+
+namespace System.ServiceModel.Syndication
+{
+ public class TextSyndicationContent : SyndicationContent
+ {
+ private string text;
+ private TextSyndicationContentKind type;
+
+ public TextSyndicationContent (string text)
+ {
+ this.text = text;
+ this.type =
TextSyndicationContentKind.Plaintext;
+ }
+
+ public TextSyndicationContent (string text,
TextSyndicationContentKind type)
+ {
+ this.text = text;
+ this.type = type;
+ }
+
+ public string Text {
+ get { return text; }
+ }
+
+ public override string Type {
+ get {
+ string tname = "text";
+ if (type == TextSyndicationContentKind.Html)
tname = "html";
+ else if (type ==
TextSyndicationContentKind.XHtml) tname = "xhtml";
+ return tname;
+ }
+ }
+
+ protected override void WriteContentsTo (XmlWriter writer)
+ {
+ writer.WriteString(Text);
+ }
+
+ }
+}
+
Added: trunk/olive/class/System.ServiceModel.Web/TextSyndicationContentKind.cs
===================================================================
--- trunk/olive/class/System.ServiceModel.Web/TextSyndicationContentKind.cs
2007-05-31 00:44:13 UTC (rev 78282)
+++ trunk/olive/class/System.ServiceModel.Web/TextSyndicationContentKind.cs
2007-05-31 00:52:47 UTC (rev 78283)
@@ -0,0 +1,40 @@
+//
+// System.ServiceModel.Syndication.TextSyndicationContentKind
+//
+// Authors:
+// Joel Reed ([EMAIL PROTECTED])
+//
+
+//
+// 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;
+
+namespace System.ServiceModel.Syndication
+{
+ public enum TextSyndicationContentKind
+ {
+ Html,
+ Plaintext,
+ XHtml,
+ }
+}
+
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches