diff --git a/test/Microsoft.AspNet.Mvc.TagHelpers.Test/ImageTagHelperTest.cs b/test/Microsoft.AspNet.Mvc.TagHelpers.Test/ImageTagHelperTest.cs index 8da4eadcb2..cc41fe4104 100644 --- a/test/Microsoft.AspNet.Mvc.TagHelpers.Test/ImageTagHelperTest.cs +++ b/test/Microsoft.AspNet.Mvc.TagHelpers.Test/ImageTagHelperTest.cs @@ -12,14 +12,13 @@ using Microsoft.AspNet.Hosting; using Microsoft.AspNet.Http.Internal; using Microsoft.AspNet.Mvc.ModelBinding; using Microsoft.AspNet.Mvc.Rendering; -using Microsoft.AspNet.Testing.xunit; using Microsoft.AspNet.Razor.Runtime.TagHelpers; using Microsoft.AspNet.Routing; -using Microsoft.Framework.Caching; +using Microsoft.AspNet.Testing.xunit; using Microsoft.Framework.Caching.Memory; +using Microsoft.Framework.WebEncoders.Testing; using Moq; using Xunit; -using Microsoft.Framework.WebEncoders.Testing; namespace Microsoft.AspNet.Mvc.TagHelpers { @@ -28,8 +27,8 @@ namespace Microsoft.AspNet.Mvc.TagHelpers [Theory] [InlineData(null, "test.jpg", "test.jpg")] [InlineData("abcd.jpg", "test.jpg", "test.jpg")] - [InlineData(null, "~/test.jpg", "/virtualRoot/test.jpg")] - [InlineData("abcd.jpg", "~/test.jpg", "/virtualRoot/test.jpg")] + [InlineData(null, "~/test.jpg", "virtualRoot/test.jpg")] + [InlineData("abcd.jpg", "~/test.jpg", "virtualRoot/test.jpg")] public void Process_SrcDefaultsToTagHelperOutputSrcAttributeAddedByOtherTagHelper( string src, string srcOutput, @@ -52,9 +51,13 @@ namespace Microsoft.AspNet.Mvc.TagHelpers var hostingEnvironment = MakeHostingEnvironment(); var viewContext = MakeViewContext(); var urlHelper = new Mock(); + + // Ensure expanded path does not look like an absolute path on Linux, avoiding + // https://github.com/aspnet/External/issues/21 urlHelper .Setup(urlhelper => urlhelper.Content(It.IsAny())) - .Returns(new Func(url => url.Replace("~/", "/virtualRoot/"))); + .Returns(new Func(url => url.Replace("~/", "virtualRoot/"))); + var helper = new ImageTagHelper( hostingEnvironment, MakeCache(), diff --git a/test/Microsoft.AspNet.Mvc.TagHelpers.Test/LinkTagHelperTest.cs b/test/Microsoft.AspNet.Mvc.TagHelpers.Test/LinkTagHelperTest.cs index af3823a7f9..d2847eb5e9 100644 --- a/test/Microsoft.AspNet.Mvc.TagHelpers.Test/LinkTagHelperTest.cs +++ b/test/Microsoft.AspNet.Mvc.TagHelpers.Test/LinkTagHelperTest.cs @@ -16,10 +16,9 @@ using Microsoft.AspNet.Mvc.TagHelpers.Internal; using Microsoft.AspNet.Razor.Runtime.TagHelpers; using Microsoft.AspNet.Routing; using Microsoft.AspNet.Testing.xunit; -using Microsoft.Framework.Caching; +using Microsoft.Dnx.Runtime; using Microsoft.Framework.Caching.Memory; using Microsoft.Framework.Logging; -using Microsoft.Dnx.Runtime; using Microsoft.Framework.WebEncoders.Testing; using Moq; using Xunit; @@ -31,8 +30,8 @@ namespace Microsoft.AspNet.Mvc.TagHelpers [Theory] [InlineData(null, "test.css", "test.css")] [InlineData("abcd.css", "test.css", "test.css")] - [InlineData(null, "~/test.css", "/virtualRoot/test.css")] - [InlineData("abcd.css", "~/test.css", "/virtualRoot/test.css")] + [InlineData(null, "~/test.css", "virtualRoot/test.css")] + [InlineData("abcd.css", "~/test.css", "virtualRoot/test.css")] public void Process_HrefDefaultsToTagHelperOutputHrefAttributeAddedByOtherTagHelper( string href, string hrefOutput, @@ -56,9 +55,13 @@ namespace Microsoft.AspNet.Mvc.TagHelpers var hostingEnvironment = MakeHostingEnvironment(); var viewContext = MakeViewContext(); var urlHelper = new Mock(); + + // Ensure expanded path does not look like an absolute path on Linux, avoiding + // https://github.com/aspnet/External/issues/21 urlHelper .Setup(urlhelper => urlhelper.Content(It.IsAny())) - .Returns(new Func(url => url.Replace("~/", "/virtualRoot/"))); + .Returns(new Func(url => url.Replace("~/", "virtualRoot/"))); + var helper = new LinkTagHelper( logger.Object, hostingEnvironment, diff --git a/test/Microsoft.AspNet.Mvc.TagHelpers.Test/ScriptTagHelperTest.cs b/test/Microsoft.AspNet.Mvc.TagHelpers.Test/ScriptTagHelperTest.cs index 26af3b02ea..aeeba1e271 100644 --- a/test/Microsoft.AspNet.Mvc.TagHelpers.Test/ScriptTagHelperTest.cs +++ b/test/Microsoft.AspNet.Mvc.TagHelpers.Test/ScriptTagHelperTest.cs @@ -16,11 +16,10 @@ using Microsoft.AspNet.Mvc.TagHelpers.Internal; using Microsoft.AspNet.Razor.Runtime.TagHelpers; using Microsoft.AspNet.Routing; using Microsoft.AspNet.Testing.xunit; +using Microsoft.Dnx.Runtime; using Microsoft.Framework.Caching; using Microsoft.Framework.Caching.Memory; using Microsoft.Framework.Logging; -using Microsoft.Dnx.Runtime; -using Microsoft.Framework.WebEncoders; using Microsoft.Framework.WebEncoders.Testing; using Moq; using Xunit; @@ -32,8 +31,8 @@ namespace Microsoft.AspNet.Mvc.TagHelpers [Theory] [InlineData(null, "test.js", "test.js")] [InlineData("abcd.js", "test.js", "test.js")] - [InlineData(null, "~/test.js", "/virtualRoot/test.js")] - [InlineData("abcd.js", "~/test.js", "/virtualRoot/test.js")] + [InlineData(null, "~/test.js", "virtualRoot/test.js")] + [InlineData("abcd.js", "~/test.js", "virtualRoot/test.js")] public void Process_SrcDefaultsToTagHelperOutputSrcAttributeAddedByOtherTagHelper( string src, string srcOutput, @@ -57,9 +56,13 @@ namespace Microsoft.AspNet.Mvc.TagHelpers var hostingEnvironment = MakeHostingEnvironment(); var viewContext = MakeViewContext(); var urlHelper = new Mock(); + + // Ensure expanded path does not look like an absolute path on Linux, avoiding + // https://github.com/aspnet/External/issues/21 urlHelper .Setup(urlhelper => urlhelper.Content(It.IsAny())) - .Returns(new Func(url => url.Replace("~/", "/virtualRoot/"))); + .Returns(new Func(url => url.Replace("~/", "virtualRoot/"))); + var helper = new ScriptTagHelper( logger.Object, hostingEnvironment,