mirror of
https://github.com/BepInEx/dotnet-runtime.git
synced 2026-11-22 19:10:41 -10:00
Use common helper that contains more tests than before Commit migrated from https://github.com/dotnet/corefx/commit/a2a7bb46b9580677b0ab45d0ff965233b9af2b1a
29 lines
974 B
C#
29 lines
974 B
C#
// Licensed to the .NET Foundation under one or more agreements.
|
|
// The .NET Foundation licenses this file to you under the MIT license.
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
using System.Collections.Generic;
|
|
using Xunit;
|
|
|
|
namespace System.Text.Tests
|
|
{
|
|
public class ASCIIEncodingGetMaxCharCount
|
|
{
|
|
private static readonly RandomDataGenerator s_randomDataGenerator = new RandomDataGenerator();
|
|
|
|
public static IEnumerable<object[]> GetMaxCharCount_TestData()
|
|
{
|
|
int randomByteCount = s_randomDataGenerator.GetInt32(-55);
|
|
yield return new object[] { 0, 0 };
|
|
yield return new object[] { randomByteCount, randomByteCount };
|
|
}
|
|
|
|
[Theory]
|
|
[MemberData(nameof(GetMaxCharCount_TestData))]
|
|
public void GetMaxCharCount(int byteCount, int expected)
|
|
{
|
|
Assert.Equal(expected, new ASCIIEncoding().GetMaxCharCount(byteCount));
|
|
}
|
|
}
|
|
}
|