Imported Upstream version 3.10.0

Former-commit-id: 172c8e3c300b39d5785c7a3e8dfb08ebdbc1a99b
This commit is contained in:
Jo Shields
2014-10-04 11:27:48 +01:00
parent fe777c5c82
commit 8b9b85e7f5
970 changed files with 20242 additions and 31308 deletions

View File

@ -119,10 +119,10 @@ namespace System.IO.Packaging
public static void PartUriIsValid (Uri partUri)
{
if (!partUri.OriginalString.StartsWith ("/"))
throw new UriFormatException ("PartUris must start with '/'");
throw new ArgumentException ("PartUris must start with '/'");
if (partUri.IsAbsoluteUri)
throw new UriFormatException ("PartUris cannot be absolute");
throw new ArgumentException ("PartUris cannot be absolute");
}
public static void RelationshipTypeIsValid (string relationshipType)

View File

@ -42,24 +42,28 @@ namespace System.IO.Packaging {
public static int ComparePackUri (Uri firstPackUri, Uri secondPackUri)
{
// FIXME: Do i need to do validation that it is a pack:// uri?
if (firstPackUri == null)
return secondPackUri == null ? 0 : -1;
if (secondPackUri == null)
return 1;
Check.PackUriIsValid (firstPackUri);
Check.PackUriIsValid (secondPackUri);
// FIXME: What exactly is compared. Lets assume originalstring
return firstPackUri.OriginalString.CompareTo (secondPackUri.OriginalString);
}
public static int ComparePartUri (Uri firstPartUri, Uri secondPartUri)
{
// FIXME: Do i need to do validation that it is a part URI?
if (firstPartUri == null)
return secondPartUri == null ? 0 : -1;
if (secondPartUri == null)
return 1;
Check.PartUriIsValid (firstPartUri);
Check.PartUriIsValid (secondPartUri);
return firstPartUri.OriginalString.CompareTo (secondPartUri.OriginalString);
}

View File

@ -25,7 +25,6 @@ namespace System.IO.Packaging.Tests {
Uri main = new Uri ("/main.html", UriKind.Relative);
[Test]
[Category("NotWorking")]
public void ComparePackUriTest ()
{
Assert.AreEqual (0, PackUriHelper.ComparePackUri (null, null), "#1");
@ -44,7 +43,6 @@ namespace System.IO.Packaging.Tests {
}
[Test]
[Category("NotWorking")]
[ExpectedException (typeof (ArgumentException))]
public void NonPackUriCompareTest ()
{
@ -52,7 +50,6 @@ namespace System.IO.Packaging.Tests {
}
[Test]
[Category("NotWorking")]
[ExpectedException (typeof (ArgumentException))]
public void NonPackUriCompareRelativeTest ()
{
@ -60,7 +57,6 @@ namespace System.IO.Packaging.Tests {
}
[Test]
[Category("NotWorking")]
[ExpectedException (typeof (ArgumentException))]
public void InvalidPartUriCompareTest ()
{
@ -76,7 +72,6 @@ namespace System.IO.Packaging.Tests {
}
[Test]
[Category("NotWorking")]
public void CreateTest ()
{
Assert.AreEqual ("pack://http:,,www.test.com,pack.pkg/",
@ -92,7 +87,6 @@ namespace System.IO.Packaging.Tests {
}
[Test]
[Category("NotWorking")]
public void CreateTest2()
{
Uri uri = PackUriHelper.Create(new Uri("http://www.test.com/pack1.pkg"));
@ -121,7 +115,6 @@ namespace System.IO.Packaging.Tests {
}
[Test]
[Category("NotWorking")]
public void CreateInvalidTest4 ()
{
PackUriHelper.Create (new Uri ("http://www.test.com/pack.pkg"), new Uri ("/main.html", UriKind.Relative));
@ -168,7 +161,6 @@ namespace System.IO.Packaging.Tests {
}
[Test]
[Category("NotWorking")]
public void GetPackageUriTest ()
{
Assert.AreEqual (a, PackUriHelper.GetPackageUri (PackUriHelper.Create (a, new Uri ("/test.html", UriKind.Relative))));
@ -189,7 +181,6 @@ namespace System.IO.Packaging.Tests {
}
[Test]
[Category("NotWorking")]
public void GetPartUriTest ()
{
var pack = PackUriHelper.Create(new Uri("http://www.test.com/pack1.pkg"));