Do not execute no-op tests

- consistently use `TestPlatformHelper` only to skip test cases or change expectations
This commit is contained in:
Doug Bunting 2015-09-13 18:54:31 -07:00
parent 887ab64d75
commit 6459fb0e30
1 changed files with 20 additions and 11 deletions

View File

@ -112,19 +112,29 @@ namespace Microsoft.AspNet.Mvc.Localization.Test
Assert.Equal(expectedText, localizedHtmlString.Value); Assert.Equal(expectedText, localizedHtmlString.Value);
} }
public static TheoryData<string> InvalidResourceStringData
{
get
{
var data = new TheoryData<string>
{
"{0",
};
// Mono doesn't like { in an underlying string.Format on Mac.
if (!TestPlatformHelper.IsMac || !TestPlatformHelper.IsMono)
{
data.Add("{");
}
return data;
}
}
[Theory] [Theory]
[InlineData("{")] [MemberData(nameof(InvalidResourceStringData))]
[InlineData("{0")]
public void HtmlLocalizer_HtmlWithInvalidResourcestring_ThrowsException(string format) public void HtmlLocalizer_HtmlWithInvalidResourcestring_ThrowsException(string format)
{ {
// Mono doesn't like { in an underlying string.Format on Mac.
if (TestPlatformHelper.IsMac &&
TestPlatformHelper.IsMono &&
string.Equals(format, "{", StringComparison.Ordinal))
{
return;
}
// Arrange // Arrange
var localizedString = new LocalizedString("Hello", format); var localizedString = new LocalizedString("Hello", format);
@ -144,6 +154,5 @@ namespace Microsoft.AspNet.Mvc.Localization.Test
public class TestClass public class TestClass
{ {
} }
} }