From 3d71a1de9a1ca8f05029d1ba043de70d20fbbff2 Mon Sep 17 00:00:00 2001 From: Andrei Sergeev Date: Wed, 14 Feb 2024 22:27:09 +0400 Subject: [PATCH] Optional: Update the tests to NUnit v4 --- .../Base/AbsentStaticTestsBase.Comparison.cs | 4 +- .../Base/AbsentStaticTestsBase.Equality.cs | 4 +- .../Base/AbsentStaticTestsBase.Factory.cs | 6 +- .../Base/AbsentTestsBase.Comparison.Static.cs | 20 ++--- .../Base/AbsentTestsBase.Comparison.cs | 16 ++-- .../Base/AbsentTestsBase.Equality.Static.cs | 12 +-- .../Base/AbsentTestsBase.Equality.cs | 4 +- .../Base/AbsentTestsBase.Factory.cs | 4 +- .../Base/AbsentTestsBase.ToOptional.cs | 12 +-- .../Base/AbsentTestsBase.ToString.cs | 2 +- .../FilterNotNull.cs | 16 ++-- .../FilterNotNullOrThrow.cs | 28 +++--- .../GetValueOrAbsent.Dictionary.cs | 6 +- .../GetValueOrAbsent.Pair.cs | 10 +-- ...ValueOrAbsent.ReadOnlyDictionary.Public.cs | 6 +- .../GetValueOrAbsent.ReadOnlyDictionary.cs | 6 +- .../ElementAtOrAbsent.cs | 12 +-- .../FirstOrAbsent.cs | 14 +-- .../GetValueOrAbsent.cs | 6 +- .../LastOrAbsent.cs | 14 +-- .../SingleOrAbsent.cs | 36 ++++---- .../OptionalStaticTest.Equality.cs | 16 ++-- .../OptionalStaticTest.Factory.Bool.cs | 4 +- .../OptionalStaticTest.Factory.OrElse.cs | 10 +-- .../OptionalStaticTest.Factory.OrThrow.cs | 10 +-- .../OptionalStaticTest.Factory.cs | 6 +- .../Optional.Tests/Optional.Test/Test.Bind.cs | 18 ++-- .../Optional.Test/Test.Equality.cs | 88 +++++++++---------- .../Test.Factory.Absent.Constructor.cs | 4 +- .../Test.Factory.Absent.Default.cs | 4 +- .../Test.Factory.Absent.Value.cs | 4 +- .../Test.Factory.Present.Constructor.cs | 8 +- .../Test.Factory.Present.Explicit.cs | 8 +- .../Test.Factory.Present.Implicit.cs | 8 +- .../Optional.Test/Test.Filter.cs | 24 ++--- .../Optional.Test/Test.FlatMap.cs | 18 ++-- .../Optional.Tests/Optional.Test/Test.Fold.cs | 24 ++--- .../Optional.Tests/Optional.Test/Test.Map.cs | 18 ++-- .../Optional.Test/Test.On.TUnit.cs | 18 ++-- .../Optional.Test/Test.On.Unit.cs | 18 ++-- .../Optional.Tests/Optional.Test/Test.On.cs | 18 ++-- .../Optional.Test/Test.OnAbsent.TUnit.cs | 12 +-- .../Optional.Test/Test.OnAbsent.Unit.cs | 12 +-- .../Optional.Test/Test.OnAbsent.cs | 12 +-- .../Optional.Test/Test.OnPresent.TUnit.cs | 12 +-- .../Optional.Test/Test.OnPresent.Unit.cs | 12 +-- .../Optional.Test/Test.OnPresent.cs | 12 +-- .../Optional.Tests/Optional.Test/Test.Or.cs | 18 ++-- .../Optional.Test/Test.OrDefault.cs | 6 +- .../Optional.Test/Test.OrElse.cs | 22 ++--- .../Optional.Test/Test.OrThrow.cs | 8 +- .../Optional.Test/Test.ToString.cs | 12 +-- .../Optional.Test/Test.YieldFlattened.cs | 8 +- .../Optional.Test/Test.YieldSingleOrEmpty.cs | 8 +- .../OptionalExtensions.Tests/FilterNotNull.cs | 16 ++-- .../FilterNotNullOrThrow.cs | 28 +++--- ...mentAtOrAbsent.Enumerable.Index.FromEnd.cs | 8 +- .../ElementAtOrAbsent.Enumerable.Index.cs | 8 +- .../ElementAtOrAbsent.Enumerable.Int32.cs | 8 +- .../ElementAtOrAbsent.Enumerable.Int64.cs | 8 +- .../ElementAtOrAbsent.List.Index.FromEnd.cs | 8 +- .../ElementAtOrAbsent.List.Index.cs | 8 +- .../ElementAtOrAbsent.List.Int32.cs | 8 +- .../ElementAtOrAbsent.List.Int64.cs | 8 +- ...ntAtOrAbsent.ReadOnlyList.Index.FromEnd.cs | 8 +- .../ElementAtOrAbsent.ReadOnlyList.Index.cs | 8 +- .../ElementAtOrAbsent.ReadOnlyList.Int32.cs | 8 +- .../ElementAtOrAbsent.ReadOnlyList.Int64.cs | 8 +- .../FirstOrAbsent.Enumerable.cs | 14 +-- .../FirstOrAbsent.List.cs | 14 +-- .../FirstOrAbsent.ReadOnlyList.cs | 14 +-- .../GetValueOrAbsent.Dictionary.cs | 6 +- .../GetValueOrAbsent.Pairs.cs | 10 +-- .../GetValueOrAbsent.ReadOnlyDictionary.cs | 6 +- .../LastOrAbsent.Enumerable.cs | 14 +-- .../LastOrAbsent.List.cs | 14 +-- .../LastOrAbsent.ReadOnlyList.cs | 14 +-- .../SingleOrAbsent.Enumerable.cs | 36 ++++---- .../SingleOrAbsent.List.cs | 36 ++++---- .../SingleOrAbsent.ReadOnlyList.cs | 36 ++++---- .../TryGetValueOrAbsent.cs | 8 +- 81 files changed, 540 insertions(+), 540 deletions(-) diff --git a/src/core-taggeds-optional/Optional.Tests/Absent.Static.Tests/Base/AbsentStaticTestsBase.Comparison.cs b/src/core-taggeds-optional/Optional.Tests/Absent.Static.Tests/Base/AbsentStaticTestsBase.Comparison.cs index 5b9604a8..7e6aaf5d 100644 --- a/src/core-taggeds-optional/Optional.Tests/Absent.Static.Tests/Base/AbsentStaticTestsBase.Comparison.cs +++ b/src/core-taggeds-optional/Optional.Tests/Absent.Static.Tests/Base/AbsentStaticTestsBase.Comparison.cs @@ -9,13 +9,13 @@ partial class AbsentStaticTestsBase public void Comparison_Compare_OfAndDefault_ExpectTrue() { var actual = Absent.Compare(Absent.Of(), default(Absent)); - Assert.Zero(actual); + Assert.That(actual, Is.Zero); } [Test] public void Comparison_Compare_OfAndNew_ExpectTrue() { var actual = Absent.Compare(new Absent(), default(Absent)); - Assert.Zero(actual); + Assert.That(actual, Is.Zero); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Absent.Static.Tests/Base/AbsentStaticTestsBase.Equality.cs b/src/core-taggeds-optional/Optional.Tests/Absent.Static.Tests/Base/AbsentStaticTestsBase.Equality.cs index 66fc53eb..54beee0f 100644 --- a/src/core-taggeds-optional/Optional.Tests/Absent.Static.Tests/Base/AbsentStaticTestsBase.Equality.cs +++ b/src/core-taggeds-optional/Optional.Tests/Absent.Static.Tests/Base/AbsentStaticTestsBase.Equality.cs @@ -9,13 +9,13 @@ partial class AbsentStaticTestsBase public void Equality_Equals_OfAndDefault_ExpectTrue() { var actual = Absent.Equals(Absent.Of(), default(Absent)); - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] public void Equality_Equals_OfAndNew_ExpectTrue() { var actual = Absent.Equals(Absent.Of(), new Absent()); - Assert.True(actual); + Assert.That(actual, Is.True); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Absent.Static.Tests/Base/AbsentStaticTestsBase.Factory.cs b/src/core-taggeds-optional/Optional.Tests/Absent.Static.Tests/Base/AbsentStaticTestsBase.Factory.cs index 79ea2a27..08f68574 100644 --- a/src/core-taggeds-optional/Optional.Tests/Absent.Static.Tests/Base/AbsentStaticTestsBase.Factory.cs +++ b/src/core-taggeds-optional/Optional.Tests/Absent.Static.Tests/Base/AbsentStaticTestsBase.Factory.cs @@ -8,18 +8,18 @@ partial class AbsentStaticTestsBase [Test] public void Factory_Of_ExpectEqualToDefault() { - Assert.AreEqual(default(Absent), Absent.Of()); + Assert.That(Absent.Of(), Is.EqualTo(default(Absent))); } [Test] public void Factory_Of_ExpectEqualToNew() { - Assert.AreEqual(new Absent(), Absent.Of()); + Assert.That(Absent.Of(), Is.EqualTo(new Absent())); } [Test] public void Factory_Of_ExpectEqualToValue() { - Assert.AreEqual(Absent.Value, Absent.Of()); + Assert.That(Absent.Of(), Is.EqualTo(Absent.Value)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Absent.Tests/Base/AbsentTestsBase.Comparison.Static.cs b/src/core-taggeds-optional/Optional.Tests/Absent.Tests/Base/AbsentTestsBase.Comparison.Static.cs index 236da134..29c18e4e 100644 --- a/src/core-taggeds-optional/Optional.Tests/Absent.Tests/Base/AbsentTestsBase.Comparison.Static.cs +++ b/src/core-taggeds-optional/Optional.Tests/Absent.Tests/Base/AbsentTestsBase.Comparison.Static.cs @@ -9,69 +9,69 @@ partial class AbsentTestsBase public void Comparison_Compare_NewAndDefault_ExpectZero() { var actual = Absent.Compare(new Absent(), default); - Assert.Zero(actual); + Assert.That(actual, Is.Zero); } [Test] public void Comparison_Compare_ValueAndDefault_ExpectZero() { var actual = Absent.Compare(Absent.Value, default); - Assert.Zero(actual); + Assert.That(actual, Is.Zero); } [Test] public void Comparison_LessThanOrEqualToOperator_NewAndDefault_ExpectTrue() { var actual = new Absent() <= default(Absent); - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] public void Comparison_LessThanOrEqualToOperator_ValueAndDefault_ExpectTrue() { var actual = Absent.Value <= default(Absent); - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] public void Comparison_GreaterThanOrEqualToOperator_NewAndDefault_ExpectTrue() { var actual = new Absent() >= default(Absent); - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] public void Comparison_GreaterThanOrEqualToOperator_ValueAndDefault_ExpectTrue() { var actual = Absent.Value >= default(Absent); - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] public void Comparison_LessThanOperator_NewAndDefault_ExpectFalse() { var actual = new Absent() < default(Absent); - Assert.False(actual); + Assert.That(actual, Is.False); } [Test] public void Comparison_LessThanOperator_ValueAndDefault_ExpectFalse() { var actual = Absent.Value < default(Absent); - Assert.False(actual); + Assert.That(actual, Is.False); } [Test] public void Comparison_GreaterThanOperator_NewAndDefault_ExpectFalse() { var actual = new Absent() > default(Absent); - Assert.False(actual); + Assert.That(actual, Is.False); } [Test] public void Comparison_GreaterThanOperator_ValueAndDefault_ExpectFalse() { var actual = Absent.Value > default(Absent); - Assert.False(actual); + Assert.That(actual, Is.False); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Absent.Tests/Base/AbsentTestsBase.Comparison.cs b/src/core-taggeds-optional/Optional.Tests/Absent.Tests/Base/AbsentTestsBase.Comparison.cs index 669c2d9a..2a845eab 100644 --- a/src/core-taggeds-optional/Optional.Tests/Absent.Tests/Base/AbsentTestsBase.Comparison.cs +++ b/src/core-taggeds-optional/Optional.Tests/Absent.Tests/Base/AbsentTestsBase.Comparison.cs @@ -9,44 +9,44 @@ partial class AbsentTestsBase public void Comparison_CompareTo_NewAndDefault_ExpectZero() { var actual = new Absent().CompareTo(default); - Assert.Zero(actual); + Assert.That(actual, Is.Zero); } [Test] public void Comparison_CompareTo_ValueAndDefault_ExpectZero() { var actual = Absent.Value.CompareTo(default); - Assert.Zero(actual); + Assert.That(actual, Is.Zero); } [Test] public void Comparison_CompareToObj_NewAndNull_ExpectOne() { var actual = new Absent().CompareTo(null); - Assert.Positive(actual); - Assert.AreEqual(1, actual); + Assert.That(actual, Is.Positive); + Assert.That(actual, Is.EqualTo(1)); } [Test] public void Comparison_CompareToObj_ValueAndNull_ExpectOne() { var actual = Absent.Value.CompareTo(null); - Assert.Positive(actual); - Assert.AreEqual(1, actual); + Assert.That(actual, Is.Positive); + Assert.That(actual, Is.EqualTo(1)); } [Test] public void Comparison_CompareToObj_NewAndDefault_ExpectZero() { var actual = new Absent().CompareTo((object?)default(Absent)); - Assert.Zero(actual); + Assert.That(actual, Is.Zero); } [Test] public void Comparison_CompareToObj_ValueAndDefault_ExpectZero() { var actual = Absent.Value.CompareTo((object?)new Absent()); - Assert.Zero(actual); + Assert.That(actual, Is.Zero); } [Test] diff --git a/src/core-taggeds-optional/Optional.Tests/Absent.Tests/Base/AbsentTestsBase.Equality.Static.cs b/src/core-taggeds-optional/Optional.Tests/Absent.Tests/Base/AbsentTestsBase.Equality.Static.cs index cd6267c0..4d7fecc5 100644 --- a/src/core-taggeds-optional/Optional.Tests/Absent.Tests/Base/AbsentTestsBase.Equality.Static.cs +++ b/src/core-taggeds-optional/Optional.Tests/Absent.Tests/Base/AbsentTestsBase.Equality.Static.cs @@ -9,41 +9,41 @@ partial class AbsentTestsBase public void Equality_Static_Equals_NewAndDefault_ExpectTrue() { var actual = Absent.Equals(new Absent(), default); - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] public void Equality_Static_Equals_ValueAndDefault_ExpectTrue() { var actual = Absent.Equals(Absent.Value, default); - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] public void Equality_Static_EqualityOperator_NewAndDefault_ExpectTrue() { var actual = new Absent() == default; - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] public void Equality_Static_EqualityOperator_ValueAndDefault_ExpectTrue() { var actual = Absent.Value == default; - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] public void Equality_Static_InequalityOperator_NewAndDefault_ExpectFalse() { var actual = new Absent() != default; - Assert.False(actual); + Assert.That(actual, Is.False); } [Test] public void Equality_Static_InequalityOperator_ValueAndDefault_ExpectFalse() { var actual = Absent.Value != default; - Assert.False(actual); + Assert.That(actual, Is.False); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Absent.Tests/Base/AbsentTestsBase.Equality.cs b/src/core-taggeds-optional/Optional.Tests/Absent.Tests/Base/AbsentTestsBase.Equality.cs index 0c3053b7..933d121b 100644 --- a/src/core-taggeds-optional/Optional.Tests/Absent.Tests/Base/AbsentTestsBase.Equality.cs +++ b/src/core-taggeds-optional/Optional.Tests/Absent.Tests/Base/AbsentTestsBase.Equality.cs @@ -9,13 +9,13 @@ partial class AbsentTestsBase public void Equality_Equals_NewAndDefault_ExpectTrue() { var actual = new Absent().Equals(default); - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] public void Equality_Equals_ValueAndDefault_ExpectTrue() { var actual = Absent.Value.Equals(default); - Assert.True(actual); + Assert.That(actual, Is.True); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Absent.Tests/Base/AbsentTestsBase.Factory.cs b/src/core-taggeds-optional/Optional.Tests/Absent.Tests/Base/AbsentTestsBase.Factory.cs index d92da74a..a4a013c0 100644 --- a/src/core-taggeds-optional/Optional.Tests/Absent.Tests/Base/AbsentTestsBase.Factory.cs +++ b/src/core-taggeds-optional/Optional.Tests/Absent.Tests/Base/AbsentTestsBase.Factory.cs @@ -8,12 +8,12 @@ partial class AbsentTestsBase [Test] public void Factory_New_ExpectDefault() { - Assert.AreEqual(default(Absent), new Absent()); + Assert.That(new Absent(), Is.EqualTo(default(Absent))); } [Test] public void Factory_Value_ExpectDefault() { - Assert.AreEqual(default(Absent), Absent.Value); + Assert.That(Absent.Value, Is.EqualTo(default(Absent))); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Absent.Tests/Base/AbsentTestsBase.ToOptional.cs b/src/core-taggeds-optional/Optional.Tests/Absent.Tests/Base/AbsentTestsBase.ToOptional.cs index d683aab0..dff0b343 100644 --- a/src/core-taggeds-optional/Optional.Tests/Absent.Tests/Base/AbsentTestsBase.ToOptional.cs +++ b/src/core-taggeds-optional/Optional.Tests/Absent.Tests/Base/AbsentTestsBase.ToOptional.cs @@ -10,14 +10,14 @@ public void ToOptionalExplicit_FromDefault_ExpectAbsent() { var optional = default(Absent).ToOptional(); - Assert.IsTrue(optional.IsAbsent); + Assert.That(optional.IsAbsent, Is.True); } [Test] public void ToOptionalImplicit_FromDefault_ExpectAbsent() { Optional optional = default(Absent); - Assert.IsTrue(optional.IsAbsent); + Assert.That(optional.IsAbsent, Is.True); } [Test] @@ -25,14 +25,14 @@ public void ToOptionalExplicit_FromNew_ExpectAbsent() { var optional = new Absent().ToOptional(); - Assert.IsTrue(optional.IsAbsent); + Assert.That(optional.IsAbsent, Is.True); } [Test] public void ToOptionalImplicit_FromNew_ExpectAbsent() { Optional optional = new Absent(); - Assert.IsTrue(optional.IsAbsent); + Assert.That(optional.IsAbsent, Is.True); } [Test] @@ -40,13 +40,13 @@ public void ToOptionalExplicit_FromValue_ExpectAbsent() { var optional = Absent.Value.ToOptional(); - Assert.IsTrue(optional.IsAbsent); + Assert.That(optional.IsAbsent, Is.True); } [Test] public void ToOptionalImplicit_FromValue_ExpectAbsent() { Optional optional = Absent.Value; - Assert.IsTrue(optional.IsAbsent); + Assert.That(optional.IsAbsent, Is.True); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Absent.Tests/Base/AbsentTestsBase.ToString.cs b/src/core-taggeds-optional/Optional.Tests/Absent.Tests/Base/AbsentTestsBase.ToString.cs index 37067b7b..9cdb8e2c 100644 --- a/src/core-taggeds-optional/Optional.Tests/Absent.Tests/Base/AbsentTestsBase.ToString.cs +++ b/src/core-taggeds-optional/Optional.Tests/Absent.Tests/Base/AbsentTestsBase.ToString.cs @@ -12,6 +12,6 @@ public void ToString_ExpectAbsentFormat() var expected = string.Format("Absent<{0}>:()", typeof(T).Name); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Obsolete.FilterNotNullOptionalExtensions.Tests/FilterNotNull.cs b/src/core-taggeds-optional/Optional.Tests/Obsolete.FilterNotNullOptionalExtensions.Tests/FilterNotNull.cs index 6385c08c..4d30d0ca 100644 --- a/src/core-taggeds-optional/Optional.Tests/Obsolete.FilterNotNullOptionalExtensions.Tests/FilterNotNull.cs +++ b/src/core-taggeds-optional/Optional.Tests/Obsolete.FilterNotNullOptionalExtensions.Tests/FilterNotNull.cs @@ -13,7 +13,7 @@ public void FilterNotNull_Class_SourceValueIsNotNull_ExpectSource() var source = Optional.Present(PlusFifteenIdRefType); var actual = FilterNotNullOptionalExtensions.FilterNotNull(source); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); } [Test] @@ -22,8 +22,8 @@ public void FilterNotNull_Struct_SourceValueIsNotNull_ExpectSource() var source = Optional.Present(PlusFifteen); var actual = FilterNotNullOptionalExtensions.FilterNotNull(source); - Assert.True(actual.IsPresent); - Assert.AreEqual(source.OrThrow()!.Value, actual.OrThrow()); + Assert.That(actual.IsPresent, Is.True); + Assert.That(actual.OrThrow(), Is.EqualTo(source.OrThrow()!.Value)); } [Test] @@ -34,7 +34,7 @@ public void FilterNotNull_SourceValueIsNull_ExpectAbsent() var actual = FilterNotNullOptionalExtensions.FilterNotNull(source); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -46,7 +46,7 @@ public void FilterNotNull_SourceValueIsNotNullRefType_ExpectNotNullableRefTypePr var actual = FilterNotNullOptionalExtensions.FilterNotNull(source); var expected = Optional.Present(sourceValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -57,7 +57,7 @@ public void FilterNotNull_SourceValueIsNullRefType_ExpectNotNullableRefTypeAbsen var actual = FilterNotNullOptionalExtensions.FilterNotNull(source); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -69,7 +69,7 @@ public void FilterNotNull_SourceValueIsNotNullStructType_ExpectNotNullableStruct var actual = FilterNotNullOptionalExtensions.FilterNotNull(source); var expected = Optional.Present(sourceValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -80,6 +80,6 @@ public void FilterNotNull_SourceValueIsNullStructType_ExpectNotNullableStructTyp var actual = FilterNotNullOptionalExtensions.FilterNotNull(source); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Obsolete.FilterNotNullOptionalExtensions.Tests/FilterNotNullOrThrow.cs b/src/core-taggeds-optional/Optional.Tests/Obsolete.FilterNotNullOptionalExtensions.Tests/FilterNotNullOrThrow.cs index dddd3ae9..90133d5e 100644 --- a/src/core-taggeds-optional/Optional.Tests/Obsolete.FilterNotNullOptionalExtensions.Tests/FilterNotNullOrThrow.cs +++ b/src/core-taggeds-optional/Optional.Tests/Obsolete.FilterNotNullOptionalExtensions.Tests/FilterNotNullOrThrow.cs @@ -13,7 +13,7 @@ public void FilterNotNullOrThrow_SourceValueIsNotNull_ExpectSource() var source = Optional.Present(ZeroIdRefType); var actual = FilterNotNullOptionalExtensions.FilterNotNullOrThrow(source); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); } [Test] @@ -29,7 +29,7 @@ public void FilterNotNullOrThrowWithFactory_ExceptionFactoryIsNull_ExpectArgumen var source = Optional.Present(SomeTextStructType); var ex = Assert.Throws(() => _ = FilterNotNullOptionalExtensions.FilterNotNullOrThrow(source, null!)); - Assert.AreEqual("exceptionFactory", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("exceptionFactory")); } [Test] @@ -38,7 +38,7 @@ public void FilterNotNullOrThrowWithFactory_SourceValueIsNotNull_ExpectSource() var source = Optional.Present(ZeroIdRefType); var actual = FilterNotNullOptionalExtensions.FilterNotNullOrThrow(source, () => new SomeException()); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); } [Test] @@ -48,7 +48,7 @@ public void FilterNotNullOrThrowWithFactory_SourceValueIsNull_ExpectCreatedExcep var resultException = new SomeException(); var ex = Assert.Throws(() => _ = FilterNotNullOptionalExtensions.FilterNotNullOrThrow(source, () => resultException)); - Assert.AreSame(resultException, ex); + Assert.That(ex, Is.SameAs(resultException)); } [Test] @@ -60,7 +60,7 @@ public void FilterNotNullOrThrow_SourceValueIsNotNullRefType_ExpectPresentNotNul var actual = FilterNotNullOptionalExtensions.FilterNotNullOrThrow(source); var expected = Optional.Present(sourceValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -76,7 +76,7 @@ public void FilterNotNullOrThrowWithFactory_RefTypeExceptionFactoryIsNull_Expect var source = Optional.Present(PlusFifteenIdRefType); var ex = Assert.Throws(() => _ = FilterNotNullOptionalExtensions.FilterNotNullOrThrow(source, null!)); - Assert.AreEqual("exceptionFactory", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("exceptionFactory")); } [Test] @@ -88,7 +88,7 @@ public void FilterNotNullOrThrowWithFactory_SourceValueIsNotNullRefType_ExpectPr var actual = FilterNotNullOptionalExtensions.FilterNotNullOrThrow(source, () => new SomeException()); var expected = Optional.Present(sourceValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -97,9 +97,9 @@ public void FilterNotNullOrThrowWithFactory_SourceValueIsNullRefType_ExpectCreat var source = Optional.Present(null); var createdException = new SomeException(); - var actualExcepton = Assert.Throws( + var actualException = Assert.Throws( () => _ = FilterNotNullOptionalExtensions.FilterNotNullOrThrow(source, () => createdException)); - Assert.AreSame(createdException, actualExcepton); + Assert.That(actualException, Is.SameAs(createdException)); } [Test] @@ -111,7 +111,7 @@ public void FilterNotNullOrThrow_SourceValueIsNotNullStructType_ExpectPresentNot var actual = FilterNotNullOptionalExtensions.FilterNotNullOrThrow(source); var expected = Optional.Present(sourceValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -127,7 +127,7 @@ public void FilterNotNullOrThrowWithFactory_StructExceptionFactoryIsNull_ExpectA var source = Optional.Present(null); var ex = Assert.Throws(() => _ = FilterNotNullOptionalExtensions.FilterNotNullOrThrow(source, null!)); - Assert.AreEqual("exceptionFactory", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("exceptionFactory")); } [Test] @@ -139,7 +139,7 @@ public void FilterNotNullOrThrowWithFactory_SourceValueIsNotNullStructType_Expec var actual = FilterNotNullOptionalExtensions.FilterNotNullOrThrow(source, () => new SomeException()); var expected = Optional.Present(sourceValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -148,8 +148,8 @@ public void FilterNotNullOrThrowWithFactory_SourceValueIsNullStructType_ExpectCr var source = Optional.Present(null); var createdException = new SomeException(); - var actualExcepton = Assert.Throws( + var actualException = Assert.Throws( () => _ = FilterNotNullOptionalExtensions.FilterNotNullOrThrow(source, () => createdException)); - Assert.AreSame(createdException, actualExcepton); + Assert.That(actualException, Is.SameAs(createdException)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqDictionariesExtensions.Tests/GetValueOrAbsent.Dictionary.cs b/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqDictionariesExtensions.Tests/GetValueOrAbsent.Dictionary.cs index 1913e699..c3cd941f 100644 --- a/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqDictionariesExtensions.Tests/GetValueOrAbsent.Dictionary.cs +++ b/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqDictionariesExtensions.Tests/GetValueOrAbsent.Dictionary.cs @@ -15,7 +15,7 @@ public void GetValueOrAbsent_DictionaryPairsAreNull_ExpectArgumentNullException( IDictionary sourceDictionary = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("pairs", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("pairs")); void Test() => @@ -33,7 +33,7 @@ public void GetValueOrAbsent_DictionaryPairsPairsTryGetValueReturnsFalse_ExpectA var actual = OptionalLinqDictionariesExtensions.GetValueOrAbsent(sourceDictionary, PlusFifteenIdRefType); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -50,6 +50,6 @@ public void GetValueOrAbsent_DictionaryPairsPairsTryGetValueReturnsTrue_ExpectPr var actual = OptionalLinqDictionariesExtensions.GetValueOrAbsent(sourceDictionary, NullTextStructType); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqDictionariesExtensions.Tests/GetValueOrAbsent.Pair.cs b/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqDictionariesExtensions.Tests/GetValueOrAbsent.Pair.cs index dc555ae7..771d5bdc 100644 --- a/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqDictionariesExtensions.Tests/GetValueOrAbsent.Pair.cs +++ b/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqDictionariesExtensions.Tests/GetValueOrAbsent.Pair.cs @@ -15,7 +15,7 @@ public void GetValueOrAbsent_PairsAreNull_ExpectArgumentNullException() IEnumerable> sourcePairs = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("pairs", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("pairs")); void Test() => @@ -33,7 +33,7 @@ public void GetValueOrAbsent_PairsDoNotContainKey_ExpectAbsent() var actual = OptionalLinqDictionariesExtensions.GetValueOrAbsent(sourcePairs, PlusFifteen); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -53,7 +53,7 @@ public void GetValueOrAbsent_PairsContainOnlyOneKey_ExpectPresentKeyValue( var actual = OptionalLinqDictionariesExtensions.GetValueOrAbsent(sourcePairs, sourceKey); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [TestCase] @@ -68,7 +68,7 @@ public void GetValueOrAbsent_PairsContainOnlyOneKeyAndKeyIsNull_ExpectPresentKey var actual = OptionalLinqDictionariesExtensions.GetValueOrAbsent(sourcePairs, null); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -88,6 +88,6 @@ public void GetValueOrAbsent_PairsContainMoreThanOneKey_ExpectFirst() var expected2 = Optional.Present(expectedValue2); bool equalToAnExpected = actual.Equals(expected1) || actual.Equals(expected2); - Assert.True(equalToAnExpected); + Assert.That(equalToAnExpected); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqDictionariesExtensions.Tests/GetValueOrAbsent.ReadOnlyDictionary.Public.cs b/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqDictionariesExtensions.Tests/GetValueOrAbsent.ReadOnlyDictionary.Public.cs index 9669b2c1..c363a69a 100644 --- a/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqDictionariesExtensions.Tests/GetValueOrAbsent.ReadOnlyDictionary.Public.cs +++ b/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqDictionariesExtensions.Tests/GetValueOrAbsent.ReadOnlyDictionary.Public.cs @@ -15,7 +15,7 @@ public void GetValueOrAbsent_PublicReadOnlyDictionaryPairsAreNull_ExpectArgument IReadOnlyDictionary sourceDictionary = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("dictionary", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("dictionary")); void Test() => @@ -35,7 +35,7 @@ public void GetValueOrAbsent_PublicReadOnlyDictionaryPairsTryGetValueReturnsFals var actual = OptionalLinqDictionariesExtensions.GetValueOrAbsent(sourceDictionary, MinusFifteen); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -56,6 +56,6 @@ public void GetValueOrAbsent_PublicReadOnlyDictionaryPairsTryGetValueReturnsTrue var actual = OptionalLinqDictionariesExtensions.GetValueOrAbsent(sourceDictionary, PlusFifteen); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqDictionariesExtensions.Tests/GetValueOrAbsent.ReadOnlyDictionary.cs b/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqDictionariesExtensions.Tests/GetValueOrAbsent.ReadOnlyDictionary.cs index 24607276..5a8e3cea 100644 --- a/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqDictionariesExtensions.Tests/GetValueOrAbsent.ReadOnlyDictionary.cs +++ b/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqDictionariesExtensions.Tests/GetValueOrAbsent.ReadOnlyDictionary.cs @@ -15,7 +15,7 @@ public void GetValueOrAbsent_ReadOnlyDictionaryPairsAreNull_ExpectArgumentNullEx IReadOnlyDictionary sourceDictionary = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("pairs", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("pairs")); void Test() => @@ -35,7 +35,7 @@ public void GetValueOrAbsent_ReadOnlyDictionaryPairsTryGetValueReturnsFalse_Expe var actual = OptionalLinqDictionariesExtensions.GetValueOrAbsent(sourceDictionary, MinusFifteen); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -56,6 +56,6 @@ public void GetValueOrAbsent_ReadOnlyDictionaryPairsTryGetValueReturnsTrue_Expec var actual = OptionalLinqDictionariesExtensions.GetValueOrAbsent(sourceDictionary, PlusFifteen); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqExtensions.ReadOnly.Tests/ElementAtOrAbsent.cs b/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqExtensions.ReadOnly.Tests/ElementAtOrAbsent.cs index 71d8e083..04b92183 100644 --- a/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqExtensions.ReadOnly.Tests/ElementAtOrAbsent.cs +++ b/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqExtensions.ReadOnly.Tests/ElementAtOrAbsent.cs @@ -16,7 +16,7 @@ public void ElementAtOrAbsentByInt_ReadOnlyListSourceIsNull_ExpectArgumentNullEx int index = 1; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -37,7 +37,7 @@ public void ElementAtOrAbsentByInt_ReadOnlyListIndexIsInRange_ExpectPresentItem( var expectedValue = source.ElementAt(index); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -53,7 +53,7 @@ public void ElementAtOrAbsentByInt_ReadOnlyListIndexIsNotInRange_ExpectAbsent( var actual = OptionalLinqExtensions.ElementAtOrAbsent(source, index); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -63,7 +63,7 @@ public void ElementAtOrAbsentByLong_ReadOnlyListSourceIsNull_ExpectArgumentNullE long index = 1; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -83,7 +83,7 @@ public void ElementAtOrAbsentByLong_ReadOnlyListIndexIsInRange_ExpectPresentItem var expectedValue = source.ElementAt(index); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -99,6 +99,6 @@ public void ElementAtOrAbsentByLong_ReadOnlyListIndexIsNotInRange_ExpectAbsent( var actual = OptionalLinqExtensions.ElementAtOrAbsent(source, index); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqExtensions.ReadOnly.Tests/FirstOrAbsent.cs b/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqExtensions.ReadOnly.Tests/FirstOrAbsent.cs index 7dcb6ea7..1ed83e80 100644 --- a/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqExtensions.ReadOnly.Tests/FirstOrAbsent.cs +++ b/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqExtensions.ReadOnly.Tests/FirstOrAbsent.cs @@ -15,7 +15,7 @@ public void FirstOrAbsent_ReadOnlyListSourceIsNull_ExpectArgumentNullException() IReadOnlyList source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -30,7 +30,7 @@ public void FirstOrAbsent_ReadOnlyListSourceIsEmpty_ExpectAbsent() var actual = OptionalLinqExtensions.FirstOrAbsent(source); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -43,7 +43,7 @@ public void FirstOrAbsent_ReadOnlyListSourceIsNotEmpty_ExpectPresentFirstItem( var actual = OptionalLinqExtensions.FirstOrAbsent(source); var expected = Optional.Present(firstItem); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -52,7 +52,7 @@ public void FirstOrAbsentByPredicate_ReadOnlyListSourceIsNull_ExpectArgumentNull IReadOnlyList source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -65,7 +65,7 @@ public void FirstOrAbsentByPredicate_ReadOnlyListPredicateIsNull_ExpectArgumentN var source = CreateReadOnlyList(SomeTextStructType); var ex = Assert.Throws(Test); - Assert.AreEqual("predicate", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("predicate")); void Test() => @@ -80,7 +80,7 @@ public void FirstOrAbsentByPredicate_ReadOnlyListPredicateResultIsAlreadyFalse_E var actual = OptionalLinqExtensions.FirstOrAbsent(source, static _ => false); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -103,7 +103,7 @@ public void FirstOrAbsentByPredicate_ReadOnlyListPredicateResultIsNotAlreadyFals var actual = OptionalLinqExtensions.FirstOrAbsent(source, Predicate); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); static bool Predicate(RefType? item) => diff --git a/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqExtensions.ReadOnly.Tests/GetValueOrAbsent.cs b/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqExtensions.ReadOnly.Tests/GetValueOrAbsent.cs index d706e412..6f661db4 100644 --- a/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqExtensions.ReadOnly.Tests/GetValueOrAbsent.cs +++ b/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqExtensions.ReadOnly.Tests/GetValueOrAbsent.cs @@ -15,7 +15,7 @@ public void GetValueOrAbsent_ReadOnlyDictionaryPairsAreNull_ExpectArgumentNullEx IReadOnlyDictionary sourceDictionary = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("dictionary", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("dictionary")); void Test() => @@ -35,7 +35,7 @@ public void GetValueOrAbsent_ReadOnlyDictionaryPairsTryGetValueReturnsFalse_Expe var actual = OptionalLinqExtensions.GetValueOrAbsent(sourceDictionary, MinusFifteen); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -54,6 +54,6 @@ public void GetValueOrAbsent_ReadOnlyDictionaryPairsTryGetValueReturnsTrue_Expec var actual = OptionalLinqExtensions.GetValueOrAbsent(sourceDictionary, decimal.MinusOne); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqExtensions.ReadOnly.Tests/LastOrAbsent.cs b/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqExtensions.ReadOnly.Tests/LastOrAbsent.cs index 268b3e48..e2c88c72 100644 --- a/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqExtensions.ReadOnly.Tests/LastOrAbsent.cs +++ b/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqExtensions.ReadOnly.Tests/LastOrAbsent.cs @@ -15,7 +15,7 @@ public void LastOrAbsent_ReadOnlyListSourceIsNull_ExpectArgumentNullException() IReadOnlyList source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -30,7 +30,7 @@ public void LastOrAbsent_ReadOnlyListSourceIsEmpty_ExpectAbsent() var actual = OptionalLinqExtensions.LastOrAbsent(source); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -43,7 +43,7 @@ public void LastOrAbsent_ReadOnlyListSourceIsNotEmpty_ExpectPresentLastItem( var actual = OptionalLinqExtensions.LastOrAbsent(source); var expected = Optional.Present(lastItem); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -52,7 +52,7 @@ public void LastOrAbsentByPredicate_ReadOnlyListSourceIsNull_ExpectArgumentNullE IReadOnlyList source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -65,7 +65,7 @@ public void LastOrAbsentByPredicate_ReadOnlyListPredicateIsNull_ExpectArgumentNu var source = CreateReadOnlyList(SomeTextStructType); var ex = Assert.Throws(Test); - Assert.AreEqual("predicate", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("predicate")); void Test() => @@ -80,7 +80,7 @@ public void LastOrAbsentByPredicate_ReadOnlyListPredicateResultIsAlreadyFalse_Ex var actual = OptionalLinqExtensions.LastOrAbsent(source, static _ => false); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -104,7 +104,7 @@ public void LastOrAbsentByPredicate_ReadOnlyListPredicateResultIsNotAlreadyFalse var actual = OptionalLinqExtensions.LastOrAbsent(source, Predicate); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); static bool Predicate(RefType? item) => diff --git a/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqExtensions.ReadOnly.Tests/SingleOrAbsent.cs b/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqExtensions.ReadOnly.Tests/SingleOrAbsent.cs index f3ded5fa..3faa976b 100644 --- a/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqExtensions.ReadOnly.Tests/SingleOrAbsent.cs +++ b/src/core-taggeds-optional/Optional.Tests/Obsolete.OptionalLinqExtensions.ReadOnly.Tests/SingleOrAbsent.cs @@ -15,7 +15,7 @@ public void SingleOrAbsent_ReadOnlyListSourceIsNull_ExpectArgumentNullException( IReadOnlyList source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -30,7 +30,7 @@ public void SingleOrAbsent_ReadOnlyListSourceIsEmpty_ExpectAbsent() var actual = OptionalLinqExtensions.SingleOrAbsent(source); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -43,7 +43,7 @@ public void SingleOrAbsent_ReadOnlyListSourceContainsOnlyOneElement_ExpectPresen var actual = OptionalLinqExtensions.SingleOrAbsent(source); var expected = Optional.Present(singleItem); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -63,7 +63,7 @@ public void SingleOrAbsentWithExceptionFactory_ReadOnlyListSourceIsNull_ExpectAr IReadOnlyList source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -77,7 +77,7 @@ public void SingleOrAbsentWithExceptionFactory_ReadOnlyListExceptionFactoryIsNul Func exceptionFactory = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("moreThanOneElementExceptionFactory", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("moreThanOneElementExceptionFactory")); void Test() => @@ -92,7 +92,7 @@ public void SingleOrAbsentWithExceptionFactory_ReadOnlyListSourceIsEmpty_ExpectA var actual = OptionalLinqExtensions.SingleOrAbsent(source, CreateSomeException); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -105,7 +105,7 @@ public void SingleOrAbsentWithExceptionFactory_ReadOnlyListSourceContainsOnlyOne var actual = OptionalLinqExtensions.SingleOrAbsent(source, CreateSomeException); var expected = Optional.Present(singleItem); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -115,7 +115,7 @@ public void SingleOrAbsentWithExceptionFactory_ReadOnlyListSourceContainsMoreTha var createdException = new SomeException(); var ex = Assert.Throws(Test); - Assert.AreSame(createdException, ex); + Assert.That(ex, Is.SameAs(createdException)); void Test() => @@ -128,7 +128,7 @@ public void SingleOrAbsentByPredicate_ReadOnlyListSourceIsNull_ExpectArgumentNul IReadOnlyList source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -142,7 +142,7 @@ public void SingleOrAbsentByPredicate_ReadOnlyListPredicateIsNull_ExpectArgument Func predicate = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("predicate", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("predicate")); void Test() => @@ -157,7 +157,7 @@ public void SingleOrAbsentByPredicate_ReadOnlyListPredicateResultIsAlreadyFalse_ var actual = OptionalLinqExtensions.SingleOrAbsent(source, static _ => false); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -174,7 +174,7 @@ public void SingleOrAbsentByPredicate_ReadOnlyListPredicateResultIsTrueOnlyOnce_ var actual = OptionalLinqExtensions.SingleOrAbsent(source, item => expectedText.Equals(item?.Text, StringComparison.InvariantCultureIgnoreCase)); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -212,7 +212,7 @@ public void SingleOrAbsentByPredicateAndFactory_ReadOnlyListSourceIsNull_ExpectA IReadOnlyList source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -226,7 +226,7 @@ public void SingleOrAbsentByPredicateAndFactory_ReadOnlyListPredicateIsNull_Expe Func predicate = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("predicate", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("predicate")); void Test() => @@ -239,7 +239,7 @@ public void SingleOrAbsentByPredicateAndFactory_ReadOnlyListExceptionFactoryIsNu var source = CreateReadOnlyList(MinusFifteenIdRefType); var ex = Assert.Throws(Test); - Assert.AreEqual("moreThanOneMatchExceptionFactory", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("moreThanOneMatchExceptionFactory")); void Test() => @@ -254,7 +254,7 @@ public void SingleOrAbsentByPredicateAndFactory_ReadOnlyListPredicateResultIsAlr var actual = OptionalLinqExtensions.SingleOrAbsent(source, static _ => false, CreateSomeException); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -271,7 +271,7 @@ public void SingleOrAbsentByPredicateAndFactory_ReadOnlyListPredicateResultIsTru var actual = OptionalLinqExtensions.SingleOrAbsent(source, item => expectedText.Equals(item?.Text, StringComparison.InvariantCultureIgnoreCase), CreateSomeException); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -295,7 +295,7 @@ public void SingleOrAbsentByPredicateAndFactory_ReadOnlyListPredicateResultIsTru var createdException = new SomeException(); var actualException = Assert.Throws(Test); - Assert.AreSame(createdException, actualException); + Assert.That(actualException, Is.SameAs(createdException)); void Test() => diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Static.Test/OptionalStaticTest.Equality.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Static.Test/OptionalStaticTest.Equality.cs index 12f23778..4a62c399 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Static.Test/OptionalStaticTest.Equality.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Static.Test/OptionalStaticTest.Equality.cs @@ -14,7 +14,7 @@ public void Equals_AIsAbsentAndBIsAbsent_ExpectTrue() var optionalB = Optional.Absent; var actual = Optional.Equals(optionalA, optionalB); - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] @@ -24,7 +24,7 @@ public void Equals_AIsDefaultAndBIsAbsent_ExpectTrue() var optionalB = Optional.Absent; var actual = Optional.Equals(optionalA, optionalB); - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] @@ -34,7 +34,7 @@ public void Equals_AIsAbsentAndBIsDefault_ExpectTrue() var optionalB = default(Optional); var actual = Optional.Equals(optionalA, optionalB); - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] @@ -46,7 +46,7 @@ public void Equals_AIsPresentAndBIsPresentAndValuesAreSame_ExpectTrue() var optionalB = Optional.Present(value); var actual = Optional.Equals(optionalA, optionalB); - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] @@ -56,7 +56,7 @@ public void Equals_AIsPresentAndBIsPresentAndValuesAreNull_ExpectTrue() var optionalB = Optional.Present(null); var actual = Optional.Equals(optionalA, optionalB); - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] @@ -66,7 +66,7 @@ public void Equals_AIsAbsentAndBIsPresent_ExpectFalse() var optionalB = Optional.Present(MinusFifteenIdRefType); var actual = Optional.Equals(optionalA, optionalB); - Assert.False(actual); + Assert.That(actual, Is.False); } [Test] @@ -76,7 +76,7 @@ public void Equals_AIsPresentAndBIsAbsent_ExpectFalse() var optionalB = Optional.Absent; var actual = Optional.Equals(optionalA, optionalB); - Assert.False(actual); + Assert.That(actual, Is.False); } [Test] @@ -86,6 +86,6 @@ public void Equals_AIsPresentAndBIsPresentAndValuesAreNotSame_ExpectFalse() var optionalB = Optional.Present(ZeroIdRefType); var actual = Optional.Equals(optionalA, optionalB); - Assert.False(actual); + Assert.That(actual, Is.False); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Static.Test/OptionalStaticTest.Factory.Bool.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Static.Test/OptionalStaticTest.Factory.Bool.cs index 243fe191..c75086bf 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Static.Test/OptionalStaticTest.Factory.Bool.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Static.Test/OptionalStaticTest.Factory.Bool.cs @@ -11,7 +11,7 @@ public void True_ExpectPresent() var actual = Optional.True(); var expected = Optional.Present(Unit.Value); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -20,6 +20,6 @@ public void False_ExpectAbsent() var actual = Optional.False(); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Static.Test/OptionalStaticTest.Factory.OrElse.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Static.Test/OptionalStaticTest.Factory.OrElse.cs index 8979c030..4629db6d 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Static.Test/OptionalStaticTest.Factory.OrElse.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Static.Test/OptionalStaticTest.Factory.OrElse.cs @@ -15,7 +15,7 @@ public void PresentOrElse_ValueIsNotNull_ExpectPresent() var actual = Optional.PresentOrElse(sourceValue); var expected = Optional.Present(sourceValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -24,7 +24,7 @@ public void PresentOrElse_ValueIsNull_ExpectAbsent() var actual = Optional.PresentOrElse(null!); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -35,7 +35,7 @@ public void PresentOrElseWithStructValue_ValueIsNotNull_ExpectPresent() var actual = Optional.PresentOrElse(sourceValue); var expected = Optional.Present(SomeTextStructType); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -46,7 +46,7 @@ public void PresentOrElseWithStructValue_NullableValueIsNotNull_ExpectPresent() var actual = Optional.PresentOrElse(sourceValue); var expected = Optional.Present(SomeTextStructType); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -55,6 +55,6 @@ public void PresentOrElseWithStructValue_ValueIsNull_ExpectAbsent() var actual = Optional.PresentOrElse(null!); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Static.Test/OptionalStaticTest.Factory.OrThrow.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Static.Test/OptionalStaticTest.Factory.OrThrow.cs index 773d8764..bbaa35d0 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Static.Test/OptionalStaticTest.Factory.OrThrow.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Static.Test/OptionalStaticTest.Factory.OrThrow.cs @@ -15,14 +15,14 @@ public void PresentOrThrow_ValueIsNotNull_ExpectPresent() var actual = Optional.PresentOrThrow(sourceValue); var expected = Optional.Present(sourceValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] public void PresentOrThrow_ValueIsNull_ExpectArgumentNullException() { var ex = Assert.Throws(() => _ = Optional.PresentOrThrow(null!)); - Assert.AreEqual("value", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("value")); } [Test] @@ -33,7 +33,7 @@ public void PresentOrThrowWithStructValue_ValueIsNotNull_ExpectPresent() var actual = Optional.PresentOrThrow(sourceValue); var expected = Optional.Present(SomeTextStructType); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -44,13 +44,13 @@ public void PresentOrThrowWithStructValue_NullableValueIsNotNull_ExpectPresent() var actual = Optional.PresentOrThrow(sourceValue); var expected = Optional.Present(SomeTextStructType); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] public void PresentOrThrowWithStructValue_ValueIsNull_ExpectArgumentNullException() { var ex = Assert.Throws(() => _ = Optional.PresentOrThrow(null!)); - Assert.AreEqual("value", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("value")); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Static.Test/OptionalStaticTest.Factory.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Static.Test/OptionalStaticTest.Factory.cs index ab4f15ce..14da93bf 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Static.Test/OptionalStaticTest.Factory.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Static.Test/OptionalStaticTest.Factory.cs @@ -13,7 +13,7 @@ public void Present_ExpectPresent( var actual = Optional.Present(sourceValue); var expected = Optional.Present(sourceValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -22,7 +22,7 @@ public void Absent_ExpectAbsent() var actual = Optional.Absent(); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -31,6 +31,6 @@ public void Absent_FromUnit_ExpectAbsent() var actual = Optional.Absent(Unit.Value); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Bind.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Bind.cs index 962dcc61..45c7fe62 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Bind.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Bind.cs @@ -14,7 +14,7 @@ public void Bind_MapIsNull_ExpectArgumentNullException() var source = Optional.Present(PlusFifteenIdRefType); var ex = Assert.Throws(() => _ = source.Bind(null!)); - Assert.AreEqual("binder", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("binder")); } [Test] @@ -24,7 +24,7 @@ public void Bind_SourceIsAbsent_ExpectAbsent() var result = Optional.Present(PlusFifteenIdRefType); var actual = source.Bind(_ => result); - Assert.True(actual.IsAbsent); + Assert.That(actual.IsAbsent, Is.True); } [Test] @@ -37,7 +37,7 @@ public void Bind_SourceIsPresent_ExpectResultValue( var result = isResultPresent ? Optional.Present(PlusFifteenIdRefType) : Optional.Absent; var actual = source.Bind(_ => result); - Assert.AreEqual(result, actual); + Assert.That(actual, Is.EqualTo(result)); } [Test] @@ -46,7 +46,7 @@ public void BindAsync_MapAsyncIsNull_ExpectArgumentNullException() var source = Optional.Present(SomeTextStructType); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("binderAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("binderAsync")); async Task TestAsync() => @@ -60,7 +60,7 @@ public async Task BindAsync_SourceIsAbsent_ExpectAbsent() var result = Optional.Present(PlusFifteenIdRefType); var actual = await source.BindAsync(_ => Task.FromResult(result)); - Assert.True(actual.IsAbsent); + Assert.That(actual.IsAbsent, Is.True); } [Test] @@ -73,7 +73,7 @@ public async Task BindAsync_SourceIsPresent_ExpectResultValue( var result = isResultPresent ? Optional.Present(SomeTextStructType) : Optional.Absent; var actual = await source.BindAsync(_ => Task.FromResult(result)); - Assert.AreEqual(result, actual); + Assert.That(actual, Is.EqualTo(result)); } [Test] @@ -82,7 +82,7 @@ public void BindValueAsync_MapAsyncIsNull_ExpectArgumentNullException() var source = Optional.Present(PlusFifteenIdRefType); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("binderAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("binderAsync")); async Task TestAsync() => @@ -96,7 +96,7 @@ public async Task BindValueAsync_SourceIsAbsent_ExpectAbsent() var result = Optional.Present(SomeTextStructType); var actual = await source.BindValueAsync(_ => ValueTask.FromResult(result)); - Assert.True(actual.IsAbsent); + Assert.That(actual.IsAbsent, Is.True); } [Test] @@ -109,6 +109,6 @@ public async Task BindValueAsync_SourceIsPresent_ExpectResultValue( var result = isResultPresent ? Optional.Present(MinusFifteenIdRefType) : Optional.Absent; var actual = await source.BindValueAsync(_ => ValueTask.FromResult(result)); - Assert.AreEqual(result, actual); + Assert.That(actual, Is.EqualTo(result)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Equality.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Equality.cs index ffd4451e..4afc53d6 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Equality.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Equality.cs @@ -14,7 +14,7 @@ public void Equals_AIsAbsentAndBIsAbsent_ExpectTrue() var optionalB = Optional.Absent; var actual = Optional.Equals(optionalA, optionalB); - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] @@ -24,7 +24,7 @@ public void Equals_AIsDefaultAndBIsAbsent_ExpectTrue() var optionalB = Optional.Absent; var actual = Optional.Equals(optionalA, optionalB); - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] @@ -34,7 +34,7 @@ public void Equals_AIsAbsentAndBIsDefault_ExpectTrue() var optionalB = default(Optional); var actual = Optional.Equals(optionalA, optionalB); - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] @@ -46,7 +46,7 @@ public void Equals_AIsPresentAndBIsPresentAndValuesAreSame_ExpectTrue() var optionalB = Optional.Present(value); var actual = Optional.Equals(optionalA, optionalB); - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] @@ -56,7 +56,7 @@ public void Equals_AIsPresentAndBIsPresentAndValuesAreNull_ExpectTrue() var optionalB = Optional.Present(null); var actual = Optional.Equals(optionalA, optionalB); - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] @@ -66,7 +66,7 @@ public void Equals_AIsAbsentAndBIsPresent_ExpectFalse() var optionalB = Optional.Present(MinusFifteenIdRefType); var actual = Optional.Equals(optionalA, optionalB); - Assert.False(actual); + Assert.That(actual, Is.False); } [Test] @@ -76,7 +76,7 @@ public void Equals_AIsPresentAndBIsAbsent_ExpectFalse() var optionalB = Optional.Absent; var actual = Optional.Equals(optionalA, optionalB); - Assert.False(actual); + Assert.That(actual, Is.False); } [Test] @@ -86,7 +86,7 @@ public void Equals_AIsPresentAndBIsPresentAndValuesAreNotSame_ExpectFalse() var optionalB = Optional.Present(ZeroIdRefType); var actual = Optional.Equals(optionalA, optionalB); - Assert.False(actual); + Assert.That(actual, Is.False); } [Test] @@ -96,7 +96,7 @@ public void EqualityOperator_AIsAbsentAndBIsAbsent_ExpectTrue() var optionalB = Optional.Absent; var actual = optionalA == optionalB; - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] @@ -108,7 +108,7 @@ public void EqualityOperator_AIsPresentAndBIsPresentAndValuesAreSame_ExpectTrue( var optionalB = Optional.Present(value); var actual = optionalA == optionalB; - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] @@ -118,7 +118,7 @@ public void EqualityOperator_AIsPresentAndBIsPresentAndValuesAreNull_ExpectTrue( var optionalB = Optional.Present(null); var actual = optionalA == optionalB; - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] @@ -128,7 +128,7 @@ public void EqualityOperator_AIsAbsentAndBIsPresent_ExpectFalse() var optionalB = Optional.Present(PlusFifteenIdRefType); var actual = optionalA == optionalB; - Assert.False(actual); + Assert.That(actual, Is.False); } [Test] @@ -138,7 +138,7 @@ public void EqualityOperator_AIsPresentAndBIsAbsent_ExpectFalse() var optionalB = Optional.Absent; var actual = optionalA == optionalB; - Assert.False(actual); + Assert.That(actual, Is.False); } [Test] @@ -148,7 +148,7 @@ public void EqualityOperator_AIsPresentAndBIsPresentAndValuesAreNotSame_ExpectFa var optionalB = Optional.Present(SomeTextStructType); var actual = optionalA == optionalB; - Assert.False(actual); + Assert.That(actual, Is.False); } [Test] @@ -158,7 +158,7 @@ public void InequalityOperator_AIsAbsentAndBIsAbsent_ExpectFalse() var optionalB = Optional.Absent; var actual = optionalA != optionalB; - Assert.False(actual); + Assert.That(actual, Is.False); } [Test] @@ -170,7 +170,7 @@ public void InequalityOperator_AIsPresentAndBIsPresentAndValuesAreSame_ExpectFal var optionalB = Optional.Present(value); var actual = optionalA != optionalB; - Assert.False(actual); + Assert.That(actual, Is.False); } [Test] @@ -180,7 +180,7 @@ public void InequalityOperator_AIsPresentAndBIsPresentAndValuesAreNull_ExpectFal var optionalB = Optional.Present(null); var actual = optionalA != optionalB; - Assert.False(actual); + Assert.That(actual, Is.False); } [Test] @@ -190,7 +190,7 @@ public void InequalityOperator_AIsAbsentAndBIsPresent_ExpectTrue() var optionalB = Optional.Present(SomeTextStructType); var actual = optionalA != optionalB; - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] @@ -200,7 +200,7 @@ public void InequalityOperator_AIsPresentAndBIsAbsent_ExpectTrue() var optionalB = Optional.Absent; var actual = optionalA != optionalB; - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] @@ -210,7 +210,7 @@ public void InequalityOperator_AIsPresentAndBIsPresentAndValuesAreNotSame_Expect var optionalB = Optional.Present(PlusFifteenIdRefType); var actual = optionalA != optionalB; - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] @@ -220,7 +220,7 @@ public void EqualsWithOther_SourceIsAbsentAndOtherIsAbsent_ExpectTrue() var other = Optional.Absent; var actual = source.Equals(other); - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] @@ -232,7 +232,7 @@ public void EqualsWithOther_SourceIsPresentAndOtherIsPresentAndValuesAreSame_Exp var other = Optional.Present(value); var actual = source.Equals(other); - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] @@ -242,7 +242,7 @@ public void EqualsWithOther_SourceIsPresentAndOtherIsPresentAndValuesAreNull_Exp var other = Optional.Present(null); var actual = source.Equals(other); - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] @@ -252,7 +252,7 @@ public void EqualsWithOther_SourceIsAbsentAndOtherIsPresent_ExpectFalse() var other = Optional.Present(default); var actual = source.Equals(other); - Assert.False(actual); + Assert.That(actual, Is.False); } [Test] @@ -262,7 +262,7 @@ public void EqualsWithOther_SourceIsPresentAndOtherIsAbsent_ExpectFalse() var other = Optional.Absent; var actual = source.Equals(other); - Assert.False(actual); + Assert.That(actual, Is.False); } [Test] @@ -272,7 +272,7 @@ public void EqualsWithOther_SourceIsPresentAndOtherIsPresentAndValuesAreNotSame_ var other = Optional.Present(NullTextStructType); var actual = source.Equals(other); - Assert.False(actual); + Assert.That(actual, Is.False); } [Test] @@ -282,7 +282,7 @@ public void EqualsWithObject_SourceIsAbsentAndObjectIsAbsent_ExpectTrue() var obj = (object?)Optional.Absent; var actual = source.Equals(obj); - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] @@ -294,7 +294,7 @@ public void EqualsWithObject_SourceIsPresentAndObjectIsPresentAndValuesAreSame_E var obj = (object?)Optional.Present(value); var actual = source.Equals(obj); - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] @@ -304,7 +304,7 @@ public void EqualsWithObject_SourceIsPresentAndObjectIsPresentAndValuesAreNull_E var obj = (object?)Optional.Present(null); var actual = source.Equals(obj); - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] @@ -314,7 +314,7 @@ public void EqualsWithObject_SourceIsPresentAndObjectIsOptionalOfSameRefNullable var obj = (object?)Optional.Present(PlusFifteenIdRefType); var actual = source.Equals(obj); - Assert.True(actual); + Assert.That(actual, Is.True); } [Test] @@ -324,7 +324,7 @@ public void EqualsWithObject_SourceIsAbsentAndObjectIsPresent_ExpectFalse() var obj = (object?)Optional.Present(default); var actual = source.Equals(obj); - Assert.False(actual); + Assert.That(actual, Is.False); } [Test] @@ -334,7 +334,7 @@ public void EqualsWithObject_SourceIsPresentAndObjectIsAbsent_ExpectFalse() var obj = (object?)Optional.Absent; var actual = source.Equals(obj); - Assert.False(actual); + Assert.That(actual, Is.False); } [Test] @@ -344,7 +344,7 @@ public void EqualsWithObject_SourceIsPresentAndObjectIsPresentAndValuesAreNotSam var obj = (object?)Optional.Present(NullTextStructType); var actual = source.Equals(obj); - Assert.False(actual); + Assert.That(actual, Is.False); } [Test] @@ -355,7 +355,7 @@ public void EqualsWithObject_SourceIsAbsentAndObjectIsNotOptional_ExpectFalse( var source = Optional.Absent; var actual = source.Equals(obj); - Assert.False(actual); + Assert.That(actual, Is.False); } [Test] @@ -366,7 +366,7 @@ public void EqualsWithObject_SourceIsPresentAndObjectIsNotOptional_ExpectFalse( var source = Optional.Present(MinusFifteenIdRefType); var actual = source.Equals(obj); - Assert.False(actual); + Assert.That(actual, Is.False); } [Test] @@ -376,7 +376,7 @@ public void EqualsWithObject_SourceIsAbsentAndObjectIsOtherOptional_ExpectFalse( var obj = Optional.Absent; var actual = source.Equals(obj); - Assert.False(actual); + Assert.That(actual, Is.False); } [Test] @@ -386,7 +386,7 @@ public void EqualsWithObject_SourceIsPresentAndObjectIsOtherOptional_ExpectFalse var obj = Optional.Present(MinusFifteenIdRefType); var actual = source.Equals(obj); - Assert.False(actual); + Assert.That(actual, Is.False); } [Test] @@ -396,7 +396,7 @@ public void EqualsWithObject_SourceIsPresentAndObjectIsOptionalOfSameStructNulla var obj = (object?)Optional.Present(SomeTextStructType); var actual = source.Equals(obj); - Assert.False(actual); + Assert.That(actual, Is.False); } [Test] @@ -408,7 +408,7 @@ public void GetHashCode_SourceIsAbsentAndOtherIsSameAbsent_ExpectSameValues() var sourceHashCode = source.GetHashCode(); var otherHashCode = other.GetHashCode(); - Assert.AreEqual(sourceHashCode, otherHashCode); + Assert.That(otherHashCode, Is.EqualTo(sourceHashCode)); } [Test] @@ -422,7 +422,7 @@ public void GetHashCode_SourceIsPresentAndOtherIsPresentAndValuesAreSame_ExpectS var sourceHashCode = source.GetHashCode(); var otherHashCode = other.GetHashCode(); - Assert.AreEqual(sourceHashCode, otherHashCode); + Assert.That(otherHashCode, Is.EqualTo(sourceHashCode)); } [Test] @@ -434,7 +434,7 @@ public void GetHashCode_SourceIsPresentAndOtherIsPresentAndValuesAreNull_ExpectS var sourceHashCode = source.GetHashCode(); var otherHashCode = other.GetHashCode(); - Assert.AreEqual(sourceHashCode, otherHashCode); + Assert.That(otherHashCode, Is.EqualTo(sourceHashCode)); } [Test] @@ -446,7 +446,7 @@ public void GetHashCode_SourceIsAbsentAndOtherIsPresent_ExpectNotSameValues() var sourceHashCode = source.GetHashCode(); var otherHashCode = other.GetHashCode(); - Assert.AreNotEqual(sourceHashCode, otherHashCode); + Assert.That(otherHashCode, Is.Not.EqualTo(sourceHashCode)); } [Test] @@ -458,7 +458,7 @@ public void GetHashCode_SourceIsPresentAndOtherIsAbsent_ExpectNotSameValues() var sourceHashCode = source.GetHashCode(); var otherHashCode = other.GetHashCode(); - Assert.AreNotEqual(sourceHashCode, otherHashCode); + Assert.That(otherHashCode, Is.Not.EqualTo(sourceHashCode)); } [Test] @@ -470,6 +470,6 @@ public void GetHashCode_SourceIsPresentAndOtherIsPresentAndValuesAreNotSame_Expe var sourceHashCode = source.GetHashCode(); var otherHashCode = other.GetHashCode(); - Assert.AreNotEqual(sourceHashCode, otherHashCode); + Assert.That(otherHashCode, Is.Not.EqualTo(sourceHashCode)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Factory.Absent.Constructor.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Factory.Absent.Constructor.cs index 767402f1..136bab07 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Factory.Absent.Constructor.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Factory.Absent.Constructor.cs @@ -10,13 +10,13 @@ partial class OptionalTest public void Absent_Constructor_ExpectAbsentIsTrue() { var actual = new Optional(); - Assert.True(actual.IsAbsent); + Assert.That(actual.IsAbsent, Is.True); } [Test] public void Absent_Constructor_ExpectPresentIsFalse() { var actual = new Optional(); - Assert.False(actual.IsPresent); + Assert.That(actual.IsPresent, Is.False); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Factory.Absent.Default.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Factory.Absent.Default.cs index cdfadf41..b515dc5e 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Factory.Absent.Default.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Factory.Absent.Default.cs @@ -10,13 +10,13 @@ partial class OptionalTest public void Absent_Default_ExpectAbsentIsTrue() { var actual = default(Optional); - Assert.True(actual.IsAbsent); + Assert.That(actual.IsAbsent, Is.True); } [Test] public void Absent_Default_ExpectPresentIsFalse() { var actual = default(Optional); - Assert.False(actual.IsPresent); + Assert.That(actual.IsPresent, Is.False); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Factory.Absent.Value.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Factory.Absent.Value.cs index df79daaa..1518c939 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Factory.Absent.Value.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Factory.Absent.Value.cs @@ -10,13 +10,13 @@ partial class OptionalTest public void Absent_Value_ExpectAbsentIsTrue() { var actual = Optional.Absent; - Assert.True(actual.IsAbsent); + Assert.That(actual.IsAbsent, Is.True); } [Test] public void Absent_Value_ExpectPresentIsFalse() { var actual = Optional.Absent; - Assert.False(actual.IsPresent); + Assert.That(actual.IsPresent, Is.False); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Factory.Present.Constructor.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Factory.Present.Constructor.cs index b6527607..bc5398a6 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Factory.Present.Constructor.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Factory.Present.Constructor.cs @@ -11,27 +11,27 @@ partial class OptionalTest public void Present_Constructor_SourceIsNull_ExpectPresentIsTrue() { var actual = new Optional(null); - Assert.True(actual.IsPresent); + Assert.That(actual.IsPresent, Is.True); } [Test] public void Present_Constructor_SourceIsNull_ExpectAbsentIsFalse() { var actual = new Optional(null); - Assert.False(actual.IsAbsent); + Assert.That(actual.IsAbsent, Is.False); } [Test] public void Present_Constructor_SourceIsNotNull_ExpectPresentIsTrue() { var actual = new Optional(PlusFifteenIdRefType); - Assert.True(actual.IsPresent); + Assert.That(actual.IsPresent, Is.True); } [Test] public void Present_Constructor_SourceIsNotNull_ExpectAbsentIsFalse() { var actual = new Optional(MinusFifteenIdRefType); - Assert.False(actual.IsAbsent); + Assert.That(actual.IsAbsent, Is.False); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Factory.Present.Explicit.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Factory.Present.Explicit.cs index 81ad7abf..3d9e835d 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Factory.Present.Explicit.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Factory.Present.Explicit.cs @@ -11,27 +11,27 @@ partial class OptionalTest public void Present_Explicit_SourceIsNull_ExpectPresentIsTrue() { var actual = Optional.Present(null); - Assert.True(actual.IsPresent); + Assert.That(actual.IsPresent, Is.True); } [Test] public void Present_Explicit_SourceIsNull_ExpectAbsentIsFalse() { var actual = Optional.Present(null); - Assert.False(actual.IsAbsent); + Assert.That(actual.IsAbsent, Is.False); } [Test] public void Present_Explicit_SourceIsNotNull_ExpectPresentIsTrue() { var actual = Optional.Present(PlusFifteenIdRefType); - Assert.True(actual.IsPresent); + Assert.That(actual.IsPresent, Is.True); } [Test] public void Present_Explicit_SourceIsNotNull_ExpectAbsentIsFalse() { var actual = Optional.Present(MinusFifteenIdRefType); - Assert.False(actual.IsAbsent); + Assert.That(actual.IsAbsent, Is.False); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Factory.Present.Implicit.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Factory.Present.Implicit.cs index 4566aaae..aff1adc4 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Factory.Present.Implicit.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Factory.Present.Implicit.cs @@ -11,27 +11,27 @@ partial class OptionalTest public void Present_Implicit_SourceIsNull_ExpectPresentIsTrue() { Optional actual = null; - Assert.True(actual.IsPresent); + Assert.That(actual.IsPresent, Is.True); } [Test] public void Present_Implicit_SourceIsNull_ExpectAbsentIsFalse() { Optional actual = null; - Assert.False(actual.IsAbsent); + Assert.That(actual.IsAbsent, Is.False); } [Test] public void Present_Implicit_SourceIsNotNull_ExpectPresentIsTrue() { Optional actual = PlusFifteenIdRefType; - Assert.True(actual.IsPresent); + Assert.That(actual.IsPresent, Is.True); } [Test] public void Present_Implicit_SourceIsNotNull_ExpectAbsentIsFalse() { Optional actual = MinusFifteenIdRefType; - Assert.False(actual.IsAbsent); + Assert.That(actual.IsAbsent, Is.False); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Filter.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Filter.cs index 568c55ac..a159515b 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Filter.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Filter.cs @@ -14,7 +14,7 @@ public void Filter_PredicateIsNull_ExpectArgumentNullException() var source = Optional.Present(PlusFifteenIdRefType); var ex = Assert.Throws(Test); - Assert.AreEqual("predicate", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("predicate")); void Test() => @@ -27,7 +27,7 @@ public void Filter_SourceIsAbsent_ExpectAbsent() var source = Optional.Absent; var actual = source.Filter(static _ => true); - Assert.True(actual.IsAbsent); + Assert.That(actual.IsAbsent, Is.True); } [Test] @@ -36,7 +36,7 @@ public void Filter_SourceIsPresentAndPredicateResultIsFalse_ExpectAbsent() var source = Optional.Present(SomeTextStructType); var actual = source.Filter(static _ => false); - Assert.True(actual.IsAbsent); + Assert.That(actual.IsAbsent, Is.True); } [Test] @@ -45,7 +45,7 @@ public void Filter_SourceIsPresentAndPredicateResultIsTrue_ExpectPresent() var source = Optional.Present(ZeroIdRefType); var actual = source.Filter(static _ => true); - Assert.True(actual.IsPresent); + Assert.That(actual.IsPresent, Is.True); } [Test] @@ -54,7 +54,7 @@ public void FilterAsync_PredicateAsyncIsNull_ExpectArgumentNullException() var source = Optional.Present(SomeTextStructType); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("predicateAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("predicateAsync")); async Task TestAsync() => @@ -67,7 +67,7 @@ public async Task FilterAsync_SourceIsAbsent_ExpectAbsent() var source = Optional.Absent; var actual = await source.FilterAsync(static _ => Task.FromResult(true)); - Assert.True(actual.IsAbsent); + Assert.That(actual.IsAbsent, Is.True); } [Test] @@ -76,7 +76,7 @@ public async Task FilterAsync_SourceIsPresentAndPredicateResultIsFalse_ExpectAbs var source = Optional.Present(PlusFifteenIdRefType); var actual = await source.FilterAsync(static _ => Task.FromResult(false)); - Assert.True(actual.IsAbsent); + Assert.That(actual.IsAbsent, Is.True); } [Test] @@ -85,7 +85,7 @@ public async Task FilterAsync_SourceIsPresentAndPredicateResultIsTrue_ExpectPres var source = Optional.Present(null); var actual = await source.FilterAsync(static _ => Task.FromResult(true)); - Assert.True(actual.IsPresent); + Assert.That(actual.IsPresent, Is.True); } [Test] @@ -94,7 +94,7 @@ public void FilterValueAsync_PredicateAsyncIsNull_ExpectArgumentNullException() var source = Optional.Present(null); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("predicateAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("predicateAsync")); async Task TestAsync() => @@ -107,7 +107,7 @@ public async Task FilterValueAsync_SourceIsAbsent_ExpectAbsent() var source = Optional.Absent; var actual = await source.FilterValueAsync(static _ => ValueTask.FromResult(true)); - Assert.True(actual.IsAbsent); + Assert.That(actual.IsAbsent, Is.True); } [Test] @@ -116,7 +116,7 @@ public async Task FilterValueAsync_SourceIsPresentAndPredicateResultIsFalse_Expe var source = Optional.Present(SomeTextStructType); var actual = await source.FilterValueAsync(static _ => ValueTask.FromResult(false)); - Assert.True(actual.IsAbsent); + Assert.That(actual.IsAbsent, Is.True); } [Test] @@ -125,6 +125,6 @@ public async Task FilterValueAsync_SourceIsPresentAndPredicateResultIsTrue_Expec var source = Optional.Present(default); var actual = await source.FilterValueAsync(static _ => ValueTask.FromResult(true)); - Assert.True(actual.IsPresent); + Assert.That(actual.IsPresent, Is.True); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.FlatMap.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.FlatMap.cs index b4ea1235..e3e66baa 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.FlatMap.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.FlatMap.cs @@ -14,7 +14,7 @@ public void FlatMap_MapIsNull_ExpectArgumentNullException() var source = Optional.Present(PlusFifteenIdRefType); var ex = Assert.Throws(Test); - Assert.AreEqual("map", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("map")); void Test() => @@ -28,7 +28,7 @@ public void FlatMap_SourceIsAbsent_ExpectAbsent() var result = Optional.Present(PlusFifteenIdRefType); var actual = source.FlatMap(_ => result); - Assert.True(actual.IsAbsent); + Assert.That(actual.IsAbsent, Is.True); } [Test] @@ -41,7 +41,7 @@ public void FlatMap_SourceIsPresent_ExpectResultValue( var result = isResultPresent ? Optional.Present(PlusFifteenIdRefType) : Optional.Absent; var actual = source.FlatMap(_ => result); - Assert.AreEqual(result, actual); + Assert.That(actual, Is.EqualTo(result)); } [Test] @@ -50,7 +50,7 @@ public void FlatMapAsync_MapAsyncIsNull_ExpectArgumentNullException() var source = Optional.Present(SomeTextStructType); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("mapAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("mapAsync")); async Task TestAsync() => @@ -64,7 +64,7 @@ public async Task FlatMapAsync_SourceIsAbsent_ExpectAbsent() var result = Optional.Present(PlusFifteenIdRefType); var actual = await source.FlatMapAsync(_ => Task.FromResult(result)); - Assert.True(actual.IsAbsent); + Assert.That(actual.IsAbsent, Is.True); } [Test] @@ -77,7 +77,7 @@ public async Task FlatMapAsync_SourceIsPresent_ExpectResultValue( var result = isResultPresent ? Optional.Present(SomeTextStructType) : Optional.Absent; var actual = await source.FlatMapAsync(_ => Task.FromResult(result)); - Assert.AreEqual(result, actual); + Assert.That(actual, Is.EqualTo(result)); } [Test] @@ -86,7 +86,7 @@ public void FlatMapValueAsync_MapAsyncIsNull_ExpectArgumentNullException() var source = Optional.Present(PlusFifteenIdRefType); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("mapAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("mapAsync")); async Task TestAsync() => @@ -100,7 +100,7 @@ public async Task FlatMapValueAsync_SourceIsAbsent_ExpectAbsent() var result = Optional.Present(SomeTextStructType); var actual = await source.FlatMapValueAsync(_ => ValueTask.FromResult(result)); - Assert.True(actual.IsAbsent); + Assert.That(actual.IsAbsent, Is.True); } [Test] @@ -113,6 +113,6 @@ public async Task FlatMapValueAsync_SourceIsPresent_ExpectResultValue( var result = isResultPresent ? Optional.Present(MinusFifteenIdRefType) : Optional.Absent; var actual = await source.FlatMapValueAsync(_ => ValueTask.FromResult(result)); - Assert.AreEqual(result, actual); + Assert.That(actual, Is.EqualTo(result)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Fold.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Fold.cs index 31f63a07..b4d19386 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Fold.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Fold.cs @@ -14,7 +14,7 @@ public void Fold_MapIsNull_ExpectArgumentNullException() var source = Optional.Present(SomeTextStructType); var ex = Assert.Throws(() => _ = source.Fold(null!, () => PlusFifteenIdRefType)); - Assert.AreEqual("map", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("map")); } [Test] @@ -23,7 +23,7 @@ public void Fold_OtherFactoryIsNull_ExpectArgumentNullException() var source = Optional.Present(SomeTextStructType); var ex = Assert.Throws(() => _ = source.Fold(_ => PlusFifteenIdRefType, null!)); - Assert.AreEqual("otherFactory", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("otherFactory")); } [Test] @@ -35,7 +35,7 @@ public void Fold_SourceIsPresent_ExpectMappedResult() var other = MinusFifteenIdRefType; var actual = source.Fold(_ => mapped, () => other); - Assert.AreSame(mapped, actual); + Assert.That(actual, Is.SameAs(mapped)); } [Test] @@ -47,7 +47,7 @@ public void Fold_SourceIsAbsent_ExpectOtherResult() var other = SomeTextStructType; var actual = source.Fold(_ => mapped, () => other); - Assert.AreEqual(mapped, actual); + Assert.That(actual, Is.EqualTo(mapped)); } [Test] @@ -58,7 +58,7 @@ public void FoldAsync_MapAsyncIsNull_ExpectArgumentNullException() var ex = Assert.ThrowsAsync( async () => _ = await source.FoldAsync(null!, () => Task.FromResult(MinusFifteenIdRefType))); - Assert.AreEqual("mapAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("mapAsync")); } [Test] @@ -69,7 +69,7 @@ public void FoldAsync_OtherFactoryAsyncIsNull_ExpectArgumentNullException() var ex = Assert.ThrowsAsync( async () => _ = await source.FoldAsync(_ => Task.FromResult(int.MaxValue), null!)); - Assert.AreEqual("otherFactoryAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("otherFactoryAsync")); } [Test] @@ -81,7 +81,7 @@ public async Task FoldAsync_SourceIsPresent_ExpectMappedResult() var other = SomeTextStructType; var actual = await source.FoldAsync(_ => Task.FromResult(mapped), () => Task.FromResult(other)); - Assert.AreEqual(mapped, actual); + Assert.That(actual, Is.EqualTo(mapped)); } [Test] @@ -93,7 +93,7 @@ public async Task FoldAsync_SourceIsAbsent_ExpectOtherResult() var other = SomeString; var actual = await source.FoldAsync(_ => Task.FromResult(mapped), () => Task.FromResult(other)); - Assert.AreEqual(mapped, actual); + Assert.That(actual, Is.SameAs(mapped)); } [Test] @@ -104,7 +104,7 @@ public void FoldValueAsync_MapAsyncIsNull_ExpectArgumentNullException() var ex = Assert.ThrowsAsync( async () => _ = await source.FoldValueAsync(null!, () => ValueTask.FromResult(MinusFifteenIdRefType))); - Assert.AreEqual("mapAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("mapAsync")); } [Test] @@ -115,7 +115,7 @@ public void FoldValueAsync_OtherFactoryAsyncIsNull_ExpectArgumentNullException() var ex = Assert.ThrowsAsync( async () => _ = await source.FoldValueAsync(_ => ValueTask.FromResult(int.MaxValue), null!)); - Assert.AreEqual("otherFactoryAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("otherFactoryAsync")); } [Test] @@ -127,7 +127,7 @@ public async Task FoldValueAsync_SourceIsPresent_ExpectMappedResult() var other = MinusFifteenIdRefType; var actual = await source.FoldValueAsync(_ => ValueTask.FromResult(mapped), () => ValueTask.FromResult(other)); - Assert.AreEqual(mapped, actual); + Assert.That(actual, Is.SameAs(mapped)); } [Test] @@ -139,6 +139,6 @@ public async Task FoldValueAsync_SourceIsAbsent_ExpectOtherResult() var other = MinusFifteenIdRefType; var actual = await source.FoldValueAsync(_ => ValueTask.FromResult(mapped), () => ValueTask.FromResult(other)); - Assert.AreEqual(mapped, actual); + Assert.That(actual, Is.SameAs(mapped)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Map.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Map.cs index 1664e211..ec74433c 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Map.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Map.cs @@ -14,7 +14,7 @@ public void Map_MapIsNull_ExpectArgumentNullException() var source = Optional.Present(SomeTextStructType); var ex = Assert.Throws(() => _ = source.Map(null!)); - Assert.AreEqual("map", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("map")); } [Test] @@ -27,7 +27,7 @@ public void Map_SourceIsPresent_ExpectMappedPresentValue( var actual = source.Map(_ => mapped); var expected = Optional.Present(mapped); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -39,7 +39,7 @@ public void Map_SourceIsAbsent_ExpectAbsent() var actual = source.Map(_ => mapped); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -50,7 +50,7 @@ public void MapAsync_MapAsyncIsNull_ExpectArgumentNullException() var ex = Assert.ThrowsAsync( async () => _ = await source.MapAsync(null!)); - Assert.AreEqual("mapAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("mapAsync")); } [Test] @@ -62,7 +62,7 @@ public async Task MapAsync_SourceIsPresent_ExpectMappedPresentResult() var actual = await source.MapAsync(_ => Task.FromResult(mapped)); var expected = Optional.Present(mapped); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -74,7 +74,7 @@ public async Task MapAsync_SourceIsAbsent_ExpectAbsent() var actual = await source.MapAsync(_ => Task.FromResult(mapped)); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -83,7 +83,7 @@ public void MapValueAsync_MapAsyncIsNull_ExpectArgumentNullException() var source = Optional.Present(SomeTextStructType); var ex = Assert.ThrowsAsync(async () => _ = await source.MapValueAsync(null!)); - Assert.AreEqual("mapAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("mapAsync")); } [Test] @@ -95,7 +95,7 @@ public async Task MapValueAsync_SourceIsPresent_ExpectMappedPresentResult() var actual = await source.MapValueAsync(_ => ValueTask.FromResult(mapped)); var expected = Optional.Present(mapped); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -107,6 +107,6 @@ public async Task MapValueAsync_SourceIsAbsent_ExpectAbsent() var actual = await source.MapValueAsync(_ => ValueTask.FromResult(mapped)); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.On.TUnit.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.On.TUnit.cs index 87facd8c..def3e8c7 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.On.TUnit.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.On.TUnit.cs @@ -15,7 +15,7 @@ public void On_TUnit_OnPresentIsNull_ExpectArgumentNullException() var source = Optional.Present(SomeString); var ex = Assert.Throws(Test); - Assert.AreEqual("onPresent", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("onPresent")); void Test() => @@ -32,7 +32,7 @@ public void On_TUnit_OnElseIsNull_ExpectArgumentNullException() var source = Optional.Present(decimal.One); var ex = Assert.Throws(Test); - Assert.AreEqual("onElse", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("onElse")); void Test() => @@ -74,7 +74,7 @@ public void On_TUnit_ExpectSource(bool isPresent) var source = isPresent ? new(SomeTextStructType) : Optional.Absent; var actual = source.On(OnPresent, OnElse); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); static string OnPresent(StructType _) => @@ -91,7 +91,7 @@ public void OnAsync_TUnit_OnPresentAsyncIsNull_ExpectArgumentNullException() var source = Optional.Present(One); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("onPresentAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("onPresentAsync")); async Task TestAsync() => @@ -108,7 +108,7 @@ public void OnAsync_TUnit_OnElseAsyncIsNull_ExpectArgumentNullException() var source = Optional.Present(ZeroIdRefType); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("onElseAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("onElseAsync")); async Task TestAsync() => @@ -150,7 +150,7 @@ public async Task OnAsync_TUnit_ExpectSource(bool isPresent) var source = isPresent ? new(int.MinValue) : Optional.Absent(); var actual = await source.OnAsync(OnPresentAsync, OnElseAsync); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); static Task OnPresentAsync(int _) => @@ -167,7 +167,7 @@ public void OnValueAsync_TUnit_OnPresentAsyncIsNull_ExpectArgumentNullException( var source = Optional.Present(MinusFifteenIdRefType); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("onPresentAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("onPresentAsync")); async Task TestAsync() => @@ -184,7 +184,7 @@ public void OnValueAsync_TUnit_OnElseAsyncIsNull_ExpectArgumentNullException() var source = Optional.Present(SomeTextRecordStruct); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("onElseAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("onElseAsync")); async Task TestAsync() => @@ -226,7 +226,7 @@ public async Task OnValueAsync_TUnit_ExpectSource(bool isPresent) var source = isPresent ? new(PlusFifteen) : Optional.Absent(); var actual = await source.OnValueAsync(OnPresentAsync, OnElseAsync); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); static ValueTask OnPresentAsync(int _) => diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.On.Unit.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.On.Unit.cs index c42def61..18db6010 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.On.Unit.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.On.Unit.cs @@ -15,7 +15,7 @@ public void On_Unit_OnPresentIsNull_ExpectArgumentNullException() var source = Optional.Present(LowerSomeTextStructType); var ex = Assert.Throws(Test); - Assert.AreEqual("onPresent", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("onPresent")); void Test() => @@ -32,7 +32,7 @@ public void On_Unit_OnElseIsNull_ExpectArgumentNullException() var source = Optional.Present(UpperAnotherString); var ex = Assert.Throws(Test); - Assert.AreEqual("onElse", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("onElse")); void Test() => @@ -74,7 +74,7 @@ public void On_Unit_ExpectSource(bool isPresent) var source = isPresent ? new(PlusFifteenIdRefType) : Optional.Absent; var actual = source.On(OnPresent, OnElse); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); static Unit OnPresent(RefType? _) => @@ -91,7 +91,7 @@ public void OnAsync_Unit_OnPresentAsyncIsNull_ExpectArgumentNullException() var source = Optional.Present(MinusFifteenIdSomeStringNameRecord); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("onPresentAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("onPresentAsync")); async Task TestAsync() => @@ -108,7 +108,7 @@ public void OnAsync_Unit_OnElseAsyncIsNull_ExpectArgumentNullException() var source = Optional.Present(SomeTextStructType); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("onElseAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("onElseAsync")); async Task TestAsync() => @@ -150,7 +150,7 @@ public async Task OnAsync_Unit_ExpectSource(bool isPresent) var source = isPresent ? new(MinusFifteenIdNullNameRecord) : Optional.Absent(); var actual = await source.OnAsync(OnPresentAsync, OnElseAsync); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); static Task OnPresentAsync(RecordType _) => @@ -167,7 +167,7 @@ public void OnValueAsync_Unit_OnPresentAsyncIsNull_ExpectArgumentNullException() var source = Optional.Present(long.MinValue); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("onPresentAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("onPresentAsync")); async Task TestAsync() => @@ -184,7 +184,7 @@ public void OnValueAsync_Unit_OnElseAsyncIsNull_ExpectArgumentNullException() var source = Optional.Present(LowerSomeString); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("onElseAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("onElseAsync")); async Task TestAsync() => @@ -226,7 +226,7 @@ public async Task OnValueAsync_Unit_ExpectSource(bool isPresent) var source = isPresent ? new(SomeString) : Optional.Absent(); var actual = await source.OnValueAsync(OnPresentAsync, OnElseAsync); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); static ValueTask OnPresentAsync(string _) => diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.On.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.On.cs index 4ead5123..b5bf9403 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.On.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.On.cs @@ -15,7 +15,7 @@ public void On_OnPresentIsNull_ExpectArgumentNullException() var source = Optional.Present(SomeTextRecordStruct); var ex = Assert.Throws(Test); - Assert.AreEqual("onPresent", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("onPresent")); void Test() => @@ -32,7 +32,7 @@ public void On_OnElseIsNull_ExpectArgumentNullException() var source = Optional.Present(PlusFifteenIdRefType); var ex = Assert.Throws(Test); - Assert.AreEqual("onElse", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("onElse")); void Test() => @@ -74,7 +74,7 @@ public void On_ExpectSource(bool isPresent) var source = isPresent ? new(PlusFifteenIdSomeStringNameRecord) : Optional.Absent; var actual = source.On(OnPresent, OnElse); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); static void OnPresent(RecordType? _) { @@ -91,7 +91,7 @@ public void OnAsync_OnPresentAsyncIsNull_ExpectArgumentNullException() var source = Optional.Present(MinusFifteenIdRefType); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("onPresentAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("onPresentAsync")); async Task TestAsync() => @@ -108,7 +108,7 @@ public void OnAsync_OnElseAsyncIsNull_ExpectArgumentNullException() var source = Optional.Present(long.MaxValue); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("onElseAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("onElseAsync")); async Task TestAsync() => @@ -150,7 +150,7 @@ public async Task OnAsync_ExpectSource(bool isPresent) var source = isPresent ? new(SomeTextStructType) : Optional.Absent(); var actual = await source.OnAsync(OnPresentAsync, OnElseAsync); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); static Task OnPresentAsync(StructType _) => @@ -167,7 +167,7 @@ public void OnValueAsync_OnPresentAsyncIsNull_ExpectArgumentNullException() var source = Optional.Present(LowerSomeString); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("onPresentAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("onPresentAsync")); async Task TestAsync() => @@ -184,7 +184,7 @@ public void OnValueAsync_OnElseAsyncIsNull_ExpectArgumentNullException() var source = Optional.Present(ZeroIdRefType); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("onElseAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("onElseAsync")); async Task TestAsync() => @@ -226,7 +226,7 @@ public async Task OnValueAsync_ExpectSource(bool isPresent) var source = isPresent ? new(MinusFifteenIdSomeStringNameRecord) : Optional.Absent(); var actual = await source.OnValueAsync(OnPresentAsync, OnElseAsync); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); static ValueTask OnPresentAsync(RecordType? _) => diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OnAbsent.TUnit.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OnAbsent.TUnit.cs index d9cb1506..77932886 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OnAbsent.TUnit.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OnAbsent.TUnit.cs @@ -15,7 +15,7 @@ public void OnAbsent_TUnit_HandlerIsNull_ExpectArgumentNullException() var source = Optional.Present(PlusFifteenIdRefType); var ex = Assert.Throws(Test); - Assert.AreEqual("handler", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("handler")); void Test() => @@ -53,7 +53,7 @@ public void OnAbsent_TUnit_ExpectSource(bool isPresent) var source = isPresent ? new(decimal.One) : Optional.Absent; var actual = source.OnAbsent(OnAbsent); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); static string? OnAbsent() => @@ -66,7 +66,7 @@ public void OnAbsentAsync_TUnit_HandlerAsyncIsNull_ExpectArgumentNullException() var source = Optional.Present(MinusFifteenIdRefType); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("handlerAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("handlerAsync")); async Task TestAsync() => @@ -104,7 +104,7 @@ public async Task OnAbsentAsync_TUnit_ExpectSource(bool isPresent) var source = isPresent ? new(ZeroIdRefType) : Optional.Absent(); var actual = await source.OnAbsentAsync(OnAbsentAsync); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); static Task OnAbsentAsync() => @@ -117,7 +117,7 @@ public void OnAbsentValueAsync_TUnit_HandlerAsyncIsNull_ExpectArgumentNullExcept var source = Optional.Present(decimal.MinusOne); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("handlerAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("handlerAsync")); async Task TestAsync() => @@ -155,7 +155,7 @@ public async Task OnAbsentValueAsync_TUnit_ExpectSource(bool isPresent) var source = isPresent ? new(new object()) : Optional.Absent(); var actual = await source.OnAbsentValueAsync(OnAbsentAsync); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); static ValueTask OnAbsentAsync() => diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OnAbsent.Unit.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OnAbsent.Unit.cs index 77fcb4df..7e713b42 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OnAbsent.Unit.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OnAbsent.Unit.cs @@ -17,7 +17,7 @@ public void OnAbsent_Unit_HandlerIsNull_ExpectArgumentNullException() var source = Optional.Present(LowerSomeTextStructType); var ex = Assert.Throws(Test); - Assert.AreEqual("handler", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("handler")); void Test() => @@ -55,7 +55,7 @@ public void OnAbsent_Unit_ExpectSource(bool isPresent) var source = isPresent ? new(PlusFifteenIdRefType) : Optional.Absent; var actual = source.OnAbsent(OnAbsent); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); static Unit OnAbsent() => @@ -70,7 +70,7 @@ public void OnAbsentAsync_Unit_HandlerAsyncIsNull_ExpectArgumentNullException() var source = Optional.Present(SomeTextRecordStruct); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("handlerAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("handlerAsync")); async Task TestAsync() => @@ -108,7 +108,7 @@ public async Task OnAbsentAsync_Unit_ExpectSource(bool isPresent) var source = isPresent ? new(MinusFifteenIdSomeStringNameRecord) : Optional.Absent(); var actual = await source.OnAbsentAsync(OnAbsentAsync); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); static Task OnAbsentAsync() => @@ -123,7 +123,7 @@ public void OnAbsentValueAsync_Unit_HandlerAsyncIsNull_ExpectArgumentNullExcepti var source = Optional.Present(PlusFifteenIdRefType); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("handlerAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("handlerAsync")); async Task TestAsync() => @@ -161,7 +161,7 @@ public async Task OnAbsentValueAsync_Unit_ExpectSource(bool isPresent) var source = isPresent ? new(SomeTextStructType) : Optional.Absent(); var actual = await source.OnAbsentValueAsync(OnAbsentAsync); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); static ValueTask OnAbsentAsync() => diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OnAbsent.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OnAbsent.cs index 5f64ed43..d44647d2 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OnAbsent.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OnAbsent.cs @@ -17,7 +17,7 @@ public void OnAbsent_HandlerIsNull_ExpectArgumentNullException() var source = Optional.Present(MinusOne); var ex = Assert.Throws(Test); - Assert.AreEqual("handler", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("handler")); void Test() => @@ -55,7 +55,7 @@ public void OnAbsent_ExpectSource(bool isPresent) var source = isPresent ? new(SomeString) : Optional.Absent; var actual = source.OnAbsent(OnAbsent); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); static void OnAbsent() { @@ -70,7 +70,7 @@ public void OnAbsentAsync_HandlerAsyncIsNull_ExpectArgumentNullException() var source = Optional.Present(LowerSomeTextStructType); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("handlerAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("handlerAsync")); async Task TestAsync() => @@ -108,7 +108,7 @@ public async Task OnAbsentAsync_ExpectSource(bool isPresent) var source = isPresent ? new(MinusFifteenIdNullNameRecord) : Optional.Absent(); var actual = await source.OnAbsentAsync(OnAbsentAsync); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); static Task OnAbsentAsync() => @@ -123,7 +123,7 @@ public void OnAbsentValueAsync_HandlerAsyncIsNull_ExpectArgumentNullException() var source = Optional.Present(SomeTextRecordStruct); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("handlerAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("handlerAsync")); async Task TestAsync() => @@ -161,7 +161,7 @@ public async Task OnAbsentValueAsync_ExpectSource(bool isPresent) var source = isPresent ? new(decimal.One) : Optional.Absent(); var actual = await source.OnAbsentValueAsync(OnAbsentAsync); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); static ValueTask OnAbsentAsync() => diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OnPresent.TUnit.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OnPresent.TUnit.cs index ed21bb5d..85325afc 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OnPresent.TUnit.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OnPresent.TUnit.cs @@ -15,7 +15,7 @@ public void OnPresent_TUnit_HandlerIsNull_ExpectArgumentNullException() var source = Optional.Present(One); var ex = Assert.Throws(Test); - Assert.AreEqual("handler", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("handler")); void Test() => @@ -43,7 +43,7 @@ public void OnPresent_TUnit_ExpectSource(bool isPresent) var source = isPresent ? new(MinusFifteenIdRefType) : Optional.Absent; var actual = source.OnPresent(OnPresent); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); static decimal OnPresent(RefType _) => @@ -56,7 +56,7 @@ public void OnPresentAsync_TUnit_HandlerAsyncIsNull_ExpectArgumentNullException( var source = Optional.Present(MinusFifteenIdSomeStringNameRecord); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("handlerAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("handlerAsync")); async Task TestAsync() => @@ -84,7 +84,7 @@ public async Task OnPresentAsync_TUnit_ExpectSource(bool isPresent) var source = isPresent ? new(MinusFifteenIdNullNameRecord) : Optional.Absent(); var actual = await source.OnPresentAsync(OnPresentAsync); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); static Task OnPresentAsync(RecordType? _) => @@ -97,7 +97,7 @@ public void OnPresentValueAsync_TUnit_HandlerAsyncIsNull_ExpectArgumentNullExcep var source = Optional.Present(SomeString); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("handlerAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("handlerAsync")); async Task TestAsync() => @@ -125,7 +125,7 @@ public async Task OnPresentValueAsync_TUnit_ExpectSource(bool isPresent) var source = isPresent ? new(SomeTextRecordStruct) : Optional.Absent(); var actual = await source.OnPresentValueAsync(OnPresentAsync); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); static ValueTask OnPresentAsync(RecordStruct _) => diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OnPresent.Unit.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OnPresent.Unit.cs index 5e493887..87b1df00 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OnPresent.Unit.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OnPresent.Unit.cs @@ -17,7 +17,7 @@ public void OnPresent_Unit_HandlerIsNull_ExpectArgumentNullException() var source = Optional.Present(PlusFifteenIdRefType); var ex = Assert.Throws(Test); - Assert.AreEqual("handler", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("handler")); void Test() => @@ -45,7 +45,7 @@ public void OnPresent_Unit_ExpectSource(bool isPresent) var source = isPresent ? new(PlusFifteenIdSomeStringNameRecord) : Optional.Absent; var actual = source.OnPresent(OnPresent); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); static Unit OnPresent(RecordType _) => @@ -60,7 +60,7 @@ public void OnPresentAsync_Unit_HandlerAsyncIsNull_ExpectArgumentNullException() var source = Optional.Present(decimal.MinusOne); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("handlerAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("handlerAsync")); async Task TestAsync() => @@ -88,7 +88,7 @@ public async Task OnPresentAsync_Unit_ExpectSource(bool isPresent) var source = isPresent ? new(SomeTextRecordStruct) : Optional.Absent(); var actual = await source.OnPresentAsync(OnPresentAsync); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); static Task OnPresentAsync(RecordStruct _) => @@ -103,7 +103,7 @@ public void OnPresentValueAsync_Unit_HandlerAsyncIsNull_ExpectArgumentNullExcept var source = Optional.Present(MinusFifteen); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("handlerAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("handlerAsync")); async Task TestAsync() => @@ -131,7 +131,7 @@ public async Task OnPresentValueAsync_Unit_ExpectSource(bool isPresent) var source = isPresent ? new(PlusFifteenIdRefType) : Optional.Absent(); var actual = await source.OnPresentValueAsync(OnPresentAsync); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); static ValueTask OnPresentAsync(RefType? _) => diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OnPresent.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OnPresent.cs index 0cc27c2c..aaae7cb7 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OnPresent.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OnPresent.cs @@ -17,7 +17,7 @@ public void OnPresent_HandlerIsNull_ExpectArgumentNullException() var source = Optional.Present(SomeTextRecordStruct); var ex = Assert.Throws(Test); - Assert.AreEqual("handler", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("handler")); void Test() => @@ -45,7 +45,7 @@ public void OnPresent_ExpectSource(bool isPresent) var source = isPresent ? new(SomeTextStructType) : Optional.Absent; var actual = source.OnPresent(OnPresent); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); static void OnPresent(StructType _) { @@ -60,7 +60,7 @@ public void OnPresentAsync_HandlerAsyncIsNull_ExpectArgumentNullException() var source = Optional.Present(long.MaxValue); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("handlerAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("handlerAsync")); async Task TestAsync() => @@ -88,7 +88,7 @@ public async Task OnPresentAsync_ExpectSource(bool isPresent) var source = isPresent ? new(SomeTextRecordStruct) : Optional.Absent(); var actual = await source.OnPresentAsync(OnPresentAsync); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); static Task OnPresentAsync(RecordStruct? _) => @@ -103,7 +103,7 @@ public void OnPresentValueAsync_HandlerAsyncIsNull_ExpectArgumentNullException() var source = Optional.Present(MinusOne); var ex = Assert.ThrowsAsync(TestAsync); - Assert.AreEqual("handlerAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("handlerAsync")); async Task TestAsync() => @@ -131,7 +131,7 @@ public async Task OnPresentValueAsync_ExpectSource(bool isPresent) var source = isPresent ? new(ZeroIdRefType) : Optional.Absent(); var actual = await source.OnPresentValueAsync(OnPresentAsync); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); static ValueTask OnPresentAsync(RefType _) => diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Or.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Or.cs index cf6be528..3f7f78e0 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Or.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.Or.cs @@ -14,7 +14,7 @@ public void Or_OtherFactoryIsNull_ExpectArgumentNullException() var source = Optional.Present(SomeTextStructType); var ex = Assert.Throws(() => _ = source.Or(null!)); - Assert.AreEqual("otherFactory", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("otherFactory")); } [Test] @@ -26,7 +26,7 @@ public void Or_SourceIsPresent_ExpectSourceValue( var other = Optional.Absent; var actual = source.Or(() => other); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); } [Test] @@ -39,7 +39,7 @@ public void Or_SourceIsAbsent_ExpectOtherValue( var other = isOtherPresent ? Optional.Present(MinusFifteenIdRefType) : default; var actual = source.Or(() => other); - Assert.AreEqual(other, actual); + Assert.That(actual, Is.EqualTo(other)); } [Test] @@ -48,7 +48,7 @@ public void OrAsync_OtherFactoryAsyncIsNull_ExpectArgumentNullException() var source = Optional.Present(SomeTextStructType); var ex = Assert.ThrowsAsync(async () => _ = await source.OrAsync(null!)); - Assert.AreEqual("otherFactoryAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("otherFactoryAsync")); } [Test] @@ -60,7 +60,7 @@ public async Task OrAsync_SourceIsPresent_ExpectSourceValue( var other = Optional.Absent; var actual = await source.OrAsync(() => Task.FromResult(other)); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); } [Test] @@ -73,7 +73,7 @@ public async Task OrAsync_SourceIsAbsent_ExpectOtherValue( var other = isOtherPresent ? Optional.Present(MinusFifteenIdRefType) : default; var actual = await source.OrAsync(() => Task.FromResult(other)); - Assert.AreEqual(other, actual); + Assert.That(actual, Is.EqualTo(other)); } [Test] @@ -82,7 +82,7 @@ public void OrValueAsync_OtherFactoryAsyncIsNull_ExpectArgumentNullException() var source = Optional.Present(SomeTextStructType); var ex = Assert.ThrowsAsync(async () => _ = await source.OrValueAsync(null!)); - Assert.AreEqual("otherFactoryAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("otherFactoryAsync")); } [Test] @@ -94,7 +94,7 @@ public async Task OrValueAsync_SourceIsPresent_ExpectSourceValue( var other = Optional.Absent; var actual = await source.OrValueAsync(() => ValueTask.FromResult(other)); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); } [Test] @@ -107,6 +107,6 @@ public async Task OrValueAsync_SourceIsAbsent_ExpectOtherValue( var other = isOtherPresent ? Optional.Present(SomeString) : Optional.Absent; var actual = await source.OrValueAsync(() => ValueTask.FromResult(other)); - Assert.AreEqual(other, actual); + Assert.That(actual, Is.EqualTo(other)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OrDefault.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OrDefault.cs index 1ffcfa2c..a08e58c5 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OrDefault.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OrDefault.cs @@ -14,7 +14,7 @@ public void OrDefault_SourceIsPresent_ExpectSourceValue( var source = Optional.Present(sourceValue); var actual = source.OrDefault(); - Assert.AreEqual(sourceValue, actual); + Assert.That(actual, Is.SameAs(sourceValue)); } [Test] @@ -23,7 +23,7 @@ public void OrDefault_SourceIsStructTypeAbsent_ExpectDefaultStructValue() var source = Optional.Absent; var actual = source.OrDefault(); - Assert.AreEqual(default(StructType), actual); + Assert.That(actual, Is.EqualTo(default(StructType))); } [Test] @@ -32,6 +32,6 @@ public void OrDefault_SourceIsRefTypeAbsent_ExpectNull() var source = Optional.Absent; var actual = source.OrDefault(); - Assert.Null(actual); + Assert.That(actual, Is.Null); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OrElse.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OrElse.cs index 69949279..81ede573 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OrElse.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OrElse.cs @@ -20,7 +20,7 @@ public void OrElse_SourceIsPresent_ExpectSourceValue( var source = Optional.Present(sourceValue); var actual = source.OrElse(otherValue); - Assert.AreSame(sourceValue, actual); + Assert.That(actual, Is.SameAs(sourceValue)); } [Test] @@ -34,7 +34,7 @@ public void OrElse_SourceIsAbsent_ExpectOtherValue( var source = Optional.Absent; var actual = source.OrElse(otherValue); - Assert.AreEqual(otherValue, actual); + Assert.That(actual, Is.EqualTo(otherValue)); } [Test] @@ -44,7 +44,7 @@ public void OrElseWithFactory_OtherFactoryIsNull_ExpectArgumentNullExcepton() Func otherFactory = null!; var ex = Assert.Throws(() => _ = source.OrElse(otherFactory)); - Assert.AreEqual("otherFactory", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("otherFactory")); } [Test] @@ -59,7 +59,7 @@ public void OrElseWithFactory_SourceIsPresent_ExpectSourceValue( var source = Optional.Present(sourceValue); var actual = source.OrElse(() => otherValue); - Assert.AreSame(sourceValue, actual); + Assert.That(actual, Is.SameAs(sourceValue)); } [Test] @@ -73,7 +73,7 @@ public void OrElseWithFactory_SourceIsAbsent_ExpectOtherValue( var source = Optional.Absent; var actual = source.OrElse(() => otherValue); - Assert.AreEqual(otherValue, actual); + Assert.That(actual, Is.EqualTo(otherValue)); } [Test] @@ -82,7 +82,7 @@ public void OrElseAsync_OtherFactoryAsyncIsNull_ExpectArgumentNullExcepton() var source = Optional.Present(PlusFifteen); var ex = Assert.ThrowsAsync(async () => _ = await source.OrElseAsync(null!)); - Assert.AreEqual("otherFactoryAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("otherFactoryAsync")); } [Test] @@ -97,7 +97,7 @@ public async Task OrElseAsync_SourceIsPresent_ExpectSourceValue( var source = Optional.Present(sourceValue); var actual = await source.OrElseAsync(() => Task.FromResult(otherValue)); - Assert.AreSame(sourceValue, actual); + Assert.That(actual, Is.SameAs(sourceValue)); } [Test] @@ -111,7 +111,7 @@ public async Task OrElseAsync_SourceIsAbsent_ExpectOtherValue( var source = Optional.Absent; var actual = await source.OrElseAsync(() => Task.FromResult(otherValue)); - Assert.AreEqual(otherValue, actual); + Assert.That(actual, Is.EqualTo(otherValue)); } [Test] @@ -120,7 +120,7 @@ public void OrElseValueAsync_OtherFactoryAsyncIsNull_ExpectArgumentNullExcepton( var source = Optional.Present(PlusFifteen); var ex = Assert.ThrowsAsync(async () => _ = await source.OrElseValueAsync(null!)); - Assert.AreEqual("otherFactoryAsync", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("otherFactoryAsync")); } [Test] @@ -135,7 +135,7 @@ public async Task OrElseValueAsync_SourceIsPresent_ExpectSourceValue( var source = Optional.Present(sourceValue); var actual = await source.OrElseValueAsync(() => ValueTask.FromResult(otherValue)); - Assert.AreSame(sourceValue, actual); + Assert.That(actual, Is.SameAs(sourceValue)); } [Test] @@ -149,6 +149,6 @@ public async Task OrElseValueAsync_SourceIsAbsent_ExpectOtherValue( var source = Optional.Absent; var actual = await source.OrElseValueAsync(() => ValueTask.FromResult(otherValue)); - Assert.AreEqual(otherValue, actual); + Assert.That(actual, Is.EqualTo(otherValue)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OrThrow.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OrThrow.cs index ac3ff91f..8beb9db9 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OrThrow.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.OrThrow.cs @@ -15,7 +15,7 @@ public void OrThrow_SourceIsPresent_ExpectSourceValue( var source = Optional.Present(sourceValue); var actual = source.OrThrow(); - Assert.AreEqual(sourceValue, actual); + Assert.That(actual, Is.SameAs(sourceValue)); } [Test] @@ -31,7 +31,7 @@ public void OrThrowWithFactory_ExceptionFactoryIsNull_ExpectArgumentNullExceptio var source = Optional.Present(SomeTextStructType); var ex = Assert.Throws(() => _ = source.OrThrow(null!)); - Assert.AreEqual("exceptionFactory", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("exceptionFactory")); } [Test] @@ -42,7 +42,7 @@ public void OrThrowWithFactory_SourceIsPresent_ExpectSourceValue( var source = Optional.Present(sourceValue); var actual = source.OrThrow(() => new SomeException()); - Assert.AreEqual(sourceValue, actual); + Assert.That(actual, Is.SameAs(sourceValue)); } [Test] @@ -52,6 +52,6 @@ public void OrThrowWithFactory_SourceIsAbsent_ExpectFactoryResultException() var resultException = new SomeException(); var actualException = Assert.Throws(() => _ = source.OrThrow(() => resultException)); - Assert.AreSame(resultException, actualException); + Assert.That(actualException, Is.SameAs(resultException)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.ToString.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.ToString.cs index eea208d5..89a3ecdb 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.ToString.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.ToString.cs @@ -20,7 +20,7 @@ public void ToString_SourceIsAbsent() "Optional<{0}>:Absent:()", typeof(StubType).Name); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -36,7 +36,7 @@ public void ToString_SourceIsPresentAndValueIsNull() typeof(StubType).Name, string.Empty); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -53,7 +53,7 @@ public void ToString_SourceIsPresentAndValueToStringIsNull() typeof(StubType).Name, string.Empty); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -80,7 +80,7 @@ public void ToString_SourceIsPresent_ValueToString_Common( typeof(StubType).Name, sourceValueToStringResult); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -109,7 +109,7 @@ public void ToString_SourceIsPresent_Common( typeof(object).Name, sourceValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -127,7 +127,7 @@ public void ToString_SourceIsPresent_DecimalPoint( typeof(decimal).Name, expectedDecimalSubstr); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } private static IEnumerable ToString_SourceIsPresent_DecimalPoint_TestCaseSource() diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.YieldFlattened.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.YieldFlattened.cs index 42d99d3c..6c69369f 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.YieldFlattened.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.YieldFlattened.cs @@ -15,10 +15,10 @@ public void YieldFlattened_SourceIsPresent_ExpectSingleValue( var source = Optional.Present(sourceValue); var actual = source.YieldFlattened(); - Assert.AreEqual(1, actual.Count()); + Assert.That(actual.Count(), Is.EqualTo(1)); + var actualValue = actual.Single(); - - Assert.AreEqual(sourceValue, actualValue); + Assert.That(actualValue, Is.SameAs(sourceValue)); } [Test] @@ -27,6 +27,6 @@ public void YieldFlattened_SourceIsAbsent_ExpectEmpty() var source = Optional.Absent; var actual = source.YieldFlattened(); - Assert.IsEmpty(actual); + Assert.That(actual, Is.Empty); } } diff --git a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.YieldSingleOrEmpty.cs b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.YieldSingleOrEmpty.cs index c84c3c41..240360c1 100644 --- a/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.YieldSingleOrEmpty.cs +++ b/src/core-taggeds-optional/Optional.Tests/Optional.Test/Test.YieldSingleOrEmpty.cs @@ -16,10 +16,10 @@ public void YieldSingleOrEmpty_SourceIsPresent_ExpectSingleValue( var source = Optional.Present(sourceValue); var actual = source.YieldSingleOrEmpty(); - Assert.AreEqual(1, actual.Count()); - var actualValue = actual.Single(); + Assert.That(actual.Count(), Is.EqualTo(1)); - Assert.AreEqual(sourceValue, actualValue); + var actualValue = actual.Single(); + Assert.That(actualValue, Is.SameAs(sourceValue)); } [Obsolete] @@ -29,6 +29,6 @@ public void YieldSingleOrEmpty_SourceIsAbsent_ExpectEmpty() var source = Optional.Absent; var actual = source.YieldSingleOrEmpty(); - Assert.IsEmpty(actual); + Assert.That(actual, Is.Empty); } } diff --git a/src/core-taggeds-optional/Optional.Tests/OptionalExtensions.Tests/FilterNotNull.cs b/src/core-taggeds-optional/Optional.Tests/OptionalExtensions.Tests/FilterNotNull.cs index 50ae0e52..3bcff970 100644 --- a/src/core-taggeds-optional/Optional.Tests/OptionalExtensions.Tests/FilterNotNull.cs +++ b/src/core-taggeds-optional/Optional.Tests/OptionalExtensions.Tests/FilterNotNull.cs @@ -13,7 +13,7 @@ public void FilterNotNull_Class_SourceValueIsNotNull_ExpectSource() var source = Optional.Present(PlusFifteenIdRefType); var actual = source.FilterNotNull(); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); } [Test] @@ -22,8 +22,8 @@ public void FilterNotNull_Struct_SourceValueIsNotNull_ExpectSource() var source = Optional.Present(PlusFifteen); var actual = source.FilterNotNull(); - Assert.True(actual.IsPresent); - Assert.AreEqual(source.OrThrow()!.Value, actual.OrThrow()); + Assert.That(actual.IsPresent, Is.True); + Assert.That(actual.OrThrow(), Is.EqualTo(source.OrThrow()!.Value)); } [Test] @@ -34,7 +34,7 @@ public void FilterNotNull_SourceValueIsNull_ExpectAbsent() var actual = source.FilterNotNull(); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -46,7 +46,7 @@ public void FilterNotNull_SourceValueIsNotNullRefType_ExpectNotNullableRefTypePr var actual = source.FilterNotNull(); var expected = Optional.Present(sourceValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -57,7 +57,7 @@ public void FilterNotNull_SourceValueIsNullRefType_ExpectNotNullableRefTypeAbsen var actual = source.FilterNotNull(); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -69,7 +69,7 @@ public void FilterNotNull_SourceValueIsNotNullStructType_ExpectNotNullableStruct var actual = source.FilterNotNull(); var expected = Optional.Present(sourceValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -80,6 +80,6 @@ public void FilterNotNull_SourceValueIsNullStructType_ExpectNotNullableStructTyp var actual = source.FilterNotNull(); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/OptionalExtensions.Tests/FilterNotNullOrThrow.cs b/src/core-taggeds-optional/Optional.Tests/OptionalExtensions.Tests/FilterNotNullOrThrow.cs index b882ff3c..874db6dd 100644 --- a/src/core-taggeds-optional/Optional.Tests/OptionalExtensions.Tests/FilterNotNullOrThrow.cs +++ b/src/core-taggeds-optional/Optional.Tests/OptionalExtensions.Tests/FilterNotNullOrThrow.cs @@ -13,7 +13,7 @@ public void FilterNotNullOrThrow_SourceValueIsNotNull_ExpectSource() var source = Optional.Present(ZeroIdRefType); var actual = source.FilterNotNullOrThrow(); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); } [Test] @@ -29,7 +29,7 @@ public void FilterNotNullOrThrowWithFactory_ExceptionFactoryIsNull_ExpectArgumen var source = Optional.Present(SomeTextStructType); var ex = Assert.Throws(() => _ = source.FilterNotNullOrThrow(null!)); - Assert.AreEqual("exceptionFactory", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("exceptionFactory")); } [Test] @@ -38,7 +38,7 @@ public void FilterNotNullOrThrowWithFactory_SourceValueIsNotNull_ExpectSource() var source = Optional.Present(ZeroIdRefType); var actual = source.FilterNotNullOrThrow(() => new SomeException()); - Assert.AreEqual(source, actual); + Assert.That(actual, Is.EqualTo(source)); } [Test] @@ -48,7 +48,7 @@ public void FilterNotNullOrThrowWithFactory_SourceValueIsNull_ExpectCreatedExcep var resultException = new SomeException(); var ex = Assert.Throws(() => _ = source.FilterNotNullOrThrow(() => resultException)); - Assert.AreSame(resultException, ex); + Assert.That(ex, Is.SameAs(resultException)); } [Test] @@ -60,7 +60,7 @@ public void FilterNotNullOrThrow_SourceValueIsNotNullRefType_ExpectPresentNotNul var actual = source.FilterNotNullOrThrow(); var expected = Optional.Present(sourceValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -76,7 +76,7 @@ public void FilterNotNullOrThrowWithFactory_RefTypeExceptionFactoryIsNull_Expect var source = Optional.Present(PlusFifteenIdRefType); var ex = Assert.Throws(() => _ = source.FilterNotNullOrThrow(null!)); - Assert.AreEqual("exceptionFactory", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("exceptionFactory")); } [Test] @@ -88,7 +88,7 @@ public void FilterNotNullOrThrowWithFactory_SourceValueIsNotNullRefType_ExpectPr var actual = source.FilterNotNullOrThrow(() => new SomeException()); var expected = Optional.Present(sourceValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -97,9 +97,9 @@ public void FilterNotNullOrThrowWithFactory_SourceValueIsNullRefType_ExpectCreat var source = Optional.Present(null); var createdException = new SomeException(); - var actualExcepton = Assert.Throws( + var actualException = Assert.Throws( () => _ = source.FilterNotNullOrThrow(() => createdException)); - Assert.AreSame(createdException, actualExcepton); + Assert.That(actualException, Is.SameAs(createdException)); } [Test] @@ -111,7 +111,7 @@ public void FilterNotNullOrThrow_SourceValueIsNotNullStructType_ExpectPresentNot var actual = source.FilterNotNullOrThrow(); var expected = Optional.Present(sourceValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -127,7 +127,7 @@ public void FilterNotNullOrThrowWithFactory_StructExceptionFactoryIsNull_ExpectA var source = Optional.Present(null); var ex = Assert.Throws(() => _ = source.FilterNotNullOrThrow(null!)); - Assert.AreEqual("exceptionFactory", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("exceptionFactory")); } [Test] @@ -139,7 +139,7 @@ public void FilterNotNullOrThrowWithFactory_SourceValueIsNotNullStructType_Expec var actual = source.FilterNotNullOrThrow(() => new SomeException()); var expected = Optional.Present(sourceValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -148,8 +148,8 @@ public void FilterNotNullOrThrowWithFactory_SourceValueIsNullStructType_ExpectCr var source = Optional.Present(null); var createdException = new SomeException(); - var actualExcepton = Assert.Throws( + var actualException = Assert.Throws( () => _ = source.FilterNotNullOrThrow(() => createdException)); - Assert.AreSame(createdException, actualExcepton); + Assert.That(actualException, Is.SameAs(createdException)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.Enumerable.Index.FromEnd.cs b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.Enumerable.Index.FromEnd.cs index 788a58c6..fcb8a246 100644 --- a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.Enumerable.Index.FromEnd.cs +++ b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.Enumerable.Index.FromEnd.cs @@ -16,7 +16,7 @@ public void ElementAtOrAbsentByIndexFromEnd_CollectionSourceIsNull_ExpectArgumen var index = Index.FromEnd(1); var ex = Assert.Throws(() => _ = source.ElementAtOrAbsent(index)); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); } [Test] @@ -34,7 +34,7 @@ public void ElementAtOrAbsentByIndexFromEnd_CollectionIndexIsInRange_ExpectPrese var expectedValue = source.ElementAt(index); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -51,7 +51,7 @@ public void ElementAtOrAbsentByIndexFromEnd_CollectionIndexIsNotInRange_ExpectAb var actual = source.ElementAtOrAbsent(index); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -68,6 +68,6 @@ public void ElementAtOrAbsentByIndexFromEnd_CollectionIsEmpty_ExpectAbsent( var actual = source.ElementAtOrAbsent(index); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.Enumerable.Index.cs b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.Enumerable.Index.cs index 9b2546e6..0c0f83a5 100644 --- a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.Enumerable.Index.cs +++ b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.Enumerable.Index.cs @@ -16,7 +16,7 @@ public void ElementAtOrAbsentByIndex_CollectionSourceIsNull_ExpectArgumentNullEx var index = Index.FromStart(1); var ex = Assert.Throws(() => _ = source.ElementAtOrAbsent(index)); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); } [Test] @@ -34,7 +34,7 @@ public void ElementAtOrAbsentByIndex_CollectionIndexIsInRange_ExpectPresentItem( var expectedValue = source.ElementAt(index); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -50,7 +50,7 @@ public void ElementAtOrAbsentByIndex_CollectionIndexIsNotInRange_ExpectAbsent( var actual = source.ElementAtOrAbsent(index); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -67,6 +67,6 @@ public void ElementAtOrAbsentByIndex_CollectionIsEmpty_ExpectAbsent( var actual = source.ElementAtOrAbsent(index); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.Enumerable.Int32.cs b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.Enumerable.Int32.cs index 58a992b1..7fe04bc7 100644 --- a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.Enumerable.Int32.cs +++ b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.Enumerable.Int32.cs @@ -16,7 +16,7 @@ public void ElementAtOrAbsentByInt_CollectionSourceIsNull_ExpectArgumentNullExce int index = 1; var ex = Assert.Throws(() => _ = source.ElementAtOrAbsent(index)); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); } [Test] @@ -32,7 +32,7 @@ public void ElementAtOrAbsentByInt_CollectionIndexIsInRange_ExpectPresentItem( var expectedValue = source.ElementAt(index); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -48,7 +48,7 @@ public void ElementAtOrAbsentByInt_CollectionIndexIsNotInRange_ExpectAbsent( var actual = source.ElementAtOrAbsent(index); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -65,6 +65,6 @@ public void ElementAtOrAbsentByInt_CollectionIsEmpty_ExpectAbsent( var actual = source.ElementAtOrAbsent(index); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.Enumerable.Int64.cs b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.Enumerable.Int64.cs index da8193de..1bcf0aa6 100644 --- a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.Enumerable.Int64.cs +++ b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.Enumerable.Int64.cs @@ -16,7 +16,7 @@ public void ElementAtOrAbsentByLong_CollectionSourceIsNull_ExpectArgumentNullExc long index = 1; var ex = Assert.Throws(() => _ = source.ElementAtOrAbsent(index)); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); } [Test] @@ -32,7 +32,7 @@ public void ElementAtOrAbsentByLong_CollectionIndexIsInRange_ExpectPresentItem( var expectedValue = source.ElementAt(checked((int)index)); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -48,7 +48,7 @@ public void ElementAtOrAbsentByLong_CollectionIndexIsNotInRange_ExpectAbsent( var actual = source.ElementAtOrAbsent(index); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -65,6 +65,6 @@ public void ElementAtOrAbsentByLong_CollectionIsEmpty_ExpectAbsent( var actual = source.ElementAtOrAbsent(index); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.List.Index.FromEnd.cs b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.List.Index.FromEnd.cs index 7f7d2a02..21e32fcd 100644 --- a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.List.Index.FromEnd.cs +++ b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.List.Index.FromEnd.cs @@ -16,7 +16,7 @@ public void ElementAtOrAbsentByIndexFromEnd_ListSourceIsNull_ExpectArgumentNullE var index = Index.FromEnd(1); var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -38,7 +38,7 @@ public void ElementAtOrAbsentByIndexFromEnd_ListIndexIsInRange_ExpectPresentItem var expectedValue = source.ElementAt(index); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -55,7 +55,7 @@ public void ElementAtOrAbsentByIndexFromEnd_ListIndexIsNotInRange_ExpectAbsent( var actual = source.ElementAtOrAbsent(index); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -72,6 +72,6 @@ public void ElementAtOrAbsentByIndexFromEnd_ListIsEmpty_ExpectAbsent( var actual = source.ElementAtOrAbsent(index); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.List.Index.cs b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.List.Index.cs index 5dfcc496..ab57f20e 100644 --- a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.List.Index.cs +++ b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.List.Index.cs @@ -16,7 +16,7 @@ public void ElementAtOrAbsentByIndex_ListSourceIsNull_ExpectArgumentNullExceptio var index = Index.FromStart(1); var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -38,7 +38,7 @@ public void ElementAtOrAbsentByIndex_ListIndexIsInRange_ExpectPresentItem( var expectedValue = source.ElementAt(index); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -54,7 +54,7 @@ public void ElementAtOrAbsentByIndex_ListIndexIsNotInRange_ExpectAbsent( var actual = source.ElementAtOrAbsent(index); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -71,6 +71,6 @@ public void ElementAtOrAbsentByIndex_ListIsEmpty_ExpectAbsent( var actual = source.ElementAtOrAbsent(index); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.List.Int32.cs b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.List.Int32.cs index 822052d4..adabfc51 100644 --- a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.List.Int32.cs +++ b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.List.Int32.cs @@ -16,7 +16,7 @@ public void ElementAtOrAbsentByInt_ListSourceIsNull_ExpectArgumentNullException( int index = 1; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -36,7 +36,7 @@ public void ElementAtOrAbsentByInt_ListIndexIsInRange_ExpectPresentItem( var expectedValue = source.ElementAt(index); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -52,7 +52,7 @@ public void ElementAtOrAbsentByInt_ListIndexIsNotInRange_ExpectAbsent( var actual = source.ElementAtOrAbsent(index); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -69,6 +69,6 @@ public void ElementAtOrAbsentByInt_ListIsEmpty_ExpectAbsent( var actual = source.ElementAtOrAbsent(index); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.List.Int64.cs b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.List.Int64.cs index 4c5a3f9a..99b8ec28 100644 --- a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.List.Int64.cs +++ b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.List.Int64.cs @@ -16,7 +16,7 @@ public void ElementAtOrAbsentByLong_ListSourceIsNull_ExpectArgumentNullException long index = 1; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -36,7 +36,7 @@ public void ElementAtOrAbsentByLong_ListIndexIsInRange_ExpectPresentItem( var expectedValue = source.ElementAt(checked((int)index)); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -52,7 +52,7 @@ public void ElementAtOrAbsentByLong_ListIndexIsNotInRange_ExpectAbsent( var actual = source.ElementAtOrAbsent(index); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -69,6 +69,6 @@ public void ElementAtOrAbsentByLong_ListIsEmpty_ExpectAbsent( var actual = source.ElementAtOrAbsent(index); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.ReadOnlyList.Index.FromEnd.cs b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.ReadOnlyList.Index.FromEnd.cs index d66f7c51..58dab6d0 100644 --- a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.ReadOnlyList.Index.FromEnd.cs +++ b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.ReadOnlyList.Index.FromEnd.cs @@ -16,7 +16,7 @@ public void ElementAtOrAbsentByIndexFromEnd_ReadOnlyListSourceIsNull_ExpectArgum var index = Index.FromEnd(1); var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -39,7 +39,7 @@ public void ElementAtOrAbsentByIndexFromEnd_ReadOnlyListIndexIsInRange_ExpectPre var expectedValue = source.ElementAt(index); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -56,7 +56,7 @@ public void ElementAtOrAbsentByIndexFromEnd_ReadOnlyListIndexIsNotInRange_Expect var actual = source.ElementAtOrAbsent(index); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -73,6 +73,6 @@ public void ElementAtOrAbsentByIndexFromEnd_ReadOnlyListIsEmpty_ExpectAbsent( var actual = source.ElementAtOrAbsent(index); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.ReadOnlyList.Index.cs b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.ReadOnlyList.Index.cs index cc8cd74b..669f3f9c 100644 --- a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.ReadOnlyList.Index.cs +++ b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.ReadOnlyList.Index.cs @@ -16,7 +16,7 @@ public void ElementAtOrAbsentByIndex_ReadOnlyListSourceIsNull_ExpectArgumentNull var index = Index.FromStart(1); var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -39,7 +39,7 @@ public void ElementAtOrAbsentByIndex_ReadOnlyListIndexIsInRange_ExpectPresentIte var expectedValue = source.ElementAt(index); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -55,7 +55,7 @@ public void ElementAtOrAbsentByIndex_ReadOnlyListIndexIsNotInRange_ExpectAbsent( var actual = source.ElementAtOrAbsent(index); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -72,6 +72,6 @@ public void ElementAtOrAbsentByIndex_ReadOnlyListIsEmpty_ExpectAbsent( var actual = source.ElementAtOrAbsent(index); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.ReadOnlyList.Int32.cs b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.ReadOnlyList.Int32.cs index 567adfb1..fcf33f0a 100644 --- a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.ReadOnlyList.Int32.cs +++ b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.ReadOnlyList.Int32.cs @@ -16,7 +16,7 @@ public void ElementAtOrAbsentByInt_ReadOnlyListSourceIsNull_ExpectArgumentNullEx int index = 1; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -37,7 +37,7 @@ public void ElementAtOrAbsentByInt_ReadOnlyListIndexIsInRange_ExpectPresentItem( var expectedValue = source.ElementAt(index); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -53,7 +53,7 @@ public void ElementAtOrAbsentByInt_ReadOnlyListIndexIsNotInRange_ExpectAbsent( var actual = source.ElementAtOrAbsent(index); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -70,6 +70,6 @@ public void ElementAtOrAbsentByInt_ReadOnlyListIsEmpty_ExpectAbsent( var actual = source.ElementAtOrAbsent(index); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.ReadOnlyList.Int64.cs b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.ReadOnlyList.Int64.cs index e947f2c0..92fe5d30 100644 --- a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.ReadOnlyList.Int64.cs +++ b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/ElementAtOrAbsent.ReadOnlyList.Int64.cs @@ -16,7 +16,7 @@ public void ElementAtOrAbsentByLong_ReadOnlyListSourceIsNull_ExpectArgumentNullE long index = 1; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -36,7 +36,7 @@ public void ElementAtOrAbsentByLong_ReadOnlyListIndexIsInRange_ExpectPresentItem var expectedValue = source.ElementAt(checked((int)index)); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -52,7 +52,7 @@ public void ElementAtOrAbsentByLong_ReadOnlyListIndexIsNotInRange_ExpectAbsent( var actual = source.ElementAtOrAbsent(index); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -69,6 +69,6 @@ public void ElementAtOrAbsentByLong_ReadOnlyListIsEmpty_ExpectAbsent( var actual = source.ElementAtOrAbsent(index); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/FirstOrAbsent.Enumerable.cs b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/FirstOrAbsent.Enumerable.cs index b87457e9..1c752262 100644 --- a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/FirstOrAbsent.Enumerable.cs +++ b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/FirstOrAbsent.Enumerable.cs @@ -15,7 +15,7 @@ public void FirstOrAbsent_CollectionSourceIsNull_ExpectArgumentNullException() IEnumerable source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -30,7 +30,7 @@ public void FirstOrAbsent_CollectionSourceIsEmpty_ExpectAbsent() var actual = source.FirstOrAbsent(); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -43,7 +43,7 @@ public void FirstOrAbsent_CollectionSourceIsNotEmpty_ExpectPresentFirstItem( var actual = source.FirstOrAbsent(); var expected = Optional.Present(firstItem); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -52,7 +52,7 @@ public void FirstOrAbsentByPredicate_CollectionSourceIsNull_ExpectArgumentNullEx IEnumerable source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -65,7 +65,7 @@ public void FirstOrAbsentByPredicate_CollectionPredicateIsNull_ExpectArgumentNul var source = CreateCollection(SomeTextStructType); var ex = Assert.Throws(Test); - Assert.AreEqual("predicate", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("predicate")); void Test() => @@ -80,7 +80,7 @@ public void FirstOrAbsentByPredicate_CollectionPredicateResultIsAlreadyFalse_Exp var actual = source.FirstOrAbsent(static _ => false); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -102,6 +102,6 @@ public void FirstOrAbsentByPredicate_CollectionPredicateResultIsNotAlreadyFalse_ var actual = source.FirstOrAbsent(item => item?.Id == expectedId); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/FirstOrAbsent.List.cs b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/FirstOrAbsent.List.cs index 5abedaab..10808827 100644 --- a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/FirstOrAbsent.List.cs +++ b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/FirstOrAbsent.List.cs @@ -15,7 +15,7 @@ public void FirstOrAbsent_ListSourceIsNull_ExpectArgumentNullException() IList source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -30,7 +30,7 @@ public void FirstOrAbsent_ListSourceIsEmpty_ExpectAbsent() var actual = source.FirstOrAbsent(); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -43,7 +43,7 @@ public void FirstOrAbsent_ListSourceIsNotEmpty_ExpectPresentFirstItem( var actual = source.FirstOrAbsent(); var expected = Optional.Present(firstItem); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -52,7 +52,7 @@ public void FirstOrAbsentByPredicate_ListSourceIsNull_ExpectArgumentNullExceptio IList source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -65,7 +65,7 @@ public void FirstOrAbsentByPredicate_ListPredicateIsNull_ExpectArgumentNullExcep var source = CreateList(SomeTextStructType); var ex = Assert.Throws(Test); - Assert.AreEqual("predicate", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("predicate")); void Test() => @@ -80,7 +80,7 @@ public void FirstOrAbsentByPredicate_ListPredicateResultIsAlreadyFalse_ExpectAbs var actual = source.FirstOrAbsent(static _ => false); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -103,7 +103,7 @@ public void FirstOrAbsentByPredicate_ListPredicateResultIsNotAlreadyFalse_Expect var actual = source.FirstOrAbsent(Predicate); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); static bool Predicate(RefType? item) => diff --git a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/FirstOrAbsent.ReadOnlyList.cs b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/FirstOrAbsent.ReadOnlyList.cs index 10709075..9105a680 100644 --- a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/FirstOrAbsent.ReadOnlyList.cs +++ b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/FirstOrAbsent.ReadOnlyList.cs @@ -15,7 +15,7 @@ public void FirstOrAbsent_ReadOnlyListSourceIsNull_ExpectArgumentNullException() IReadOnlyList source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -30,7 +30,7 @@ public void FirstOrAbsent_ReadOnlyListSourceIsEmpty_ExpectAbsent() var actual = source.FirstOrAbsent(); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -43,7 +43,7 @@ public void FirstOrAbsent_ReadOnlyListSourceIsNotEmpty_ExpectPresentFirstItem( var actual = source.FirstOrAbsent(); var expected = Optional.Present(firstItem); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -52,7 +52,7 @@ public void FirstOrAbsentByPredicate_ReadOnlyListSourceIsNull_ExpectArgumentNull IReadOnlyList source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -65,7 +65,7 @@ public void FirstOrAbsentByPredicate_ReadOnlyListPredicateIsNull_ExpectArgumentN var source = CreateReadOnlyList(SomeTextStructType); var ex = Assert.Throws(Test); - Assert.AreEqual("predicate", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("predicate")); void Test() => @@ -80,7 +80,7 @@ public void FirstOrAbsentByPredicate_ReadOnlyListPredicateResultIsAlreadyFalse_E var actual = source.FirstOrAbsent(static _ => false); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -103,7 +103,7 @@ public void FirstOrAbsentByPredicate_ReadOnlyListPredicateResultIsNotAlreadyFals var actual = source.FirstOrAbsent(Predicate); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); static bool Predicate(RefType? item) => diff --git a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/GetValueOrAbsent.Dictionary.cs b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/GetValueOrAbsent.Dictionary.cs index 17816f81..795ee636 100644 --- a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/GetValueOrAbsent.Dictionary.cs +++ b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/GetValueOrAbsent.Dictionary.cs @@ -15,7 +15,7 @@ public void GetValueOrAbsent_DictionaryPairsAreNull_ExpectArgumentNullException( IDictionary sourceDictionary = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("pairs", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("pairs")); void Test() => @@ -33,7 +33,7 @@ public void GetValueOrAbsent_DictionaryPairsPairsTryGetValueReturnsFalse_ExpectA var actual = sourceDictionary.GetValueOrAbsent(PlusFifteenIdRefType); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -50,6 +50,6 @@ public void GetValueOrAbsent_DictionaryPairsPairsTryGetValueReturnsTrue_ExpectPr var actual = sourceDictionary.GetValueOrAbsent(NullTextStructType); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/GetValueOrAbsent.Pairs.cs b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/GetValueOrAbsent.Pairs.cs index e1571f45..7f713d13 100644 --- a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/GetValueOrAbsent.Pairs.cs +++ b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/GetValueOrAbsent.Pairs.cs @@ -15,7 +15,7 @@ public void GetValueOrAbsent_PairsAreNull_ExpectArgumentNullException() IEnumerable> sourcePairs = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("pairs", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("pairs")); void Test() => @@ -33,7 +33,7 @@ public void GetValueOrAbsent_PairsDoNotContainKey_ExpectAbsent() var actual = sourcePairs.GetValueOrAbsent(PlusFifteen); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -53,7 +53,7 @@ public void GetValueOrAbsent_PairsContainOnlyOneKey_ExpectPresentKeyValue( var actual = sourcePairs.GetValueOrAbsent(sourceKey); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [TestCase] @@ -68,7 +68,7 @@ public void GetValueOrAbsent_PairsContainOnlyOneKeyAndKeyIsNull_ExpectPresentKey var actual = sourcePairs.GetValueOrAbsent(null); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -88,6 +88,6 @@ public void GetValueOrAbsent_PairsContainMoreThanOneKey_ExpectFirst() var expected2 = Optional.Present(expectedValue2); bool equalToAnExpected = actual.Equals(expected1) || actual.Equals(expected2); - Assert.True(equalToAnExpected); + Assert.That(equalToAnExpected); } } diff --git a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/GetValueOrAbsent.ReadOnlyDictionary.cs b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/GetValueOrAbsent.ReadOnlyDictionary.cs index e828cff9..511f78c0 100644 --- a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/GetValueOrAbsent.ReadOnlyDictionary.cs +++ b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/GetValueOrAbsent.ReadOnlyDictionary.cs @@ -15,7 +15,7 @@ public void GetValueOrAbsent_ReadOnlyDictionaryPairsAreNull_ExpectArgumentNullEx IReadOnlyDictionary sourceDictionary = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("pairs", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("pairs")); void Test() => @@ -35,7 +35,7 @@ public void GetValueOrAbsent_ReadOnlyDictionaryPairsTryGetValueReturnsFalse_Expe var actual = sourceDictionary.GetValueOrAbsent(MinusFifteen); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -54,6 +54,6 @@ public void GetValueOrAbsent_ReadOnlyDictionaryPairsTryGetValueReturnsTrue_Expec var actual = sourceDictionary.GetValueOrAbsent(decimal.MinusOne); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } } diff --git a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/LastOrAbsent.Enumerable.cs b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/LastOrAbsent.Enumerable.cs index 48c54dbe..7abe70a9 100644 --- a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/LastOrAbsent.Enumerable.cs +++ b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/LastOrAbsent.Enumerable.cs @@ -15,7 +15,7 @@ public void LastOrAbsent_CollectionSourceIsNull_ExpectArgumentNullException() IEnumerable source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -30,7 +30,7 @@ public void LastOrAbsent_CollectionSourceIsEmpty_ExpectAbsent() var actual = source.LastOrAbsent(); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -43,7 +43,7 @@ public void LastOrAbsent_CollectionSourceIsNotEmpty_ExpectPresentLastItem( var actual = source.LastOrAbsent(); var expected = Optional.Present(lastItem); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -52,7 +52,7 @@ public void LastOrAbsentByPredicate_CollectionSourceIsNull_ExpectArgumentNullExc IEnumerable source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -65,7 +65,7 @@ public void LastOrAbsentByPredicate_CollectionPredicateIsNull_ExpectArgumentNull var source = CreateCollection(SomeTextStructType); var ex = Assert.Throws(Test); - Assert.AreEqual("predicate", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("predicate")); void Test() => @@ -80,7 +80,7 @@ public void LastOrAbsentByPredicate_CollectionPredicateResultIsAlreadyFalse_Expe var actual = source.LastOrAbsent(static _ => false); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -104,7 +104,7 @@ public void LastOrAbsentByPredicate_CollectionPredicateResultIsNotAlreadyFalse_E var actual = source.LastOrAbsent(Predicate); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); static bool Predicate(RefType? item) => diff --git a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/LastOrAbsent.List.cs b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/LastOrAbsent.List.cs index fa53917b..1fe6eeca 100644 --- a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/LastOrAbsent.List.cs +++ b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/LastOrAbsent.List.cs @@ -15,7 +15,7 @@ public void LastOrAbsent_ListSourceIsNull_ExpectArgumentNullException() IList source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -30,7 +30,7 @@ public void LastOrAbsent_ListSourceIsEmpty_ExpectAbsent() var actual = source.LastOrAbsent(); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -43,7 +43,7 @@ public void LastOrAbsent_ListSourceIsNotEmpty_ExpectPresentLastItem( var actual = source.LastOrAbsent(); var expected = Optional.Present(lastItem); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -52,7 +52,7 @@ public void LastOrAbsentByPredicate_ListSourceIsNull_ExpectArgumentNullException IList source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -65,7 +65,7 @@ public void LastOrAbsentByPredicate_ListPredicateIsNull_ExpectArgumentNullExcept var source = CreateList(SomeTextStructType); var ex = Assert.Throws(Test); - Assert.AreEqual("predicate", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("predicate")); void Test() => @@ -80,7 +80,7 @@ public void LastOrAbsentByPredicate_ListPredicateResultIsAlreadyFalse_ExpectAbse var actual = source.LastOrAbsent(static _ => false); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -104,7 +104,7 @@ public void LastOrAbsentByPredicate_ListPredicateResultIsNotAlreadyFalse_ExpectP var actual = source.LastOrAbsent(Predicate); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); static bool Predicate(RefType? item) => diff --git a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/LastOrAbsent.ReadOnlyList.cs b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/LastOrAbsent.ReadOnlyList.cs index 8bfcd818..2cde1269 100644 --- a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/LastOrAbsent.ReadOnlyList.cs +++ b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/LastOrAbsent.ReadOnlyList.cs @@ -15,7 +15,7 @@ public void LastOrAbsent_ReadOnlyListSourceIsNull_ExpectArgumentNullException() IReadOnlyList source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -30,7 +30,7 @@ public void LastOrAbsent_ReadOnlyListSourceIsEmpty_ExpectAbsent() var actual = source.LastOrAbsent(); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -43,7 +43,7 @@ public void LastOrAbsent_ReadOnlyListSourceIsNotEmpty_ExpectPresentLastItem( var actual = source.LastOrAbsent(); var expected = Optional.Present(lastItem); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -52,7 +52,7 @@ public void LastOrAbsentByPredicate_ReadOnlyListSourceIsNull_ExpectArgumentNullE IReadOnlyList source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -65,7 +65,7 @@ public void LastOrAbsentByPredicate_ReadOnlyListPredicateIsNull_ExpectArgumentNu var source = CreateReadOnlyList(SomeTextStructType); var ex = Assert.Throws(Test); - Assert.AreEqual("predicate", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("predicate")); void Test() => @@ -80,7 +80,7 @@ public void LastOrAbsentByPredicate_ReadOnlyListPredicateResultIsAlreadyFalse_Ex var actual = source.LastOrAbsent(static _ => false); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -104,7 +104,7 @@ public void LastOrAbsentByPredicate_ReadOnlyListPredicateResultIsNotAlreadyFalse var actual = source.LastOrAbsent(Predicate); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); static bool Predicate(RefType? item) => diff --git a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/SingleOrAbsent.Enumerable.cs b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/SingleOrAbsent.Enumerable.cs index 9e554a49..631071ce 100644 --- a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/SingleOrAbsent.Enumerable.cs +++ b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/SingleOrAbsent.Enumerable.cs @@ -15,7 +15,7 @@ public void SingleOrAbsent_CollectionSourceIsNull_ExpectArgumentNullException() IEnumerable source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -30,7 +30,7 @@ public void SingleOrAbsent_CollectionSourceIsEmpty_ExpectAbsent() var actual = source.SingleOrAbsent(); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -43,7 +43,7 @@ public void SingleOrAbsent_CollectionSourceContainsOnlyOneElement_ExpectPresentS var actual = source.SingleOrAbsent(); var expected = Optional.Present(singleItem); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -63,7 +63,7 @@ public void SingleOrAbsentWithExceptionFactory_CollectionSourceIsNull_ExpectArgu IEnumerable source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -77,7 +77,7 @@ public void SingleOrAbsentWithExceptionFactory_CollectionExceptionFactoryIsNull_ Func exceptionFactory = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("moreThanOneElementExceptionFactory", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("moreThanOneElementExceptionFactory")); void Test() => @@ -92,7 +92,7 @@ public void SingleOrAbsentWithExceptionFactory_CollectionSourceIsEmpty_ExpectAbs var actual = source.SingleOrAbsent(CreateSomeException); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -105,7 +105,7 @@ public void SingleOrAbsentWithExceptionFactory_CollectionSourceContainsOnlyOneEl var actual = source.SingleOrAbsent(CreateSomeException); var expected = Optional.Present(singleItem); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -115,7 +115,7 @@ public void SingleOrAbsentWithExceptionFactory_CollectionSourceContainsMoreThanO var createdException = new SomeException(); var ex = Assert.Throws(Test); - Assert.AreSame(createdException, ex); + Assert.That(ex, Is.SameAs(createdException)); void Test() => @@ -128,7 +128,7 @@ public void SingleOrAbsentByPredicate_CollectionSourceIsNull_ExpectArgumentNullE IEnumerable source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -142,7 +142,7 @@ public void SingleOrAbsentByPredicate_CollectionPredicateIsNull_ExpectArgumentNu Func predicate = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("predicate", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("predicate")); void Test() => @@ -157,7 +157,7 @@ public void SingleOrAbsentByPredicate_CollectionPredicateResultIsAlreadyFalse_Ex var actual = source.SingleOrAbsent(static _ => false); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -174,7 +174,7 @@ public void SingleOrAbsentByPredicate_CollectionPredicateResultIsTrueOnlyOnce_Ex var actual = source.SingleOrAbsent(item => expectedText.Equals(item?.Text, StringComparison.InvariantCultureIgnoreCase)); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -212,7 +212,7 @@ public void SingleOrAbsentByPredicateAndFactory_CollectionSourceIsNull_ExpectArg IEnumerable source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -230,7 +230,7 @@ public void SingleOrAbsentByPredicateAndFactory_CollectionPredicateIsNull_Expect Func predicate = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("predicate", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("predicate")); void Test() => @@ -243,7 +243,7 @@ public void SingleOrAbsentByPredicateAndFactory_CollectionExceptionFactoryIsNull var source = CreateCollection(MinusFifteenIdRefType); var ex = Assert.Throws(Test); - Assert.AreEqual("moreThanOneMatchExceptionFactory", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("moreThanOneMatchExceptionFactory")); void Test() => @@ -262,7 +262,7 @@ public void SingleOrAbsentByPredicateAndFactory_CollectionPredicateResultIsAlrea var actual = source.SingleOrAbsent(static _ => false, CreateSomeException); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -281,7 +281,7 @@ public void SingleOrAbsentByPredicateAndFactory_CollectionPredicateResultIsTrueO CreateSomeException); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -305,7 +305,7 @@ public void SingleOrAbsentByPredicateAndFactory_CollectionPredicateResultIsTrueM var createdException = new SomeException(); var actualException = Assert.Throws(Test); - Assert.AreSame(createdException, actualException); + Assert.That(actualException, Is.SameAs(createdException)); void Test() => diff --git a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/SingleOrAbsent.List.cs b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/SingleOrAbsent.List.cs index 795fee40..9eb3ebf6 100644 --- a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/SingleOrAbsent.List.cs +++ b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/SingleOrAbsent.List.cs @@ -15,7 +15,7 @@ public void SingleOrAbsent_ListSourceIsNull_ExpectArgumentNullException() IList source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -30,7 +30,7 @@ public void SingleOrAbsent_ListSourceIsEmpty_ExpectAbsent() var actual = source.SingleOrAbsent(); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -43,7 +43,7 @@ public void SingleOrAbsent_ListSourceContainsOnlyOneElement_ExpectPresentSingleE var actual = source.SingleOrAbsent(); var expected = Optional.Present(singleItem); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -63,7 +63,7 @@ public void SingleOrAbsentWithExceptionFactory_ListSourceIsNull_ExpectArgumentNu IList source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -77,7 +77,7 @@ public void SingleOrAbsentWithExceptionFactory_ListExceptionFactoryIsNull_Expect Func exceptionFactory = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("moreThanOneElementExceptionFactory", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("moreThanOneElementExceptionFactory")); void Test() => @@ -92,7 +92,7 @@ public void SingleOrAbsentWithExceptionFactory_ListSourceIsEmpty_ExpectAbsent() var actual = source.SingleOrAbsent(CreateSomeException); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -105,7 +105,7 @@ public void SingleOrAbsentWithExceptionFactory_ListSourceContainsOnlyOneElement_ var actual = source.SingleOrAbsent(CreateSomeException); var expected = Optional.Present(singleItem); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -115,7 +115,7 @@ public void SingleOrAbsentWithExceptionFactory_ListSourceContainsMoreThanOneElem var createdException = new SomeException(); var ex = Assert.Throws(Test); - Assert.AreSame(createdException, ex); + Assert.That(ex, Is.SameAs(createdException)); void Test() => @@ -128,7 +128,7 @@ public void SingleOrAbsentByPredicate_ListSourceIsNull_ExpectArgumentNullExcepti IList source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -142,7 +142,7 @@ public void SingleOrAbsentByPredicate_ListPredicateIsNull_ExpectArgumentNullExce Func predicate = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("predicate", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("predicate")); void Test() => @@ -157,7 +157,7 @@ public void SingleOrAbsentByPredicate_ListPredicateResultIsAlreadyFalse_ExpectAb var actual = source.SingleOrAbsent(static _ => false); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -174,7 +174,7 @@ public void SingleOrAbsentByPredicate_ListPredicateResultIsTrueOnlyOnce_ExpectPr var actual = source.SingleOrAbsent(item => expectedText.Equals(item?.Text, StringComparison.InvariantCultureIgnoreCase)); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -212,7 +212,7 @@ public void SingleOrAbsentByPredicateAndFactory_ListSourceIsNull_ExpectArgumentN IList source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -226,7 +226,7 @@ public void SingleOrAbsentByPredicateAndFactory_ListPredicateIsNull_ExpectArgume Func predicate = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("predicate", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("predicate")); void Test() => @@ -239,7 +239,7 @@ public void SingleOrAbsentByPredicateAndFactory_ListExceptionFactoryIsNull_Expec var source = CreateList(MinusFifteenIdRefType); var ex = Assert.Throws(Test); - Assert.AreEqual("moreThanOneMatchExceptionFactory", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("moreThanOneMatchExceptionFactory")); void Test() => @@ -254,7 +254,7 @@ public void SingleOrAbsentByPredicateAndFactory_ListPredicateResultIsAlreadyFals var actual = source.SingleOrAbsent(static _ => false, CreateSomeException); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -272,7 +272,7 @@ public void SingleOrAbsentByPredicateAndFactory_ListPredicateResultIsTrueOnlyOnc var actual = source.SingleOrAbsent(Predicate, CreateSomeException); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); static bool Predicate(StructType? item) => @@ -300,7 +300,7 @@ public void SingleOrAbsentByPredicateAndFactory_ListPredicateResultIsTrueMoreTha var createdException = new SomeException(); var actualException = Assert.Throws(Test); - Assert.AreSame(createdException, actualException); + Assert.That(actualException, Is.SameAs(createdException)); void Test() => diff --git a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/SingleOrAbsent.ReadOnlyList.cs b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/SingleOrAbsent.ReadOnlyList.cs index 025d4c49..e72b30f2 100644 --- a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/SingleOrAbsent.ReadOnlyList.cs +++ b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/SingleOrAbsent.ReadOnlyList.cs @@ -15,7 +15,7 @@ public void SingleOrAbsent_ReadOnlyListSourceIsNull_ExpectArgumentNullException( IReadOnlyList source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -30,7 +30,7 @@ public void SingleOrAbsent_ReadOnlyListSourceIsEmpty_ExpectAbsent() var actual = source.SingleOrAbsent(); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -43,7 +43,7 @@ public void SingleOrAbsent_ReadOnlyListSourceContainsOnlyOneElement_ExpectPresen var actual = source.SingleOrAbsent(); var expected = Optional.Present(singleItem); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -63,7 +63,7 @@ public void SingleOrAbsentWithExceptionFactory_ReadOnlyListSourceIsNull_ExpectAr IReadOnlyList source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -77,7 +77,7 @@ public void SingleOrAbsentWithExceptionFactory_ReadOnlyListExceptionFactoryIsNul Func exceptionFactory = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("moreThanOneElementExceptionFactory", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("moreThanOneElementExceptionFactory")); void Test() => @@ -92,7 +92,7 @@ public void SingleOrAbsentWithExceptionFactory_ReadOnlyListSourceIsEmpty_ExpectA var actual = source.SingleOrAbsent(CreateSomeException); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -105,7 +105,7 @@ public void SingleOrAbsentWithExceptionFactory_ReadOnlyListSourceContainsOnlyOne var actual = source.SingleOrAbsent(CreateSomeException); var expected = Optional.Present(singleItem); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -115,7 +115,7 @@ public void SingleOrAbsentWithExceptionFactory_ReadOnlyListSourceContainsMoreTha var createdException = new SomeException(); var ex = Assert.Throws(Test); - Assert.AreSame(createdException, ex); + Assert.That(ex, Is.SameAs(createdException)); void Test() => @@ -128,7 +128,7 @@ public void SingleOrAbsentByPredicate_ReadOnlyListSourceIsNull_ExpectArgumentNul IReadOnlyList source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -142,7 +142,7 @@ public void SingleOrAbsentByPredicate_ReadOnlyListPredicateIsNull_ExpectArgument Func predicate = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("predicate", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("predicate")); void Test() => @@ -157,7 +157,7 @@ public void SingleOrAbsentByPredicate_ReadOnlyListPredicateResultIsAlreadyFalse_ var actual = source.SingleOrAbsent(static _ => false); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -174,7 +174,7 @@ public void SingleOrAbsentByPredicate_ReadOnlyListPredicateResultIsTrueOnlyOnce_ var actual = source.SingleOrAbsent(item => expectedText.Equals(item?.Text, StringComparison.InvariantCultureIgnoreCase)); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -212,7 +212,7 @@ public void SingleOrAbsentByPredicateAndFactory_ReadOnlyListSourceIsNull_ExpectA IReadOnlyList source = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("source", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("source")); void Test() => @@ -226,7 +226,7 @@ public void SingleOrAbsentByPredicateAndFactory_ReadOnlyListPredicateIsNull_Expe Func predicate = null!; var ex = Assert.Throws(Test); - Assert.AreEqual("predicate", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("predicate")); void Test() => @@ -239,7 +239,7 @@ public void SingleOrAbsentByPredicateAndFactory_ReadOnlyListExceptionFactoryIsNu var source = CreateReadOnlyList(MinusFifteenIdRefType); var ex = Assert.Throws(Test); - Assert.AreEqual("moreThanOneMatchExceptionFactory", ex?.ParamName); + Assert.That(ex!.ParamName, Is.EqualTo("moreThanOneMatchExceptionFactory")); void Test() => @@ -254,7 +254,7 @@ public void SingleOrAbsentByPredicateAndFactory_ReadOnlyListPredicateResultIsAlr var actual = source.SingleOrAbsent(static _ => false, CreateSomeException); var expected = Optional.Absent; - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -272,7 +272,7 @@ public void SingleOrAbsentByPredicateAndFactory_ReadOnlyListPredicateResultIsTru var actual = source.SingleOrAbsent(item => expectedText.Equals(item?.Text, StringComparison.InvariantCultureIgnoreCase), CreateSomeException); var expected = Optional.Present(expectedValue); - Assert.AreEqual(expected, actual); + Assert.That(actual, Is.EqualTo(expected)); } [Test] @@ -296,7 +296,7 @@ public void SingleOrAbsentByPredicateAndFactory_ReadOnlyListPredicateResultIsTru var createdException = new SomeException(); var actualException = Assert.Throws(Test); - Assert.AreSame(createdException, actualException); + Assert.That(actualException, Is.SameAs(createdException)); void Test() => diff --git a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/TryGetValueOrAbsent.cs b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/TryGetValueOrAbsent.cs index cc0b9d5f..43e49a59 100644 --- a/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/TryGetValueOrAbsent.cs +++ b/src/core-taggeds-optional/Optional.Tests/OptionalLinqExtensions.Tests/TryGetValueOrAbsent.cs @@ -19,9 +19,8 @@ public void TryGetValueOrAbsent_ExpectIsObsolete() .Where(method => method.Name == nameof(OptionalLinqExtensions.TryGetValueOrAbsent)) .ToArray(); - Assert.AreEqual( - 1, - methods.Count( + Assert.That( + methods.Count( method => method.CustomAttributes.Any( attr @@ -35,6 +34,7 @@ public void TryGetValueOrAbsent_ExpectIsObsolete() attr.ConstructorArguments[0].ArgumentType == typeof(string) && attr.ConstructorArguments[0].Value is expectedObsoleteMessage && attr.ConstructorArguments[1].ArgumentType == typeof(bool) && - attr.ConstructorArguments[1].Value is true))); + attr.ConstructorArguments[1].Value is true)), + Is.EqualTo(1)); } }