-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from pfpack/release/v3.0.2-rc.1
release/v3.0.2-rc.1
- Loading branch information
Showing
10 changed files
with
77 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/core-unit/Unit.Tests.Old/UnitTests/UnitTests.Comparison.Obsolete.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using static PrimeFuncPack.UnitTest.TestData; | ||
|
||
namespace PrimeFuncPack.Core.Tests; | ||
|
||
partial class UnitTests | ||
{ | ||
[Obsolete] | ||
[Test] | ||
public void CompareTo_Obj_Unit_ExpectZero() | ||
{ | ||
object? obj = default(Unit); | ||
|
||
var actual = Unit.Value.CompareTo(obj); | ||
Assert.That(actual, Is.Zero); | ||
} | ||
|
||
[Obsolete] | ||
[Test] | ||
public void CompareTo_Obj_Null_ExpectGreaterThanZero_ExpectOne() | ||
{ | ||
object? obj = null; | ||
|
||
var actual = Unit.Value.CompareTo(obj); | ||
|
||
Assert.That(actual, Is.Positive); | ||
Assert.That(actual, Is.EqualTo(1)); | ||
} | ||
|
||
[Obsolete] | ||
[Test] | ||
[TestCaseSource(nameof(CompareTo_Obj_NotUnit_ExpectArgumentException_TestCases))] | ||
public void CompareTo_Obj_NotUnit_ExpectArgumentException(object obj) | ||
{ | ||
var ex = Assert.Throws<ArgumentException>(() => _ = Unit.Value.CompareTo(obj))!; | ||
|
||
Assert.That(ex.ParamName, Is.EqualTo("obj")); | ||
|
||
var containsExpectedMessage = ex.Message.Contains("Object must be of type Unit.", StringComparison.Ordinal); | ||
Assert.That(containsExpectedMessage, Is.True); | ||
} | ||
|
||
private static IEnumerable<object> CompareTo_Obj_NotUnit_ExpectArgumentException_TestCases() | ||
{ | ||
yield return new object(); | ||
yield return PlusFifteen; | ||
yield return PlusFifteenIdRefType; | ||
yield return SomeTextStructType; | ||
yield return Array.Empty<Unit>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace System; | ||
|
||
// TODO: Remove Nongeneric IComparable declaration/implementation in v4.0 | ||
partial struct Unit : IComparable | ||
{ | ||
[Obsolete("This method is obsolete. Call CompareTo(Unit) instead.")] | ||
public int CompareTo(object? obj) => obj switch | ||
{ | ||
null => 1, | ||
Unit => default, | ||
_ => throw new ArgumentException($"Object must be of type {nameof(Unit)}.", nameof(obj)) | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters