Moves some logic into StringExtensions, updates tests, adds other tests

This commit is contained in:
Shannon
2015-07-16 10:40:43 +02:00
parent 49f8b530b7
commit 9b5d4e5b08
6 changed files with 95 additions and 36 deletions

View File

@@ -1,4 +1,5 @@
using NUnit.Framework;
using System;
using NUnit.Framework;
using Umbraco.Core.IO;
namespace Umbraco.Tests.IO
@@ -13,11 +14,20 @@ namespace Umbraco.Tests.IO
public class IOHelperTest
{
[Test]
public void IOHelper_ResolveUrl()
[TestCase("~/Scripts", "/Scripts", null)]
[TestCase("/Scripts", "/Scripts", null)]
[TestCase("../Scripts", "/Scripts", typeof(ArgumentException))]
public void IOHelper_ResolveUrl(string input, string expected, Type expectedExceptionType)
{
var result = IOHelper.ResolveUrl("~/Scripts");
Assert.AreEqual("/Scripts", result);
if (expectedExceptionType != null)
{
Assert.Throws(expectedExceptionType, () => IOHelper.ResolveUrl(input));
}
else
{
var result = IOHelper.ResolveUrl(input);
Assert.AreEqual(expected, result);
}
}
/// <summary>