Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Commit

Permalink
Merge pull request #3 from anthonylangsworth/slashfix
Browse files Browse the repository at this point in the history
Fix for tests failing on Un*x due to "file:///"
  • Loading branch information
krwq authored Mar 6, 2017
2 parents 2740de0 + fe36785 commit 34aff2c
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/System.Security.Cryptography.Xml/tests/TestHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public static string StreamToString(Stream stream, Encoding encoding)
/// </exception>
public static string ExecuteTransform(string inputXml, Transform transform, Encoding encoding = null, XmlResolver resolver = null)
{
if (string.IsNullOrEmpty(inputXml))
if (string.IsNullOrWhiteSpace(inputXml))
{
throw new ArgumentException("Cannot be null, empty or whitespace", nameof(inputXml));
}
Expand Down Expand Up @@ -108,14 +108,23 @@ public static string ExecuteTransform(string inputXml, Transform transform, Enco
/// in an <see cref="XmlPreloadedResolver"/>.
/// </summary>
/// <param name="fileName">
/// The file name.
/// The file name. This cannot be null, empty or whitespace.
/// </param>
/// <returns>
/// The created <see cref="Uri"/>.
/// </returns>
/// <exception cref="ArgumentException">
/// <paramref name="fileName"/> cannot be null, empty or whitespace.
/// </exception>
public static Uri ToUri(string fileName)
{
return new Uri("file:///" + Path.Combine(Directory.GetCurrentDirectory(), fileName));
if (string.IsNullOrWhiteSpace(fileName))
{
throw new ArgumentException("Cannot be null, empty or whitespace", nameof(fileName));
}

string path = Path.Combine(Directory.GetCurrentDirectory(), fileName);
return new Uri("file://" + (path[0] == '/' ? path : '/' + path));
}
}
}

0 comments on commit 34aff2c

Please sign in to comment.