From 6459fb0e305245682208d962ae275d088dd25b15 Mon Sep 17 00:00:00 2001 From: Doug Bunting Date: Sun, 13 Sep 2015 18:54:31 -0700 Subject: [PATCH] Do not execute no-op tests - consistently use `TestPlatformHelper` only to skip test cases or change expectations --- .../HtmlLocalizerTest.cs | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/test/Microsoft.AspNet.Mvc.Localization.Test/HtmlLocalizerTest.cs b/test/Microsoft.AspNet.Mvc.Localization.Test/HtmlLocalizerTest.cs index 04287c6238..672b43910c 100644 --- a/test/Microsoft.AspNet.Mvc.Localization.Test/HtmlLocalizerTest.cs +++ b/test/Microsoft.AspNet.Mvc.Localization.Test/HtmlLocalizerTest.cs @@ -112,19 +112,29 @@ namespace Microsoft.AspNet.Mvc.Localization.Test Assert.Equal(expectedText, localizedHtmlString.Value); } + public static TheoryData InvalidResourceStringData + { + get + { + var data = new TheoryData + { + "{0", + }; + + // Mono doesn't like { in an underlying string.Format on Mac. + if (!TestPlatformHelper.IsMac || !TestPlatformHelper.IsMono) + { + data.Add("{"); + } + + return data; + } + } + [Theory] - [InlineData("{")] - [InlineData("{0")] + [MemberData(nameof(InvalidResourceStringData))] 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 var localizedString = new LocalizedString("Hello", format); @@ -144,6 +154,5 @@ namespace Microsoft.AspNet.Mvc.Localization.Test public class TestClass { - } }