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);
} }
[Theory] public static TheoryData<string> InvalidResourceStringData
[InlineData("{")]
[InlineData("{0")]
public void HtmlLocalizer_HtmlWithInvalidResourcestring_ThrowsException(string format)
{ {
get
{
var data = new TheoryData<string>
{
"{0",
};
// Mono doesn't like { in an underlying string.Format on Mac. // Mono doesn't like { in an underlying string.Format on Mac.
if (TestPlatformHelper.IsMac && if (!TestPlatformHelper.IsMac || !TestPlatformHelper.IsMono)
TestPlatformHelper.IsMono &&
string.Equals(format, "{", StringComparison.Ordinal))
{ {
return; data.Add("{");
} }
return data;
}
}
[Theory]
[MemberData(nameof(InvalidResourceStringData))]
public void HtmlLocalizer_HtmlWithInvalidResourcestring_ThrowsException(string format)
{
// 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
{ {
} }
} }