mirror of
https://github.com/BepInEx/dotnet-runtime.git
synced 2026-11-23 03:39:35 -10:00
- Fix a bunch of tests that didn't actually test anything. They just called the method without any assertions or checks after. - Rename tests to follow guidelines, instead of "PosTest1" and "NegTest2" - Take advantage of xunit - Shorten tests by using quicker and newer code - Use EncodingTestHelpers Commit migrated from https://github.com/dotnet/corefx/commit/241262ac0ec5bea8c7a10e7ff115a142e2636290
39 lines
1.6 KiB
C#
39 lines
1.6 KiB
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 UTF7EncodingEquals
|
|
{
|
|
public static IEnumerable<object[]> Equals_TestData()
|
|
{
|
|
UTF7Encoding encoding = new UTF7Encoding();
|
|
yield return new object[] { encoding, encoding, true };
|
|
yield return new object[] { new UTF7Encoding(), new UTF7Encoding(), true };
|
|
|
|
yield return new object[] { new UTF7Encoding(), new TimeSpan(), false };
|
|
yield return new object[] { new UTF7Encoding(), null, false };
|
|
|
|
yield return new object[] { new UTF7Encoding(), new UTF7Encoding(true), false };
|
|
yield return new object[] { new UTF7Encoding(), new UTF7Encoding(false), true };
|
|
|
|
yield return new object[] { new UTF7Encoding(true), new UTF7Encoding(true), true };
|
|
yield return new object[] { new UTF7Encoding(true), new UTF7Encoding(false), false };
|
|
|
|
yield return new object[] { new UTF7Encoding(false), new UTF7Encoding(false), true };
|
|
yield return new object[] { new UTF7Encoding(false), new UTF7Encoding(true), false };
|
|
}
|
|
|
|
[Theory]
|
|
[MemberData(nameof(Equals_TestData))]
|
|
public void Equals(UTF7Encoding encoding, object value, bool expected)
|
|
{
|
|
Assert.Equal(expected, encoding.Equals(value));
|
|
}
|
|
}
|
|
}
|