Use MemberData instead of InlineData.
This commit is contained in:
parent
b62dde23e6
commit
957a77219c
|
|
@ -29,15 +29,26 @@ namespace Microsoft.Framework.WebEncoders
|
||||||
Assert.Same(retVal1, retVal2);
|
Assert.Same(retVal1, retVal2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static TheoryData<int, string, int> Utf16ScalarValues
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var dataset = new TheoryData<int, string, int>();
|
||||||
|
dataset.Add(1, "a", (int)'a'); // normal BMP char, end of string
|
||||||
|
dataset.Add(2, "ab", (int)'a'); // normal BMP char, not end of string
|
||||||
|
dataset.Add(3, "\uDFFF", UnicodeReplacementChar); // trailing surrogate, end of string
|
||||||
|
dataset.Add(4, "\uDFFFx", UnicodeReplacementChar); // trailing surrogate, not end of string
|
||||||
|
dataset.Add(5, "\uD800", UnicodeReplacementChar); // leading surrogate, end of string
|
||||||
|
dataset.Add(6, "\uD800x", UnicodeReplacementChar); // leading surrogate, not end of string, followed by non-surrogate
|
||||||
|
dataset.Add(7, "\uD800\uD800", UnicodeReplacementChar); // leading surrogate, not end of string, followed by leading surrogate
|
||||||
|
dataset.Add(8, "\uD800\uDFFF", 0x103FF); // leading surrogate, not end of string, followed by trailing surrogate
|
||||||
|
|
||||||
|
return dataset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData(1, "a", (int)'a')] // normal BMP char, end of string
|
[MemberData(nameof(Utf16ScalarValues))]
|
||||||
[InlineData(2, "ab", (int)'a')] // normal BMP char, not end of string
|
|
||||||
[InlineData(3, "\uDFFF", UnicodeReplacementChar)] // trailing surrogate, end of string
|
|
||||||
[InlineData(4, "\uDFFFx", UnicodeReplacementChar)] // trailing surrogate, not end of string
|
|
||||||
[InlineData(5, "\uD800", UnicodeReplacementChar)] // leading surrogate, end of string
|
|
||||||
[InlineData(6, "\uD800x", UnicodeReplacementChar)] // leading surrogate, not end of string, followed by non-surrogate
|
|
||||||
[InlineData(7, "\uD800\uD800", UnicodeReplacementChar)] // leading surrogate, not end of string, followed by leading surrogate
|
|
||||||
[InlineData(8, "\uD800\uDFFF", 0x103FF)] // leading surrogate, not end of string, followed by trailing surrogate
|
|
||||||
public void GetScalarValueFromUtf16(int unused, string input, int expectedResult)
|
public void GetScalarValueFromUtf16(int unused, string input, int expectedResult)
|
||||||
{
|
{
|
||||||
// The 'unused' parameter exists because the xunit runner can't distinguish
|
// The 'unused' parameter exists because the xunit runner can't distinguish
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue