Imported Upstream version 6.4.0.137

Former-commit-id: 943baa9f16a098c33e129777827f3a9d20da00d6
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-07-26 19:53:28 +00:00
parent e9207cf623
commit ef583813eb
2712 changed files with 74169 additions and 40587 deletions

View File

@ -159,19 +159,19 @@ namespace MonoTests.System.ServiceModel.Syndication
public void WriteTo ()
{
SyndicationFeed feed = new SyndicationFeed ();
feed.BaseUri = new Uri ("http://mono-project.com");
feed.BaseUri = new Uri ("http://example.com");
feed.Copyright = new TextSyndicationContent ("No rights reserved");
feed.Description = new TextSyndicationContent ("A sample feed for unit testing");
feed.Generator = "mono test generator";
// .NET bug: it ignores this value.
feed.Id = "urn:myid";
feed.ImageUrl = new Uri ("http://mono-project.com/images/mono.png");
feed.ImageUrl = new Uri ("http://example.com/images/mono.png");
feed.LastUpdatedTime = new DateTimeOffset (DateTime.SpecifyKind (new DateTime (2008, 1, 1), DateTimeKind.Utc));
StringWriter sw = new StringWriter ();
using (XmlWriter w = CreateWriter (sw))
new Atom10FeedFormatter (feed).WriteTo (w);
Assert.AreEqual ("<feed xml:base=\"http://mono-project.com/\" xmlns=\"http://www.w3.org/2005/Atom\"><title type=\"text\"></title><subtitle type=\"text\">A sample feed for unit testing</subtitle><id>XXX</id><rights type=\"text\">No rights reserved</rights><updated>2008-01-01T00:00:00Z</updated><logo>http://mono-project.com/images/mono.png</logo><generator>mono test generator</generator></feed>", DummyId (sw.ToString ()));
Assert.AreEqual ("<feed xml:base=\"http://example.com/\" xmlns=\"http://www.w3.org/2005/Atom\"><title type=\"text\"></title><subtitle type=\"text\">A sample feed for unit testing</subtitle><id>XXX</id><rights type=\"text\">No rights reserved</rights><updated>2008-01-01T00:00:00Z</updated><logo>http://example.com/images/mono.png</logo><generator>mono test generator</generator></feed>", DummyId (sw.ToString ()));
}
[Test]
@ -193,12 +193,12 @@ namespace MonoTests.System.ServiceModel.Syndication
{
// ... and it passes.
SyndicationFeed feed = new SyndicationFeed ();
feed.Links.Add (new SyndicationLink (new Uri ("http://mono-project.com/Page1"), "alternate", "Page 1", "text/html", 0));
feed.Links.Add (new SyndicationLink (new Uri ("http://mono-project.com/Page2"), "alternate", "Page 2", "text/html", 0));
feed.Links.Add (new SyndicationLink (new Uri ("http://example.com/Page1"), "alternate", "Page 1", "text/html", 0));
feed.Links.Add (new SyndicationLink (new Uri ("http://example.com/Page2"), "alternate", "Page 2", "text/html", 0));
StringWriter sw = new StringWriter ();
using (XmlWriter w = CreateWriter (sw))
new Atom10FeedFormatter (feed).WriteTo (w);
Assert.AreEqual ("<feed xmlns=\"http://www.w3.org/2005/Atom\"><title type=\"text\"></title><id>XXX</id><updated>XXX</updated><link rel=\"alternate\" type=\"text/html\" title=\"Page 1\" href=\"http://mono-project.com/Page1\" /><link rel=\"alternate\" type=\"text/html\" title=\"Page 2\" href=\"http://mono-project.com/Page2\" /></feed>", DummyUpdated (DummyId (sw.ToString ())));
Assert.AreEqual ("<feed xmlns=\"http://www.w3.org/2005/Atom\"><title type=\"text\"></title><id>XXX</id><updated>XXX</updated><link rel=\"alternate\" type=\"text/html\" title=\"Page 1\" href=\"http://example.com/Page1\" /><link rel=\"alternate\" type=\"text/html\" title=\"Page 2\" href=\"http://example.com/Page2\" /></feed>", DummyUpdated (DummyId (sw.ToString ())));
}
XmlWriter CreateWriter (StringWriter sw)
@ -333,7 +333,7 @@ namespace MonoTests.System.ServiceModel.Syndication
public void ReadFrom_Extension ()
{
Atom10FeedFormatter f = new Atom10FeedFormatter ();
f.ReadFrom (CreateReader ("<feed xmlns='http://www.w3.org/2005/Atom'><icon>http://www.mono-project.com/icons/mono.png</icon></feed>"));
f.ReadFrom (CreateReader ("<feed xmlns='http://www.w3.org/2005/Atom'><icon>http://www.example.com/icons/mono.png</icon></feed>"));
Assert.IsNotNull (f.Feed, "#1");
// 'icon' is treated as an extension ...
Assert.AreEqual (1, f.Feed.ElementExtensions.Count, "#2");
@ -360,9 +360,9 @@ namespace MonoTests.System.ServiceModel.Syndication
public void ReadFrom_ImageUrl ()
{
Atom10FeedFormatter f = new Atom10FeedFormatter ();
f.ReadFrom (CreateReader ("<feed xmlns='http://www.w3.org/2005/Atom'><logo>http://mono-project.com/images/mono.png</logo></feed>"));
f.ReadFrom (CreateReader ("<feed xmlns='http://www.w3.org/2005/Atom'><logo>http://example.com/images/mono.png</logo></feed>"));
Assert.IsNotNull (f.Feed.ImageUrl, "#1");
Assert.AreEqual ("http://mono-project.com/images/mono.png", f.Feed.ImageUrl.ToString (), "#2");
Assert.AreEqual ("http://example.com/images/mono.png", f.Feed.ImageUrl.ToString (), "#2");
}
[Test]

View File

@ -159,7 +159,7 @@ namespace MonoTests.System.ServiceModel.Syndication
public void WriteTo ()
{
SyndicationItem item = new SyndicationItem ();
item.BaseUri = new Uri ("http://mono-project.com");
item.BaseUri = new Uri ("http://example.com");
item.Copyright = new TextSyndicationContent ("No rights reserved");
item.Content = new XmlSyndicationContent (null, 5, (XmlObjectSerializer) null);
// .NET bug: it ignores this value.
@ -172,7 +172,7 @@ namespace MonoTests.System.ServiceModel.Syndication
StringWriter sw = new StringWriter ();
using (XmlWriter w = CreateWriter (sw))
new Atom10ItemFormatter (item).WriteTo (w);
Assert.AreEqual ("<entry xml:base=\"http://mono-project.com/\" xmlns=\"http://www.w3.org/2005/Atom\"><id>XXX</id><title type=\"text\"></title><summary type=\"text\">great text</summary><published>2000-01-01T00:00:00Z</published><updated>2008-01-01T00:00:00Z</updated><content type=\"text/xml\"><int xmlns=\"http://schemas.microsoft.com/2003/10/Serialization/\">5</int></content><rights type=\"text\">No rights reserved</rights></entry>", DummyId (sw.ToString ()));
Assert.AreEqual ("<entry xml:base=\"http://example.com/\" xmlns=\"http://www.w3.org/2005/Atom\"><id>XXX</id><title type=\"text\"></title><summary type=\"text\">great text</summary><published>2000-01-01T00:00:00Z</published><updated>2008-01-01T00:00:00Z</updated><content type=\"text/xml\"><int xmlns=\"http://schemas.microsoft.com/2003/10/Serialization/\">5</int></content><rights type=\"text\">No rights reserved</rights></entry>", DummyId (sw.ToString ()));
}
[Test]
@ -194,12 +194,12 @@ namespace MonoTests.System.ServiceModel.Syndication
{
// ... and it passes.
SyndicationItem item = new SyndicationItem ();
item.Links.Add (new SyndicationLink (new Uri ("http://mono-project.com/Page1"), "alternate", "Page 1", "text/html", 0));
item.Links.Add (new SyndicationLink (new Uri ("http://mono-project.com/Page2"), "alternate", "Page 2", "text/html", 0));
item.Links.Add (new SyndicationLink (new Uri ("http://example.com/Page1"), "alternate", "Page 1", "text/html", 0));
item.Links.Add (new SyndicationLink (new Uri ("http://example.com/Page2"), "alternate", "Page 2", "text/html", 0));
StringWriter sw = new StringWriter ();
using (XmlWriter w = CreateWriter (sw))
new Atom10ItemFormatter (item).WriteTo (w);
Assert.AreEqual ("<entry xmlns=\"http://www.w3.org/2005/Atom\"><id>XXX</id><title type=\"text\"></title><updated>XXX</updated><link rel=\"alternate\" type=\"text/html\" title=\"Page 1\" href=\"http://mono-project.com/Page1\" /><link rel=\"alternate\" type=\"text/html\" title=\"Page 2\" href=\"http://mono-project.com/Page2\" /></entry>", DummyUpdated (DummyId (sw.ToString ())));
Assert.AreEqual ("<entry xmlns=\"http://www.w3.org/2005/Atom\"><id>XXX</id><title type=\"text\"></title><updated>XXX</updated><link rel=\"alternate\" type=\"text/html\" title=\"Page 1\" href=\"http://example.com/Page1\" /><link rel=\"alternate\" type=\"text/html\" title=\"Page 2\" href=\"http://example.com/Page2\" /></entry>", DummyUpdated (DummyId (sw.ToString ())));
}
XmlWriter CreateWriter (StringWriter sw)

View File

@ -142,17 +142,17 @@ namespace MonoTests.System.ServiceModel.Syndication
public void WriteTo ()
{
SyndicationFeed feed = new SyndicationFeed ();
feed.BaseUri = new Uri ("http://mono-project.com");
feed.BaseUri = new Uri ("http://example.com");
feed.Copyright = new TextSyndicationContent ("No rights reserved");
feed.Generator = "mono test generator";
feed.Id = "urn:myid";
feed.ImageUrl = new Uri ("http://mono-project.com/images/mono.png");
feed.ImageUrl = new Uri ("http://example.com/images/mono.png");
feed.LastUpdatedTime = new DateTimeOffset (DateTime.SpecifyKind (new DateTime (2008, 1, 1), DateTimeKind.Utc));
StringWriter sw = new StringWriter ();
using (XmlWriter w = CreateWriter (sw))
new Rss20FeedFormatter (feed).WriteTo (w);
Assert.AreEqual ("<rss xmlns:a10=\"http://www.w3.org/2005/Atom\" version=\"2.0\"><channel xml:base=\"http://mono-project.com/\"><title /><description /><copyright>No rights reserved</copyright><lastBuildDate>Tue, 01 Jan 2008 00:00:00 Z</lastBuildDate><generator>mono test generator</generator><image><url>http://mono-project.com/images/mono.png</url><title /><link /></image><a10:id>urn:myid</a10:id></channel></rss>", sw.ToString ());
Assert.AreEqual ("<rss xmlns:a10=\"http://www.w3.org/2005/Atom\" version=\"2.0\"><channel xml:base=\"http://example.com/\"><title /><description /><copyright>No rights reserved</copyright><lastBuildDate>Tue, 01 Jan 2008 00:00:00 Z</lastBuildDate><generator>mono test generator</generator><image><url>http://example.com/images/mono.png</url><title /><link /></image><a10:id>urn:myid</a10:id></channel></rss>", sw.ToString ());
}
[Test]

View File

@ -141,7 +141,7 @@ namespace MonoTests.System.ServiceModel.Syndication
public void WriteTo ()
{
SyndicationItem item = new SyndicationItem ();
item.BaseUri = new Uri ("http://mono-project.com");
item.BaseUri = new Uri ("http://example.com");
item.Copyright = new TextSyndicationContent ("No rights reserved");
item.Content = new XmlSyndicationContent (null, 5, (XmlObjectSerializer) null);
item.Id = "urn:myid";
@ -153,7 +153,7 @@ namespace MonoTests.System.ServiceModel.Syndication
StringWriter sw = new StringWriter ();
using (XmlWriter w = CreateWriter (sw))
new Rss20ItemFormatter (item).WriteTo (w);
Assert.AreEqual ("<item xml:base=\"http://mono-project.com/\"><guid isPermaLink=\"false\">urn:myid</guid><description /><source>source title</source><pubDate>Sat, 01 Jan 2000 00:00:00 Z</pubDate><updated xmlns=\"http://www.w3.org/2005/Atom\">2008-01-01T00:00:00Z</updated><rights type=\"text\" xmlns=\"http://www.w3.org/2005/Atom\">No rights reserved</rights><content type=\"text/xml\" xmlns=\"http://www.w3.org/2005/Atom\"><int xmlns=\"http://schemas.microsoft.com/2003/10/Serialization/\">5</int></content></item>", sw.ToString ());
Assert.AreEqual ("<item xml:base=\"http://example.com/\"><guid isPermaLink=\"false\">urn:myid</guid><description /><source>source title</source><pubDate>Sat, 01 Jan 2000 00:00:00 Z</pubDate><updated xmlns=\"http://www.w3.org/2005/Atom\">2008-01-01T00:00:00Z</updated><rights type=\"text\" xmlns=\"http://www.w3.org/2005/Atom\">No rights reserved</rights><content type=\"text/xml\" xmlns=\"http://www.w3.org/2005/Atom\"><int xmlns=\"http://schemas.microsoft.com/2003/10/Serialization/\">5</int></content></item>", sw.ToString ());
}
[Test]

View File

@ -77,10 +77,10 @@ namespace MonoTests.System.ServiceModel.Syndication
{
SyndicationItem item = new SyndicationItem ();
Assert.AreEqual (0, item.Links.Count, "#1");
item.AddPermalink (new Uri ("http://mono-project.com/index.rss.20071210"));
item.AddPermalink (new Uri ("http://example.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 ("http://example.com/index.rss.20071210", link.Uri.ToString (), "#3");
Assert.AreEqual ("alternate", link.RelationshipType, "#4");
}
@ -88,9 +88,9 @@ namespace MonoTests.System.ServiceModel.Syndication
public void Clone ()
{
SyndicationItem item = new SyndicationItem ();
item.AddPermalink (new Uri ("http://mono-project.com/index.rss.20071210"));
item.AddPermalink (new Uri ("http://example.com/index.rss.20071210"));
item.Id = Guid.NewGuid ().ToString ();
item.BaseUri = new Uri ("http://mono-project.com");
item.BaseUri = new Uri ("http://example.com");
item.Authors.Add (new SyndicationPerson ("atsushi@ximian.com"));
item.SourceFeed = new SyndicationFeed ();
item.SourceFeed.Items = new SyndicationItem [] {new SyndicationItem ()};
@ -98,7 +98,7 @@ namespace MonoTests.System.ServiceModel.Syndication
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");
Assert.AreEqual ("http://example.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

View File

@ -75,12 +75,12 @@ namespace MonoTests.System.ServiceModel.Syndication
Assert.IsNull (link.BaseUri, "#1");
// absolute
link = new SyndicationLink (new Uri ("http://mono-project.com/index.rss"));
link = new SyndicationLink (new Uri ("http://example.com/index.rss"));
Assert.IsNull (link.BaseUri, "#2");
// absolute #2
link = new SyndicationLink ();
link.Uri = new Uri ("http://mono-project.com/index.rss");
link.Uri = new Uri ("http://example.com/index.rss");
Assert.IsNull (link.BaseUri, "#3");
}
@ -98,7 +98,7 @@ namespace MonoTests.System.ServiceModel.Syndication
[Test]
public void MediaType ()
{
SyndicationLink link = new SyndicationLink (new Uri ("http://mono-project.com/index.rss"));
SyndicationLink link = new SyndicationLink (new Uri ("http://example.com/index.rss"));
link.MediaType = "text/xml";
Assert.AreEqual ("text/xml", link.MediaType, "#1");
link.MediaType = null;
@ -109,7 +109,7 @@ namespace MonoTests.System.ServiceModel.Syndication
[Test]
public void RelationshipType ()
{
SyndicationLink link = new SyndicationLink (new Uri ("http://mono-project.com/index.rss"));
SyndicationLink link = new SyndicationLink (new Uri ("http://example.com/index.rss"));
link.RelationshipType = "alternate";
Assert.AreEqual ("alternate", link.RelationshipType, "#1");
link.RelationshipType = null;
@ -120,7 +120,7 @@ namespace MonoTests.System.ServiceModel.Syndication
[Test]
public void Length ()
{
SyndicationLink link = new SyndicationLink (new Uri ("http://mono-project.com/index.rss"));
SyndicationLink link = new SyndicationLink (new Uri ("http://example.com/index.rss"));
link.Length = 0;
link.Length = long.MaxValue;
}
@ -129,7 +129,7 @@ namespace MonoTests.System.ServiceModel.Syndication
[ExpectedException (typeof (ArgumentOutOfRangeException))]
public void NegativeLength ()
{
SyndicationLink link = new SyndicationLink (new Uri ("http://mono-project.com/index.rss"));
SyndicationLink link = new SyndicationLink (new Uri ("http://example.com/index.rss"));
link.Length = -1;
}
@ -144,7 +144,7 @@ namespace MonoTests.System.ServiceModel.Syndication
public void AttributeElementExtensions ()
{
// The properties do not affect extension attributes.
SyndicationLink link = new SyndicationLink (new Uri ("http://mono-project.com/index.rss"));
SyndicationLink link = new SyndicationLink (new Uri ("http://example.com/index.rss"));
Assert.AreEqual (0, link.ElementExtensions.Count, "#0");
Assert.IsFalse (link.AttributeExtensions.ContainsKey (new QName ("mediaType")), "#3");
@ -163,12 +163,12 @@ namespace MonoTests.System.ServiceModel.Syndication
Assert.IsNull (link.GetAbsoluteUri (), "#2");
// Uri is absolute
link = new SyndicationLink (new Uri ("http://mono-project.com/index.rss"));
Assert.AreEqual ("http://mono-project.com/index.rss", link.GetAbsoluteUri ().ToString (), "#3");
link = new SyndicationLink (new Uri ("http://example.com/index.rss"));
Assert.AreEqual ("http://example.com/index.rss", link.GetAbsoluteUri ().ToString (), "#3");
// only BaseUri - null result
link = new SyndicationLink ();
link.BaseUri = new Uri ("http://mono-project.com/index.rss");
link.BaseUri = new Uri ("http://example.com/index.rss");
Assert.IsNull (link.GetAbsoluteUri (), "#4");
}
@ -176,7 +176,7 @@ namespace MonoTests.System.ServiceModel.Syndication
public void Clone ()
{
SyndicationLink link = new SyndicationLink (null, null, "my RSS", "text/xml", 1);
link.BaseUri = new Uri ("http://mono-project.com/index.rss");
link.BaseUri = new Uri ("http://example.com/index.rss");
SyndicationLink clone = link.Clone ();
Assert.AreEqual (link.BaseUri, clone.BaseUri, "#1");
Assert.AreEqual ("my RSS", clone.Title, "#2");

View File

@ -54,7 +54,7 @@ namespace MonoTests.System.ServiceModel.Syndication
[Test]
public void Constructor ()
{
Uri uri = new Uri ("http://mono-project.com");
Uri uri = new Uri ("http://example.com");
UrlSyndicationContent t = new UrlSyndicationContent (uri, null);
t = new UrlSyndicationContent (uri, "text/plain");
Assert.AreEqual (uri, t.Url, "#1");
@ -64,7 +64,7 @@ namespace MonoTests.System.ServiceModel.Syndication
[Test]
public void Clone ()
{
Uri uri = new Uri ("http://mono-project.com");
Uri uri = new Uri ("http://example.com");
UrlSyndicationContent t = new UrlSyndicationContent (uri, "text/plain");
t = t.Clone () as UrlSyndicationContent;
Assert.AreEqual (uri, t.Url, "#1");
@ -75,18 +75,18 @@ namespace MonoTests.System.ServiceModel.Syndication
[Category("NotWorking")]
public void WriteTo ()
{
Uri uri = new Uri ("http://mono-project.com/");
Uri uri = new Uri ("http://example.com/");
UrlSyndicationContent t = new UrlSyndicationContent (uri, null);
StringWriter sw = new StringWriter ();
using (XmlWriter w = CreateWriter (sw))
t.WriteTo (w, "root", String.Empty);
Assert.AreEqual ("<root type=\"\" src=\"http://mono-project.com/\" />", sw.ToString ());
Assert.AreEqual ("<root type=\"\" src=\"http://example.com/\" />", sw.ToString ());
t = new UrlSyndicationContent (uri, "application/xml+svg");
sw = new StringWriter ();
using (XmlWriter w = CreateWriter (sw))
t.WriteTo (w, "root", String.Empty);
Assert.AreEqual ("<root type=\"application/xml+svg\" src=\"http://mono-project.com/\" />", sw.ToString ());
Assert.AreEqual ("<root type=\"application/xml+svg\" src=\"http://example.com/\" />", sw.ToString ());
}
XmlWriter CreateWriter (StringWriter sw)