Files
dotnet-runtime/src/libraries/System.Text.Encoding/tests/ASCIIEncoding/ASCIIEncodingGetMaxCharCount.cs
T
2016-03-25 22:14:44 +00:00

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));
}
}
}