diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithDefaultValues.DotNet10_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithDefaultValues.DotNet10_0.verified.txt new file mode 100644 index 0000000000..2789051204 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithDefaultValues.DotNet10_0.verified.txt @@ -0,0 +1,27 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for DefaultValuesAssertion. +/// +public static class DefaultValuesAssertionExtensions +{ + + /// + /// Extension method for DefaultValuesAssertion. + /// + public static DefaultValuesAssertion HasDefaultValues(this IAssertionSource source, bool boolValue = true, int intValue = 0, string stringValue = "default", [CallerArgumentExpression(nameof(boolValue))] string? boolValueExpression = null, [CallerArgumentExpression(nameof(intValue))] string? intValueExpression = null, [CallerArgumentExpression(nameof(stringValue))] string? stringValueExpression = null) + { + source.Context.ExpressionBuilder.Append($".HasDefaultValues({boolValueExpression}, {intValueExpression}, {stringValueExpression})"); + return new DefaultValuesAssertion(source.Context, boolValue, intValue, stringValue); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithDefaultValues.DotNet8_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithDefaultValues.DotNet8_0.verified.txt new file mode 100644 index 0000000000..2789051204 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithDefaultValues.DotNet8_0.verified.txt @@ -0,0 +1,27 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for DefaultValuesAssertion. +/// +public static class DefaultValuesAssertionExtensions +{ + + /// + /// Extension method for DefaultValuesAssertion. + /// + public static DefaultValuesAssertion HasDefaultValues(this IAssertionSource source, bool boolValue = true, int intValue = 0, string stringValue = "default", [CallerArgumentExpression(nameof(boolValue))] string? boolValueExpression = null, [CallerArgumentExpression(nameof(intValue))] string? intValueExpression = null, [CallerArgumentExpression(nameof(stringValue))] string? stringValueExpression = null) + { + source.Context.ExpressionBuilder.Append($".HasDefaultValues({boolValueExpression}, {intValueExpression}, {stringValueExpression})"); + return new DefaultValuesAssertion(source.Context, boolValue, intValue, stringValue); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithDefaultValues.DotNet9_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithDefaultValues.DotNet9_0.verified.txt new file mode 100644 index 0000000000..2789051204 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithDefaultValues.DotNet9_0.verified.txt @@ -0,0 +1,27 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for DefaultValuesAssertion. +/// +public static class DefaultValuesAssertionExtensions +{ + + /// + /// Extension method for DefaultValuesAssertion. + /// + public static DefaultValuesAssertion HasDefaultValues(this IAssertionSource source, bool boolValue = true, int intValue = 0, string stringValue = "default", [CallerArgumentExpression(nameof(boolValue))] string? boolValueExpression = null, [CallerArgumentExpression(nameof(intValue))] string? intValueExpression = null, [CallerArgumentExpression(nameof(stringValue))] string? stringValueExpression = null) + { + source.Context.ExpressionBuilder.Append($".HasDefaultValues({boolValueExpression}, {intValueExpression}, {stringValueExpression})"); + return new DefaultValuesAssertion(source.Context, boolValue, intValue, stringValue); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithDefaultValues.Net4_7.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithDefaultValues.Net4_7.verified.txt new file mode 100644 index 0000000000..2789051204 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithDefaultValues.Net4_7.verified.txt @@ -0,0 +1,27 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for DefaultValuesAssertion. +/// +public static class DefaultValuesAssertionExtensions +{ + + /// + /// Extension method for DefaultValuesAssertion. + /// + public static DefaultValuesAssertion HasDefaultValues(this IAssertionSource source, bool boolValue = true, int intValue = 0, string stringValue = "default", [CallerArgumentExpression(nameof(boolValue))] string? boolValueExpression = null, [CallerArgumentExpression(nameof(intValue))] string? intValueExpression = null, [CallerArgumentExpression(nameof(stringValue))] string? stringValueExpression = null) + { + source.Context.ExpressionBuilder.Append($".HasDefaultValues({boolValueExpression}, {intValueExpression}, {stringValueExpression})"); + return new DefaultValuesAssertion(source.Context, boolValue, intValue, stringValue); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithEnumDefault.DotNet10_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithEnumDefault.DotNet10_0.verified.txt new file mode 100644 index 0000000000..7feb94b908 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithEnumDefault.DotNet10_0.verified.txt @@ -0,0 +1,27 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for StringComparisonAssertion. +/// +public static class StringComparisonAssertionExtensions +{ + + /// + /// Extension method for StringComparisonAssertion. + /// + public static StringComparisonAssertion IsEqualToWithComparison(this IAssertionSource source, string expected, System.StringComparison comparison = System.StringComparison.4, [CallerArgumentExpression(nameof(expected))] string? expectedExpression = null, [CallerArgumentExpression(nameof(comparison))] string? comparisonExpression = null) + { + source.Context.ExpressionBuilder.Append($".IsEqualToWithComparison({expectedExpression}, {comparisonExpression})"); + return new StringComparisonAssertion(source.Context, expected, comparison); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithEnumDefault.DotNet8_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithEnumDefault.DotNet8_0.verified.txt new file mode 100644 index 0000000000..7feb94b908 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithEnumDefault.DotNet8_0.verified.txt @@ -0,0 +1,27 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for StringComparisonAssertion. +/// +public static class StringComparisonAssertionExtensions +{ + + /// + /// Extension method for StringComparisonAssertion. + /// + public static StringComparisonAssertion IsEqualToWithComparison(this IAssertionSource source, string expected, System.StringComparison comparison = System.StringComparison.4, [CallerArgumentExpression(nameof(expected))] string? expectedExpression = null, [CallerArgumentExpression(nameof(comparison))] string? comparisonExpression = null) + { + source.Context.ExpressionBuilder.Append($".IsEqualToWithComparison({expectedExpression}, {comparisonExpression})"); + return new StringComparisonAssertion(source.Context, expected, comparison); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithEnumDefault.DotNet9_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithEnumDefault.DotNet9_0.verified.txt new file mode 100644 index 0000000000..7feb94b908 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithEnumDefault.DotNet9_0.verified.txt @@ -0,0 +1,27 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for StringComparisonAssertion. +/// +public static class StringComparisonAssertionExtensions +{ + + /// + /// Extension method for StringComparisonAssertion. + /// + public static StringComparisonAssertion IsEqualToWithComparison(this IAssertionSource source, string expected, System.StringComparison comparison = System.StringComparison.4, [CallerArgumentExpression(nameof(expected))] string? expectedExpression = null, [CallerArgumentExpression(nameof(comparison))] string? comparisonExpression = null) + { + source.Context.ExpressionBuilder.Append($".IsEqualToWithComparison({expectedExpression}, {comparisonExpression})"); + return new StringComparisonAssertion(source.Context, expected, comparison); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithEnumDefault.Net4_7.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithEnumDefault.Net4_7.verified.txt new file mode 100644 index 0000000000..7feb94b908 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithEnumDefault.Net4_7.verified.txt @@ -0,0 +1,27 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for StringComparisonAssertion. +/// +public static class StringComparisonAssertionExtensions +{ + + /// + /// Extension method for StringComparisonAssertion. + /// + public static StringComparisonAssertion IsEqualToWithComparison(this IAssertionSource source, string expected, System.StringComparison comparison = System.StringComparison.4, [CallerArgumentExpression(nameof(expected))] string? expectedExpression = null, [CallerArgumentExpression(nameof(comparison))] string? comparisonExpression = null) + { + source.Context.ExpressionBuilder.Append($".IsEqualToWithComparison({expectedExpression}, {comparisonExpression})"); + return new StringComparisonAssertion(source.Context, expected, comparison); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithGenericConstraints.DotNet10_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithGenericConstraints.DotNet10_0.verified.txt new file mode 100644 index 0000000000..96d04a72e4 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithGenericConstraints.DotNet10_0.verified.txt @@ -0,0 +1,28 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for GreaterThanAssertion. +/// +public static class GreaterThanAssertionExtensions +{ + + /// + /// Extension method for GreaterThanAssertion. + /// + public static GreaterThanAssertion IsGreaterThan(this IAssertionSource source, TValue expected, [CallerArgumentExpression(nameof(expected))] string? expectedExpression = null) + where TValue : System.IComparable + { + source.Context.ExpressionBuilder.Append($".IsGreaterThan({expectedExpression})"); + return new GreaterThanAssertion(source.Context, expected); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithGenericConstraints.DotNet8_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithGenericConstraints.DotNet8_0.verified.txt new file mode 100644 index 0000000000..96d04a72e4 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithGenericConstraints.DotNet8_0.verified.txt @@ -0,0 +1,28 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for GreaterThanAssertion. +/// +public static class GreaterThanAssertionExtensions +{ + + /// + /// Extension method for GreaterThanAssertion. + /// + public static GreaterThanAssertion IsGreaterThan(this IAssertionSource source, TValue expected, [CallerArgumentExpression(nameof(expected))] string? expectedExpression = null) + where TValue : System.IComparable + { + source.Context.ExpressionBuilder.Append($".IsGreaterThan({expectedExpression})"); + return new GreaterThanAssertion(source.Context, expected); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithGenericConstraints.DotNet9_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithGenericConstraints.DotNet9_0.verified.txt new file mode 100644 index 0000000000..96d04a72e4 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithGenericConstraints.DotNet9_0.verified.txt @@ -0,0 +1,28 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for GreaterThanAssertion. +/// +public static class GreaterThanAssertionExtensions +{ + + /// + /// Extension method for GreaterThanAssertion. + /// + public static GreaterThanAssertion IsGreaterThan(this IAssertionSource source, TValue expected, [CallerArgumentExpression(nameof(expected))] string? expectedExpression = null) + where TValue : System.IComparable + { + source.Context.ExpressionBuilder.Append($".IsGreaterThan({expectedExpression})"); + return new GreaterThanAssertion(source.Context, expected); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithGenericConstraints.Net4_7.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithGenericConstraints.Net4_7.verified.txt new file mode 100644 index 0000000000..96d04a72e4 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithGenericConstraints.Net4_7.verified.txt @@ -0,0 +1,28 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for GreaterThanAssertion. +/// +public static class GreaterThanAssertionExtensions +{ + + /// + /// Extension method for GreaterThanAssertion. + /// + public static GreaterThanAssertion IsGreaterThan(this IAssertionSource source, TValue expected, [CallerArgumentExpression(nameof(expected))] string? expectedExpression = null) + where TValue : System.IComparable + { + source.Context.ExpressionBuilder.Append($".IsGreaterThan({expectedExpression})"); + return new GreaterThanAssertion(source.Context, expected); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithMultipleConstructors.DotNet10_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithMultipleConstructors.DotNet10_0.verified.txt new file mode 100644 index 0000000000..f43d45e395 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithMultipleConstructors.DotNet10_0.verified.txt @@ -0,0 +1,36 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for EqualsAssertion. +/// +public static class EqualsAssertionExtensions +{ + + /// + /// Extension method for EqualsAssertion. + /// + public static EqualsAssertion IsEqualTo(this IAssertionSource source, TValue expected, [CallerArgumentExpression(nameof(expected))] string? expectedExpression = null) + { + source.Context.ExpressionBuilder.Append($".IsEqualTo({expectedExpression})"); + return new EqualsAssertion(source.Context, expected); + } + + /// + /// Extension method for EqualsAssertion. + /// + public static EqualsAssertion IsEqualTo(this IAssertionSource source, TValue expected, System.Collections.Generic.IEqualityComparer comparer, [CallerArgumentExpression(nameof(expected))] string? expectedExpression = null, [CallerArgumentExpression(nameof(comparer))] string? comparerExpression = null) + { + source.Context.ExpressionBuilder.Append($".IsEqualTo({expectedExpression}, {comparerExpression})"); + return new EqualsAssertion(source.Context, expected, comparer); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithMultipleConstructors.DotNet8_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithMultipleConstructors.DotNet8_0.verified.txt new file mode 100644 index 0000000000..f43d45e395 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithMultipleConstructors.DotNet8_0.verified.txt @@ -0,0 +1,36 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for EqualsAssertion. +/// +public static class EqualsAssertionExtensions +{ + + /// + /// Extension method for EqualsAssertion. + /// + public static EqualsAssertion IsEqualTo(this IAssertionSource source, TValue expected, [CallerArgumentExpression(nameof(expected))] string? expectedExpression = null) + { + source.Context.ExpressionBuilder.Append($".IsEqualTo({expectedExpression})"); + return new EqualsAssertion(source.Context, expected); + } + + /// + /// Extension method for EqualsAssertion. + /// + public static EqualsAssertion IsEqualTo(this IAssertionSource source, TValue expected, System.Collections.Generic.IEqualityComparer comparer, [CallerArgumentExpression(nameof(expected))] string? expectedExpression = null, [CallerArgumentExpression(nameof(comparer))] string? comparerExpression = null) + { + source.Context.ExpressionBuilder.Append($".IsEqualTo({expectedExpression}, {comparerExpression})"); + return new EqualsAssertion(source.Context, expected, comparer); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithMultipleConstructors.DotNet9_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithMultipleConstructors.DotNet9_0.verified.txt new file mode 100644 index 0000000000..f43d45e395 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithMultipleConstructors.DotNet9_0.verified.txt @@ -0,0 +1,36 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for EqualsAssertion. +/// +public static class EqualsAssertionExtensions +{ + + /// + /// Extension method for EqualsAssertion. + /// + public static EqualsAssertion IsEqualTo(this IAssertionSource source, TValue expected, [CallerArgumentExpression(nameof(expected))] string? expectedExpression = null) + { + source.Context.ExpressionBuilder.Append($".IsEqualTo({expectedExpression})"); + return new EqualsAssertion(source.Context, expected); + } + + /// + /// Extension method for EqualsAssertion. + /// + public static EqualsAssertion IsEqualTo(this IAssertionSource source, TValue expected, System.Collections.Generic.IEqualityComparer comparer, [CallerArgumentExpression(nameof(expected))] string? expectedExpression = null, [CallerArgumentExpression(nameof(comparer))] string? comparerExpression = null) + { + source.Context.ExpressionBuilder.Append($".IsEqualTo({expectedExpression}, {comparerExpression})"); + return new EqualsAssertion(source.Context, expected, comparer); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithMultipleConstructors.Net4_7.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithMultipleConstructors.Net4_7.verified.txt new file mode 100644 index 0000000000..f43d45e395 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithMultipleConstructors.Net4_7.verified.txt @@ -0,0 +1,36 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for EqualsAssertion. +/// +public static class EqualsAssertionExtensions +{ + + /// + /// Extension method for EqualsAssertion. + /// + public static EqualsAssertion IsEqualTo(this IAssertionSource source, TValue expected, [CallerArgumentExpression(nameof(expected))] string? expectedExpression = null) + { + source.Context.ExpressionBuilder.Append($".IsEqualTo({expectedExpression})"); + return new EqualsAssertion(source.Context, expected); + } + + /// + /// Extension method for EqualsAssertion. + /// + public static EqualsAssertion IsEqualTo(this IAssertionSource source, TValue expected, System.Collections.Generic.IEqualityComparer comparer, [CallerArgumentExpression(nameof(expected))] string? expectedExpression = null, [CallerArgumentExpression(nameof(comparer))] string? comparerExpression = null) + { + source.Context.ExpressionBuilder.Append($".IsEqualTo({expectedExpression}, {comparerExpression})"); + return new EqualsAssertion(source.Context, expected, comparer); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithMultipleParameters.DotNet10_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithMultipleParameters.DotNet10_0.verified.txt new file mode 100644 index 0000000000..fd7d9c4ade --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithMultipleParameters.DotNet10_0.verified.txt @@ -0,0 +1,28 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for BetweenAssertion. +/// +public static class BetweenAssertionExtensions +{ + + /// + /// Extension method for BetweenAssertion. + /// + public static BetweenAssertion IsBetween(this IAssertionSource source, TValue lowerBound, TValue upperBound, [CallerArgumentExpression(nameof(lowerBound))] string? lowerBoundExpression = null, [CallerArgumentExpression(nameof(upperBound))] string? upperBoundExpression = null) + where TValue : System.IComparable + { + source.Context.ExpressionBuilder.Append($".IsBetween({lowerBoundExpression}, {upperBoundExpression})"); + return new BetweenAssertion(source.Context, lowerBound, upperBound); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithMultipleParameters.DotNet8_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithMultipleParameters.DotNet8_0.verified.txt new file mode 100644 index 0000000000..fd7d9c4ade --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithMultipleParameters.DotNet8_0.verified.txt @@ -0,0 +1,28 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for BetweenAssertion. +/// +public static class BetweenAssertionExtensions +{ + + /// + /// Extension method for BetweenAssertion. + /// + public static BetweenAssertion IsBetween(this IAssertionSource source, TValue lowerBound, TValue upperBound, [CallerArgumentExpression(nameof(lowerBound))] string? lowerBoundExpression = null, [CallerArgumentExpression(nameof(upperBound))] string? upperBoundExpression = null) + where TValue : System.IComparable + { + source.Context.ExpressionBuilder.Append($".IsBetween({lowerBoundExpression}, {upperBoundExpression})"); + return new BetweenAssertion(source.Context, lowerBound, upperBound); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithMultipleParameters.DotNet9_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithMultipleParameters.DotNet9_0.verified.txt new file mode 100644 index 0000000000..fd7d9c4ade --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithMultipleParameters.DotNet9_0.verified.txt @@ -0,0 +1,28 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for BetweenAssertion. +/// +public static class BetweenAssertionExtensions +{ + + /// + /// Extension method for BetweenAssertion. + /// + public static BetweenAssertion IsBetween(this IAssertionSource source, TValue lowerBound, TValue upperBound, [CallerArgumentExpression(nameof(lowerBound))] string? lowerBoundExpression = null, [CallerArgumentExpression(nameof(upperBound))] string? upperBoundExpression = null) + where TValue : System.IComparable + { + source.Context.ExpressionBuilder.Append($".IsBetween({lowerBoundExpression}, {upperBoundExpression})"); + return new BetweenAssertion(source.Context, lowerBound, upperBound); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithMultipleParameters.Net4_7.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithMultipleParameters.Net4_7.verified.txt new file mode 100644 index 0000000000..fd7d9c4ade --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithMultipleParameters.Net4_7.verified.txt @@ -0,0 +1,28 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for BetweenAssertion. +/// +public static class BetweenAssertionExtensions +{ + + /// + /// Extension method for BetweenAssertion. + /// + public static BetweenAssertion IsBetween(this IAssertionSource source, TValue lowerBound, TValue upperBound, [CallerArgumentExpression(nameof(lowerBound))] string? lowerBoundExpression = null, [CallerArgumentExpression(nameof(upperBound))] string? upperBoundExpression = null) + where TValue : System.IComparable + { + source.Context.ExpressionBuilder.Append($".IsBetween({lowerBoundExpression}, {upperBoundExpression})"); + return new BetweenAssertion(source.Context, lowerBound, upperBound); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithNegatedMethod.DotNet10_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithNegatedMethod.DotNet10_0.verified.txt new file mode 100644 index 0000000000..74801947d8 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithNegatedMethod.DotNet10_0.verified.txt @@ -0,0 +1,36 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for TrueAssertion. +/// +public static class TrueAssertionExtensions +{ + + /// + /// Extension method for TrueAssertion. + /// + public static TrueAssertion IsTrue(this IAssertionSource source) + { + source.Context.ExpressionBuilder.Append($".IsTrue()"); + return new TrueAssertion(source.Context); + } + + /// + /// Extension method for TrueAssertion. + /// + public static TrueAssertion IsFalse(this IAssertionSource source) + { + source.Context.ExpressionBuilder.Append($".IsFalse()"); + return new TrueAssertion(source.Context); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithNegatedMethod.DotNet8_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithNegatedMethod.DotNet8_0.verified.txt new file mode 100644 index 0000000000..74801947d8 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithNegatedMethod.DotNet8_0.verified.txt @@ -0,0 +1,36 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for TrueAssertion. +/// +public static class TrueAssertionExtensions +{ + + /// + /// Extension method for TrueAssertion. + /// + public static TrueAssertion IsTrue(this IAssertionSource source) + { + source.Context.ExpressionBuilder.Append($".IsTrue()"); + return new TrueAssertion(source.Context); + } + + /// + /// Extension method for TrueAssertion. + /// + public static TrueAssertion IsFalse(this IAssertionSource source) + { + source.Context.ExpressionBuilder.Append($".IsFalse()"); + return new TrueAssertion(source.Context); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithNegatedMethod.DotNet9_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithNegatedMethod.DotNet9_0.verified.txt new file mode 100644 index 0000000000..74801947d8 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithNegatedMethod.DotNet9_0.verified.txt @@ -0,0 +1,36 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for TrueAssertion. +/// +public static class TrueAssertionExtensions +{ + + /// + /// Extension method for TrueAssertion. + /// + public static TrueAssertion IsTrue(this IAssertionSource source) + { + source.Context.ExpressionBuilder.Append($".IsTrue()"); + return new TrueAssertion(source.Context); + } + + /// + /// Extension method for TrueAssertion. + /// + public static TrueAssertion IsFalse(this IAssertionSource source) + { + source.Context.ExpressionBuilder.Append($".IsFalse()"); + return new TrueAssertion(source.Context); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithNegatedMethod.Net4_7.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithNegatedMethod.Net4_7.verified.txt new file mode 100644 index 0000000000..74801947d8 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithNegatedMethod.Net4_7.verified.txt @@ -0,0 +1,36 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for TrueAssertion. +/// +public static class TrueAssertionExtensions +{ + + /// + /// Extension method for TrueAssertion. + /// + public static TrueAssertion IsTrue(this IAssertionSource source) + { + source.Context.ExpressionBuilder.Append($".IsTrue()"); + return new TrueAssertion(source.Context); + } + + /// + /// Extension method for TrueAssertion. + /// + public static TrueAssertion IsFalse(this IAssertionSource source) + { + source.Context.ExpressionBuilder.Append($".IsFalse()"); + return new TrueAssertion(source.Context); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithOptionalParameter.DotNet10_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithOptionalParameter.DotNet10_0.verified.txt new file mode 100644 index 0000000000..38721800fe --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithOptionalParameter.DotNet10_0.verified.txt @@ -0,0 +1,27 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for NotEqualsAssertion. +/// +public static class NotEqualsAssertionExtensions +{ + + /// + /// Extension method for NotEqualsAssertion. + /// + public static NotEqualsAssertion IsNotEqualTo(this IAssertionSource source, TValue notExpected, System.Collections.Generic.IEqualityComparer? comparer = null, [CallerArgumentExpression(nameof(notExpected))] string? notExpectedExpression = null, [CallerArgumentExpression(nameof(comparer))] string? comparerExpression = null) + { + source.Context.ExpressionBuilder.Append($".IsNotEqualTo({notExpectedExpression}, {comparerExpression})"); + return new NotEqualsAssertion(source.Context, notExpected, comparer); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithOptionalParameter.DotNet8_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithOptionalParameter.DotNet8_0.verified.txt new file mode 100644 index 0000000000..38721800fe --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithOptionalParameter.DotNet8_0.verified.txt @@ -0,0 +1,27 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for NotEqualsAssertion. +/// +public static class NotEqualsAssertionExtensions +{ + + /// + /// Extension method for NotEqualsAssertion. + /// + public static NotEqualsAssertion IsNotEqualTo(this IAssertionSource source, TValue notExpected, System.Collections.Generic.IEqualityComparer? comparer = null, [CallerArgumentExpression(nameof(notExpected))] string? notExpectedExpression = null, [CallerArgumentExpression(nameof(comparer))] string? comparerExpression = null) + { + source.Context.ExpressionBuilder.Append($".IsNotEqualTo({notExpectedExpression}, {comparerExpression})"); + return new NotEqualsAssertion(source.Context, notExpected, comparer); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithOptionalParameter.DotNet9_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithOptionalParameter.DotNet9_0.verified.txt new file mode 100644 index 0000000000..38721800fe --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithOptionalParameter.DotNet9_0.verified.txt @@ -0,0 +1,27 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for NotEqualsAssertion. +/// +public static class NotEqualsAssertionExtensions +{ + + /// + /// Extension method for NotEqualsAssertion. + /// + public static NotEqualsAssertion IsNotEqualTo(this IAssertionSource source, TValue notExpected, System.Collections.Generic.IEqualityComparer? comparer = null, [CallerArgumentExpression(nameof(notExpected))] string? notExpectedExpression = null, [CallerArgumentExpression(nameof(comparer))] string? comparerExpression = null) + { + source.Context.ExpressionBuilder.Append($".IsNotEqualTo({notExpectedExpression}, {comparerExpression})"); + return new NotEqualsAssertion(source.Context, notExpected, comparer); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithOptionalParameter.Net4_7.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithOptionalParameter.Net4_7.verified.txt new file mode 100644 index 0000000000..38721800fe --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.AssertionWithOptionalParameter.Net4_7.verified.txt @@ -0,0 +1,27 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for NotEqualsAssertion. +/// +public static class NotEqualsAssertionExtensions +{ + + /// + /// Extension method for NotEqualsAssertion. + /// + public static NotEqualsAssertion IsNotEqualTo(this IAssertionSource source, TValue notExpected, System.Collections.Generic.IEqualityComparer? comparer = null, [CallerArgumentExpression(nameof(notExpected))] string? notExpectedExpression = null, [CallerArgumentExpression(nameof(comparer))] string? comparerExpression = null) + { + source.Context.ExpressionBuilder.Append($".IsNotEqualTo({notExpectedExpression}, {comparerExpression})"); + return new NotEqualsAssertion(source.Context, notExpected, comparer); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.MultipleGenericParameters.DotNet10_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.MultipleGenericParameters.DotNet10_0.verified.txt new file mode 100644 index 0000000000..0e082051dd --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.MultipleGenericParameters.DotNet10_0.verified.txt @@ -0,0 +1,27 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for IsAssignableToAssertion. +/// +public static class IsAssignableToAssertionExtensions +{ + + /// + /// Extension method for IsAssignableToAssertion. + /// + public static IsAssignableToAssertion IsAssignableTo(this IAssertionSource source) + { + source.Context.ExpressionBuilder.Append($".IsAssignableTo()"); + return new IsAssignableToAssertion(source.Context); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.MultipleGenericParameters.DotNet8_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.MultipleGenericParameters.DotNet8_0.verified.txt new file mode 100644 index 0000000000..0e082051dd --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.MultipleGenericParameters.DotNet8_0.verified.txt @@ -0,0 +1,27 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for IsAssignableToAssertion. +/// +public static class IsAssignableToAssertionExtensions +{ + + /// + /// Extension method for IsAssignableToAssertion. + /// + public static IsAssignableToAssertion IsAssignableTo(this IAssertionSource source) + { + source.Context.ExpressionBuilder.Append($".IsAssignableTo()"); + return new IsAssignableToAssertion(source.Context); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.MultipleGenericParameters.DotNet9_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.MultipleGenericParameters.DotNet9_0.verified.txt new file mode 100644 index 0000000000..0e082051dd --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.MultipleGenericParameters.DotNet9_0.verified.txt @@ -0,0 +1,27 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for IsAssignableToAssertion. +/// +public static class IsAssignableToAssertionExtensions +{ + + /// + /// Extension method for IsAssignableToAssertion. + /// + public static IsAssignableToAssertion IsAssignableTo(this IAssertionSource source) + { + source.Context.ExpressionBuilder.Append($".IsAssignableTo()"); + return new IsAssignableToAssertion(source.Context); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.MultipleGenericParameters.Net4_7.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.MultipleGenericParameters.Net4_7.verified.txt new file mode 100644 index 0000000000..0e082051dd --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.MultipleGenericParameters.Net4_7.verified.txt @@ -0,0 +1,27 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for IsAssignableToAssertion. +/// +public static class IsAssignableToAssertionExtensions +{ + + /// + /// Extension method for IsAssignableToAssertion. + /// + public static IsAssignableToAssertion IsAssignableTo(this IAssertionSource source) + { + source.Context.ExpressionBuilder.Append($".IsAssignableTo()"); + return new IsAssignableToAssertion(source.Context); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.NonGenericAssertion.DotNet10_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.NonGenericAssertion.DotNet10_0.verified.txt new file mode 100644 index 0000000000..5a77024fe7 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.NonGenericAssertion.DotNet10_0.verified.txt @@ -0,0 +1,27 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for StringIsEmptyAssertion. +/// +public static class StringIsEmptyAssertionExtensions +{ + + /// + /// Extension method for StringIsEmptyAssertion. + /// + public static StringIsEmptyAssertion IsEmpty(this IAssertionSource source) + { + source.Context.ExpressionBuilder.Append($".IsEmpty()"); + return new StringIsEmptyAssertion(source.Context); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.NonGenericAssertion.DotNet8_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.NonGenericAssertion.DotNet8_0.verified.txt new file mode 100644 index 0000000000..5a77024fe7 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.NonGenericAssertion.DotNet8_0.verified.txt @@ -0,0 +1,27 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for StringIsEmptyAssertion. +/// +public static class StringIsEmptyAssertionExtensions +{ + + /// + /// Extension method for StringIsEmptyAssertion. + /// + public static StringIsEmptyAssertion IsEmpty(this IAssertionSource source) + { + source.Context.ExpressionBuilder.Append($".IsEmpty()"); + return new StringIsEmptyAssertion(source.Context); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.NonGenericAssertion.DotNet9_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.NonGenericAssertion.DotNet9_0.verified.txt new file mode 100644 index 0000000000..5a77024fe7 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.NonGenericAssertion.DotNet9_0.verified.txt @@ -0,0 +1,27 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for StringIsEmptyAssertion. +/// +public static class StringIsEmptyAssertionExtensions +{ + + /// + /// Extension method for StringIsEmptyAssertion. + /// + public static StringIsEmptyAssertion IsEmpty(this IAssertionSource source) + { + source.Context.ExpressionBuilder.Append($".IsEmpty()"); + return new StringIsEmptyAssertion(source.Context); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.NonGenericAssertion.Net4_7.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.NonGenericAssertion.Net4_7.verified.txt new file mode 100644 index 0000000000..5a77024fe7 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.NonGenericAssertion.Net4_7.verified.txt @@ -0,0 +1,27 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for StringIsEmptyAssertion. +/// +public static class StringIsEmptyAssertionExtensions +{ + + /// + /// Extension method for StringIsEmptyAssertion. + /// + public static StringIsEmptyAssertion IsEmpty(this IAssertionSource source) + { + source.Context.ExpressionBuilder.Append($".IsEmpty()"); + return new StringIsEmptyAssertion(source.Context); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.SingleGenericParameter.DotNet10_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.SingleGenericParameter.DotNet10_0.verified.txt new file mode 100644 index 0000000000..110bb7c5c0 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.SingleGenericParameter.DotNet10_0.verified.txt @@ -0,0 +1,27 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for NullAssertion. +/// +public static class NullAssertionExtensions +{ + + /// + /// Extension method for NullAssertion. + /// + public static NullAssertion IsNull(this IAssertionSource source) + { + source.Context.ExpressionBuilder.Append($".IsNull()"); + return new NullAssertion(source.Context); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.SingleGenericParameter.DotNet8_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.SingleGenericParameter.DotNet8_0.verified.txt new file mode 100644 index 0000000000..110bb7c5c0 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.SingleGenericParameter.DotNet8_0.verified.txt @@ -0,0 +1,27 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for NullAssertion. +/// +public static class NullAssertionExtensions +{ + + /// + /// Extension method for NullAssertion. + /// + public static NullAssertion IsNull(this IAssertionSource source) + { + source.Context.ExpressionBuilder.Append($".IsNull()"); + return new NullAssertion(source.Context); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.SingleGenericParameter.DotNet9_0.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.SingleGenericParameter.DotNet9_0.verified.txt new file mode 100644 index 0000000000..110bb7c5c0 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.SingleGenericParameter.DotNet9_0.verified.txt @@ -0,0 +1,27 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for NullAssertion. +/// +public static class NullAssertionExtensions +{ + + /// + /// Extension method for NullAssertion. + /// + public static NullAssertion IsNull(this IAssertionSource source) + { + source.Context.ExpressionBuilder.Append($".IsNull()"); + return new NullAssertion(source.Context); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.SingleGenericParameter.Net4_7.verified.txt b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.SingleGenericParameter.Net4_7.verified.txt new file mode 100644 index 0000000000..110bb7c5c0 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.SingleGenericParameter.Net4_7.verified.txt @@ -0,0 +1,27 @@ +[ +#nullable enable + +using System; +using System.Runtime.CompilerServices; +using TUnit.Assertions.Core; +using TUnit.Assertions.Tests.TestData; + +namespace TUnit.Assertions.Extensions; + +/// +/// Generated extension methods for NullAssertion. +/// +public static class NullAssertionExtensions +{ + + /// + /// Extension method for NullAssertion. + /// + public static NullAssertion IsNull(this IAssertionSource source) + { + source.Context.ExpressionBuilder.Append($".IsNull()"); + return new NullAssertion(source.Context); + } +} + +] \ No newline at end of file diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.cs b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.cs new file mode 100644 index 0000000000..dafa3112b1 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/AssertionExtensionGeneratorTests.cs @@ -0,0 +1,139 @@ +using TUnit.Assertions.SourceGenerator.Generators; +using TUnit.Assertions.SourceGenerator.Tests.Options; + +namespace TUnit.Assertions.SourceGenerator.Tests; + +internal class AssertionExtensionGeneratorTests : TestsBase +{ + [Test] + public Task NonGenericAssertion() => RunTest( + Path.Combine(Sourcy.Git.RootDirectory.FullName, + "TUnit.Assertions.SourceGenerator.Tests", + "TestData", + "NonGenericAssertion.cs"), + async generatedFiles => + { + await Assert.That(generatedFiles).HasCount().GreaterThanOrEqualTo(1); + await Assert.That(generatedFiles[0]).Contains("IsEmpty"); + }); + + [Test] + public Task SingleGenericParameter() => RunTest( + Path.Combine(Sourcy.Git.RootDirectory.FullName, + "TUnit.Assertions.SourceGenerator.Tests", + "TestData", + "SingleGenericParameterAssertion.cs"), + async generatedFiles => + { + await Assert.That(generatedFiles).HasCount().GreaterThanOrEqualTo(1); + await Assert.That(generatedFiles[0]).Contains("IsNull"); + await Assert.That(generatedFiles[0]).Contains(""); + }); + + [Test] + public Task MultipleGenericParameters() => RunTest( + Path.Combine(Sourcy.Git.RootDirectory.FullName, + "TUnit.Assertions.SourceGenerator.Tests", + "TestData", + "MultipleGenericParametersAssertion.cs"), + async generatedFiles => + { + await Assert.That(generatedFiles).HasCount().GreaterThanOrEqualTo(1); + await Assert.That(generatedFiles[0]).Contains("IsAssignableTo"); + await Assert.That(generatedFiles[0]).Contains(""); + }); + + [Test] + public Task AssertionWithOptionalParameter() => RunTest( + Path.Combine(Sourcy.Git.RootDirectory.FullName, + "TUnit.Assertions.SourceGenerator.Tests", + "TestData", + "OptionalParameterAssertion.cs"), + async generatedFiles => + { + await Assert.That(generatedFiles).HasCount().GreaterThanOrEqualTo(1); + await Assert.That(generatedFiles[0]).Contains("IsNotEqualTo"); + await Assert.That(generatedFiles[0]).Contains("= null"); + }); + + [Test] + public Task AssertionWithGenericConstraints() => RunTest( + Path.Combine(Sourcy.Git.RootDirectory.FullName, + "TUnit.Assertions.SourceGenerator.Tests", + "TestData", + "GenericConstraintsAssertion.cs"), + async generatedFiles => + { + await Assert.That(generatedFiles).HasCount().GreaterThanOrEqualTo(1); + await Assert.That(generatedFiles[0]).Contains("IsGreaterThan"); + await Assert.That(generatedFiles[0]).Contains("where TValue : System.IComparable"); + }); + + [Test] + public Task AssertionWithMultipleConstructors() => RunTest( + Path.Combine(Sourcy.Git.RootDirectory.FullName, + "TUnit.Assertions.SourceGenerator.Tests", + "TestData", + "MultipleConstructorsAssertion.cs"), + async generatedFiles => + { + await Assert.That(generatedFiles).HasCount().GreaterThanOrEqualTo(1); + // Should generate multiple overloads + var containsCount = System.Text.RegularExpressions.Regex.Matches(generatedFiles[0], "public static.*IsEqualTo").Count; + await Assert.That(containsCount).IsGreaterThan(1); + }); + + [Test] + public Task AssertionWithNegatedMethod() => RunTest( + Path.Combine(Sourcy.Git.RootDirectory.FullName, + "TUnit.Assertions.SourceGenerator.Tests", + "TestData", + "NegatedMethodAssertion.cs"), + async generatedFiles => + { + await Assert.That(generatedFiles).HasCount().GreaterThanOrEqualTo(1); + await Assert.That(generatedFiles[0]).Contains("IsTrue"); + await Assert.That(generatedFiles[0]).Contains("IsFalse"); + }); + + [Test] + public Task AssertionWithDefaultValues() => RunTest( + Path.Combine(Sourcy.Git.RootDirectory.FullName, + "TUnit.Assertions.SourceGenerator.Tests", + "TestData", + "DefaultValuesAssertion.cs"), + async generatedFiles => + { + await Assert.That(generatedFiles).HasCount().GreaterThanOrEqualTo(1); + await Assert.That(generatedFiles[0]).Contains("= true"); + await Assert.That(generatedFiles[0]).Contains("= 0"); + await Assert.That(generatedFiles[0]).Contains("= \"default\""); + }); + + [Test] + public Task AssertionWithEnumDefault() => RunTest( + Path.Combine(Sourcy.Git.RootDirectory.FullName, + "TUnit.Assertions.SourceGenerator.Tests", + "TestData", + "EnumDefaultAssertion.cs"), + async generatedFiles => + { + await Assert.That(generatedFiles).HasCount().GreaterThanOrEqualTo(1); + await Assert.That(generatedFiles[0]).Contains("StringComparison."); + }); + + [Test] + public Task AssertionWithMultipleParameters() => RunTest( + Path.Combine(Sourcy.Git.RootDirectory.FullName, + "TUnit.Assertions.SourceGenerator.Tests", + "TestData", + "MultipleParametersAssertion.cs"), + async generatedFiles => + { + await Assert.That(generatedFiles).HasCount().GreaterThanOrEqualTo(1); + await Assert.That(generatedFiles[0]).Contains("IsBetween"); + // Should have CallerArgumentExpression for both parameters + var callerExprCount = System.Text.RegularExpressions.Regex.Matches(generatedFiles[0], "CallerArgumentExpression").Count; + await Assert.That(callerExprCount).IsGreaterThanOrEqualTo(2); + }); +} diff --git a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.cs b/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.cs deleted file mode 100644 index 1dedcdde02..0000000000 --- a/TUnit.Assertions.SourceGenerator.Tests/AssertionMethodGeneratorTests.cs +++ /dev/null @@ -1,41 +0,0 @@ -using TUnit.Assertions.SourceGenerator.Generators; - -namespace TUnit.Assertions.SourceGenerator.Tests; - -internal class AssertionMethodGeneratorTests : TestsBase -{ - [Test] - public Task GeneratesCharAssertions() => RunTest(Path.Combine(Sourcy.Git.RootDirectory.FullName, - "TUnit.Assertions", - "Assertions", - "CharAssertionExtensions.cs"), - _ => Task.CompletedTask); - - [Test] - public Task GeneratesEnumAssertions() => RunTest(Path.Combine(Sourcy.Git.RootDirectory.FullName, - "TUnit.Assertions", - "Assertions", - "EnumAssertionExtensions.cs"), - _ => Task.CompletedTask); - - [Test] - public Task GeneratesPathAssertions() => RunTest(Path.Combine(Sourcy.Git.RootDirectory.FullName, - "TUnit.Assertions", - "Assertions", - "PathAssertionExtensions.cs"), - _ => Task.CompletedTask); - - [Test] - public Task GeneratesStringAssertions() => RunTest(Path.Combine(Sourcy.Git.RootDirectory.FullName, - "TUnit.Assertions", - "Assertions", - "StringAssertionExtensions.cs"), - _ => Task.CompletedTask); - - [Test] - public Task GeneratesUriAssertions() => RunTest(Path.Combine(Sourcy.Git.RootDirectory.FullName, - "TUnit.Assertions", - "Assertions", - "UriAssertionExtensions.cs"), - _ => Task.CompletedTask); -} diff --git a/TUnit.Assertions.SourceGenerator.Tests/TestData/DefaultValuesAssertion.cs b/TUnit.Assertions.SourceGenerator.Tests/TestData/DefaultValuesAssertion.cs new file mode 100644 index 0000000000..9c94d5f792 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/TestData/DefaultValuesAssertion.cs @@ -0,0 +1,35 @@ +using TUnit.Assertions.Attributes; +using TUnit.Assertions.Core; + +namespace TUnit.Assertions.Tests.TestData; + +/// +/// Test case: Assertion with various default parameter values +/// Should generate extension method with properly formatted defaults +/// +[AssertionExtension("HasDefaultValues")] +public class DefaultValuesAssertion : Assertion +{ + private readonly bool _boolValue; + private readonly int _intValue; + private readonly string _stringValue; + + public DefaultValuesAssertion( + AssertionContext context, + bool boolValue = true, + int intValue = 0, + string stringValue = "default") + : base(context) + { + _boolValue = boolValue; + _intValue = intValue; + _stringValue = stringValue; + } + + protected override Task CheckAsync(EvaluationMetadata metadata) + { + return Task.FromResult(AssertionResult.Passed); + } + + protected override string GetExpectation() => "to have default values"; +} diff --git a/TUnit.Assertions.SourceGenerator.Tests/TestData/EnumDefaultAssertion.cs b/TUnit.Assertions.SourceGenerator.Tests/TestData/EnumDefaultAssertion.cs new file mode 100644 index 0000000000..75103aa034 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/TestData/EnumDefaultAssertion.cs @@ -0,0 +1,39 @@ +using TUnit.Assertions.Attributes; +using TUnit.Assertions.Core; + +namespace TUnit.Assertions.Tests.TestData; + +/// +/// Test case: Assertion with enum default parameter +/// Should generate extension method with properly formatted enum default +/// +[AssertionExtension("IsEqualToWithComparison")] +public class StringComparisonAssertion : Assertion +{ + private readonly string _expected; + private readonly StringComparison _comparison; + + public StringComparisonAssertion( + AssertionContext context, + string expected, + StringComparison comparison = StringComparison.Ordinal) + : base(context) + { + _expected = expected; + _comparison = comparison; + } + + protected override Task CheckAsync(EvaluationMetadata metadata) + { + var value = metadata.Value; + + if (string.Equals(value, _expected, _comparison)) + { + return Task.FromResult(AssertionResult.Passed); + } + + return Task.FromResult(AssertionResult.Failed($"'{value}' does not equal '{_expected}' with {_comparison}")); + } + + protected override string GetExpectation() => $"to equal '{_expected}' with {_comparison}"; +} diff --git a/TUnit.Assertions.SourceGenerator.Tests/TestData/GenericConstraintsAssertion.cs b/TUnit.Assertions.SourceGenerator.Tests/TestData/GenericConstraintsAssertion.cs new file mode 100644 index 0000000000..47282ef311 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/TestData/GenericConstraintsAssertion.cs @@ -0,0 +1,42 @@ +using TUnit.Assertions.Attributes; +using TUnit.Assertions.Core; + +namespace TUnit.Assertions.Tests.TestData; + +/// +/// Test case: Assertion with generic constraint +/// Should generate extension method preserving the IComparable constraint +/// +[AssertionExtension("IsGreaterThan")] +public class GreaterThanAssertion : Assertion + where TValue : IComparable +{ + private readonly TValue _expected; + + public GreaterThanAssertion( + AssertionContext context, + TValue expected) + : base(context) + { + _expected = expected; + } + + protected override Task CheckAsync(EvaluationMetadata metadata) + { + var value = metadata.Value; + + if (value == null) + { + return Task.FromResult(AssertionResult.Failed("value was null")); + } + + if (value.CompareTo(_expected) > 0) + { + return Task.FromResult(AssertionResult.Passed); + } + + return Task.FromResult(AssertionResult.Failed($"value {value} was not greater than {_expected}")); + } + + protected override string GetExpectation() => $"to be greater than {_expected}"; +} diff --git a/TUnit.Assertions.SourceGenerator.Tests/TestData/MultipleConstructorsAssertion.cs b/TUnit.Assertions.SourceGenerator.Tests/TestData/MultipleConstructorsAssertion.cs new file mode 100644 index 0000000000..67138cd2c0 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/TestData/MultipleConstructorsAssertion.cs @@ -0,0 +1,51 @@ +using TUnit.Assertions.Attributes; +using TUnit.Assertions.Core; + +namespace TUnit.Assertions.Tests.TestData; + +/// +/// Test case: Assertion with multiple constructors +/// Should generate multiple extension method overloads +/// +[AssertionExtension("IsEqualTo")] +public class EqualsAssertion : Assertion +{ + private readonly TValue _expected; + private readonly IEqualityComparer? _comparer; + + // Constructor 1: Just expected value + public EqualsAssertion( + AssertionContext context, + TValue expected) + : base(context) + { + _expected = expected; + _comparer = null; + } + + // Constructor 2: Expected value with comparer + public EqualsAssertion( + AssertionContext context, + TValue expected, + IEqualityComparer comparer) + : base(context) + { + _expected = expected; + _comparer = comparer; + } + + protected override Task CheckAsync(EvaluationMetadata metadata) + { + var value = metadata.Value; + var comparer = _comparer ?? EqualityComparer.Default; + + if (comparer.Equals(value!, _expected)) + { + return Task.FromResult(AssertionResult.Passed); + } + + return Task.FromResult(AssertionResult.Failed($"found {value}")); + } + + protected override string GetExpectation() => $"to be equal to {_expected}"; +} diff --git a/TUnit.Assertions.SourceGenerator.Tests/TestData/MultipleGenericParametersAssertion.cs b/TUnit.Assertions.SourceGenerator.Tests/TestData/MultipleGenericParametersAssertion.cs new file mode 100644 index 0000000000..97e98510de --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/TestData/MultipleGenericParametersAssertion.cs @@ -0,0 +1,41 @@ +using TUnit.Assertions.Attributes; +using TUnit.Assertions.Core; + +namespace TUnit.Assertions.Tests.TestData; + +/// +/// Test case: Multiple generic parameters assertion +/// Should generate extension method with two generic type parameters +/// +[AssertionExtension("IsAssignableTo")] +public class IsAssignableToAssertion : Assertion +{ + private readonly Type _targetType; + + public IsAssignableToAssertion(AssertionContext context) + : base(context) + { + _targetType = typeof(TTarget); + } + + protected override Task CheckAsync(EvaluationMetadata metadata) + { + var value = metadata.Value; + + if (value == null) + { + return Task.FromResult(AssertionResult.Failed("value was null")); + } + + var actualType = value.GetType(); + + if (_targetType.IsAssignableFrom(actualType)) + { + return Task.FromResult(AssertionResult.Passed); + } + + return Task.FromResult(AssertionResult.Failed($"type {actualType.Name} is not assignable to {_targetType.Name}")); + } + + protected override string GetExpectation() => $"to be assignable to {_targetType.Name}"; +} diff --git a/TUnit.Assertions.SourceGenerator.Tests/TestData/MultipleParametersAssertion.cs b/TUnit.Assertions.SourceGenerator.Tests/TestData/MultipleParametersAssertion.cs new file mode 100644 index 0000000000..09c22d3cd8 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/TestData/MultipleParametersAssertion.cs @@ -0,0 +1,45 @@ +using TUnit.Assertions.Attributes; +using TUnit.Assertions.Core; + +namespace TUnit.Assertions.Tests.TestData; + +/// +/// Test case: Assertion with multiple parameters +/// Should generate extension method with CallerArgumentExpression for all parameters +/// +[AssertionExtension("IsBetween")] +public class BetweenAssertion : Assertion + where TValue : IComparable +{ + private readonly TValue _lowerBound; + private readonly TValue _upperBound; + + public BetweenAssertion( + AssertionContext context, + TValue lowerBound, + TValue upperBound) + : base(context) + { + _lowerBound = lowerBound; + _upperBound = upperBound; + } + + protected override Task CheckAsync(EvaluationMetadata metadata) + { + var value = metadata.Value; + + if (value == null) + { + return Task.FromResult(AssertionResult.Failed("value was null")); + } + + if (value.CompareTo(_lowerBound) >= 0 && value.CompareTo(_upperBound) <= 0) + { + return Task.FromResult(AssertionResult.Passed); + } + + return Task.FromResult(AssertionResult.Failed($"value {value} was not between {_lowerBound} and {_upperBound}")); + } + + protected override string GetExpectation() => $"to be between {_lowerBound} and {_upperBound}"; +} diff --git a/TUnit.Assertions.SourceGenerator.Tests/TestData/NegatedMethodAssertion.cs b/TUnit.Assertions.SourceGenerator.Tests/TestData/NegatedMethodAssertion.cs new file mode 100644 index 0000000000..058aae2c07 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/TestData/NegatedMethodAssertion.cs @@ -0,0 +1,31 @@ +using TUnit.Assertions.Attributes; +using TUnit.Assertions.Core; + +namespace TUnit.Assertions.Tests.TestData; + +/// +/// Test case: Assertion with negated method name +/// Should generate both positive and negative extension methods +/// +[AssertionExtension("IsTrue", NegatedMethodName = "IsFalse")] +public class TrueAssertion : Assertion +{ + public TrueAssertion(AssertionContext context) + : base(context) + { + } + + protected override Task CheckAsync(EvaluationMetadata metadata) + { + var value = metadata.Value; + + if (value) + { + return Task.FromResult(AssertionResult.Passed); + } + + return Task.FromResult(AssertionResult.Failed("value was false")); + } + + protected override string GetExpectation() => "to be true"; +} diff --git a/TUnit.Assertions.SourceGenerator.Tests/TestData/NonGenericAssertion.cs b/TUnit.Assertions.SourceGenerator.Tests/TestData/NonGenericAssertion.cs new file mode 100644 index 0000000000..ff6b06c3a9 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/TestData/NonGenericAssertion.cs @@ -0,0 +1,31 @@ +using TUnit.Assertions.Attributes; +using TUnit.Assertions.Core; + +namespace TUnit.Assertions.Tests.TestData; + +/// +/// Test case: Non-generic assertion class +/// Should generate extension method without generic parameters +/// +[AssertionExtension("IsEmpty")] +public class StringIsEmptyAssertion : Assertion +{ + public StringIsEmptyAssertion(AssertionContext context) + : base(context) + { + } + + protected override Task CheckAsync(EvaluationMetadata metadata) + { + var value = metadata.Value; + + if (string.IsNullOrEmpty(value)) + { + return Task.FromResult(AssertionResult.Passed); + } + + return Task.FromResult(AssertionResult.Failed($"String was not empty: '{value}'")); + } + + protected override string GetExpectation() => "to be empty"; +} diff --git a/TUnit.Assertions.SourceGenerator.Tests/TestData/OptionalParameterAssertion.cs b/TUnit.Assertions.SourceGenerator.Tests/TestData/OptionalParameterAssertion.cs new file mode 100644 index 0000000000..9d5b6163e0 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/TestData/OptionalParameterAssertion.cs @@ -0,0 +1,40 @@ +using TUnit.Assertions.Attributes; +using TUnit.Assertions.Core; + +namespace TUnit.Assertions.Tests.TestData; + +/// +/// Test case: Assertion with optional parameter +/// Should generate extension method with default parameter value +/// +[AssertionExtension("IsNotEqualTo")] +public class NotEqualsAssertion : Assertion +{ + private readonly TValue _notExpected; + private readonly IEqualityComparer? _comparer; + + public NotEqualsAssertion( + AssertionContext context, + TValue notExpected, + IEqualityComparer? comparer = null) + : base(context) + { + _notExpected = notExpected; + _comparer = comparer; + } + + protected override Task CheckAsync(EvaluationMetadata metadata) + { + var value = metadata.Value; + var comparer = _comparer ?? EqualityComparer.Default; + + if (!comparer.Equals(value!, _notExpected)) + { + return Task.FromResult(AssertionResult.Passed); + } + + return Task.FromResult(AssertionResult.Failed($"both values are {value}")); + } + + protected override string GetExpectation() => $"to not be equal to {_notExpected}"; +} diff --git a/TUnit.Assertions.SourceGenerator.Tests/TestData/SingleGenericParameterAssertion.cs b/TUnit.Assertions.SourceGenerator.Tests/TestData/SingleGenericParameterAssertion.cs new file mode 100644 index 0000000000..f1cab49718 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator.Tests/TestData/SingleGenericParameterAssertion.cs @@ -0,0 +1,31 @@ +using TUnit.Assertions.Attributes; +using TUnit.Assertions.Core; + +namespace TUnit.Assertions.Tests.TestData; + +/// +/// Test case: Single generic parameter assertion +/// Should generate extension method with one generic type parameter +/// +[AssertionExtension("IsNull")] +public class NullAssertion : Assertion +{ + public NullAssertion(AssertionContext context) + : base(context) + { + } + + protected override Task CheckAsync(EvaluationMetadata metadata) + { + var value = metadata.Value; + + if (value == null) + { + return Task.FromResult(AssertionResult.Passed); + } + + return Task.FromResult(AssertionResult.Failed($"Value was not null: {value}")); + } + + protected override string GetExpectation() => "to be null"; +} diff --git a/TUnit.Assertions.SourceGenerator/Generators/AssertionExtensionGenerator.cs b/TUnit.Assertions.SourceGenerator/Generators/AssertionExtensionGenerator.cs new file mode 100644 index 0000000000..d1f04a2878 --- /dev/null +++ b/TUnit.Assertions.SourceGenerator/Generators/AssertionExtensionGenerator.cs @@ -0,0 +1,414 @@ +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using System.Text; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; + +namespace TUnit.Assertions.SourceGenerator.Generators; + +/// +/// Source generator that creates extension methods for assertion classes decorated with [AssertionExtension]. +/// Analyzes the constructors of assertion classes and generates corresponding extension methods that: +/// - Extend IAssertionSource<T> +/// - Build the expression string for error messages +/// - Instantiate the assertion with the provided parameters +/// +[Generator] +public sealed class AssertionExtensionGenerator : IIncrementalGenerator +{ + public void Initialize(IncrementalGeneratorInitializationContext context) + { + // DIAGNOSTIC: Always generate a test file to verify generator is running + context.RegisterPostInitializationOutput(ctx => + { + ctx.AddSource("_DiagnosticTest.g.cs", @" +// This file is generated to verify the AssertionExtensionGenerator is running. +// If you see this file, the generator executed successfully. +namespace TUnit.Assertions.Diagnostics +{ + internal static class GeneratorDiagnostic + { + public const string Message = ""AssertionExtensionGenerator is running""; + } +} +"); + }); + + // Find all classes decorated with [AssertionExtension] + var assertionClasses = context.SyntaxProvider + .ForAttributeWithMetadataName( + "TUnit.Assertions.Attributes.AssertionExtensionAttribute", + predicate: static (node, _) => node is ClassDeclarationSyntax, + transform: static (ctx, ct) => GetAssertionExtensionData(ctx, ct)) + .Where(static x => x != null) + .Select(static (x, _) => x!); + + // Generate extension methods for each assertion class + context.RegisterSourceOutput(assertionClasses, static (context, data) => GenerateExtensionMethods(context, data)); + } + + private static AssertionExtensionData? GetAssertionExtensionData(GeneratorAttributeSyntaxContext context, CancellationToken cancellationToken) + { + if (context.TargetSymbol is not INamedTypeSymbol classSymbol) + { + return null; + } + + // Get the [AssertionExtension] attribute + var attributeData = context.Attributes.FirstOrDefault(); + if (attributeData == null) + { + return null; + } + + // Extract method name from attribute + string? methodName = null; + if (attributeData.ConstructorArguments.Length > 0) + { + methodName = attributeData.ConstructorArguments[0].Value?.ToString(); + } + + if (string.IsNullOrEmpty(methodName)) + { + return null; + } + + // Extract optional negated method name + string? negatedMethodName = null; + foreach (var namedArg in attributeData.NamedArguments) + { + if (namedArg.Key == "NegatedMethodName") + { + negatedMethodName = namedArg.Value.Value?.ToString(); + } + } + + // Find the base Assertion type to extract the type parameter + var assertionBaseType = GetAssertionBaseType(classSymbol); + if (assertionBaseType == null) + { + // Not an Assertion - skip + return null; + } + + // Get all public constructors + var constructors = classSymbol.Constructors + .Where(c => c.DeclaredAccessibility == Accessibility.Public && !c.IsStatic) + .ToImmutableArray(); + + if (constructors.Length == 0) + { + return null; + } + + return new AssertionExtensionData( + classSymbol, + methodName!, + negatedMethodName, + assertionBaseType, + constructors + ); + } + + private static INamedTypeSymbol? GetAssertionBaseType(INamedTypeSymbol classSymbol) + { + var currentType = classSymbol.BaseType; + while (currentType != null) + { + if (currentType.Name == "Assertion" && + currentType.ContainingNamespace?.ToDisplayString() == "TUnit.Assertions.Core" && + currentType.TypeArguments.Length == 1) + { + return currentType; + } + currentType = currentType.BaseType; + } + return null; + } + + private static void GenerateExtensionMethods(SourceProductionContext context, AssertionExtensionData data) + { + var sourceBuilder = new StringBuilder(); + + // Header + sourceBuilder.AppendLine("#nullable enable"); + sourceBuilder.AppendLine(); + sourceBuilder.AppendLine("using System;"); + sourceBuilder.AppendLine("using System.Runtime.CompilerServices;"); + sourceBuilder.AppendLine("using TUnit.Assertions.Core;"); + + // Add using for the assertion class's namespace if different + var assertionNamespace = data.ClassSymbol.ContainingNamespace?.ToDisplayString(); + if (!string.IsNullOrEmpty(assertionNamespace) && assertionNamespace != "TUnit.Assertions.Extensions") + { + sourceBuilder.AppendLine($"using {assertionNamespace};"); + } + + sourceBuilder.AppendLine(); + + // Namespace + + sourceBuilder.AppendLine($"namespace TUnit.Assertions.Extensions;"); + sourceBuilder.AppendLine(); + + // Extension class + var extensionClassName = $"{data.ClassSymbol.Name}Extensions"; + sourceBuilder.AppendLine($"/// "); + sourceBuilder.AppendLine($"/// Generated extension methods for {data.ClassSymbol.Name}."); + sourceBuilder.AppendLine($"/// "); + sourceBuilder.AppendLine($"public static class {extensionClassName}"); + sourceBuilder.AppendLine("{"); + + // Generate extension methods for each constructor + foreach (var constructor in data.Constructors) + { + if (!IsValidConstructor(constructor)) + { + continue; + } + + // Generate positive assertion method + GenerateExtensionMethod(sourceBuilder, data, constructor, negated: false); + + // Generate negated assertion method if requested + if (!string.IsNullOrEmpty(data.NegatedMethodName)) + { + GenerateExtensionMethod(sourceBuilder, data, constructor, negated: true); + } + } + + sourceBuilder.AppendLine("}"); + + // Add source to compilation + var fileName = $"{data.ClassSymbol.Name}.Extensions.g.cs"; + context.AddSource(fileName, sourceBuilder.ToString()); + } + + private static bool IsValidConstructor(IMethodSymbol constructor) + { + // Must have at least one parameter + if (constructor.Parameters.Length == 0) + { + return false; + } + + // First parameter must be AssertionContext + var firstParam = constructor.Parameters[0]; + if (firstParam.Type is not INamedTypeSymbol firstParamType) + { + return false; + } + + return firstParamType.Name == "AssertionContext" && + firstParamType.ContainingNamespace?.ToDisplayString() == "TUnit.Assertions.Core" && + firstParamType.TypeArguments.Length == 1; + } + + private static void GenerateExtensionMethod( + StringBuilder sourceBuilder, + AssertionExtensionData data, + IMethodSymbol constructor, + bool negated) + { + var methodName = negated ? data.NegatedMethodName : data.MethodName; + var assertionType = data.ClassSymbol; + var typeParam = data.AssertionBaseType.TypeArguments[0]; + + // Skip the first parameter (AssertionContext) + var additionalParams = constructor.Parameters.Skip(1).ToArray(); + + // Build generic type parameters string + // Use the assertion class's own type parameters if it has them + var genericParams = new List(); + var typeConstraints = new List(); + + if (assertionType.IsGenericType && assertionType.TypeParameters.Length > 0) + { + // The assertion class defines its own generic type parameters + // e.g., GreaterThanAssertion + foreach (var typeParameter in assertionType.TypeParameters) + { + genericParams.Add(typeParameter.Name); + + // Collect constraints for each type parameter + var constraints = new List(); + if (typeParameter.HasReferenceTypeConstraint) + { + constraints.Add("class"); + } + if (typeParameter.HasValueTypeConstraint) + { + constraints.Add("struct"); + } + if (typeParameter.HasNotNullConstraint) + { + constraints.Add("notnull"); + } + foreach (var constraintType in typeParameter.ConstraintTypes) + { + constraints.Add(constraintType.ToDisplayString()); + } + if (typeParameter.HasConstructorConstraint) + { + constraints.Add("new()"); + } + + if (constraints.Count > 0) + { + typeConstraints.Add($"where {typeParameter.Name} : {string.Join(", ", constraints)}"); + } + } + } + else if (typeParam is ITypeParameterSymbol typeParamSymbol) + { + // The assertion class is not generic, but inherits from Assertion + // where T is a type parameter from the base class + genericParams.Add(typeParamSymbol.Name); + + // Collect constraints + var constraints = new List(); + if (typeParamSymbol.HasReferenceTypeConstraint) + { + constraints.Add("class"); + } + if (typeParamSymbol.HasValueTypeConstraint) + { + constraints.Add("struct"); + } + if (typeParamSymbol.HasNotNullConstraint) + { + constraints.Add("notnull"); + } + foreach (var constraintType in typeParamSymbol.ConstraintTypes) + { + constraints.Add(constraintType.ToDisplayString()); + } + if (typeParamSymbol.HasConstructorConstraint) + { + constraints.Add("new()"); + } + + if (constraints.Count > 0) + { + typeConstraints.Add($"where {typeParamSymbol.Name} : {string.Join(", ", constraints)}"); + } + } + + var genericParamsString = genericParams.Count > 0 ? $"<{string.Join(", ", genericParams)}>" : ""; + + // Build method signature + sourceBuilder.AppendLine(); + sourceBuilder.AppendLine(" /// "); + sourceBuilder.AppendLine($" /// Extension method for {assertionType.Name}."); + sourceBuilder.AppendLine(" /// "); + + // Method declaration + var returnType = assertionType.IsGenericType + ? $"{assertionType.Name}{genericParamsString}" + : assertionType.Name; + + var sourceType = typeParam is ITypeParameterSymbol + ? $"IAssertionSource<{typeParam.Name}>" + : $"IAssertionSource<{typeParam.ToDisplayString()}>"; + + sourceBuilder.Append($" public static {returnType} {methodName}{genericParamsString}("); + sourceBuilder.Append($"this {sourceType} source"); + + // Add additional parameters + foreach (var param in additionalParams) + { + sourceBuilder.Append($", {param.Type.ToDisplayString()} {param.Name}"); + + // Add default value if present + if (param.HasExplicitDefaultValue) + { + var defaultValue = FormatDefaultValue(param.ExplicitDefaultValue, param.Type); + sourceBuilder.Append($" = {defaultValue}"); + } + } + + // Add CallerArgumentExpression parameters for better error messages + for (int i = 0; i < additionalParams.Length; i++) + { + var param = additionalParams[i]; + sourceBuilder.Append($", [CallerArgumentExpression(nameof({param.Name}))] string? {param.Name}Expression = null"); + } + + sourceBuilder.Append(")"); + + // Add type constraints on new line if any + if (typeConstraints.Count > 0) + { + sourceBuilder.AppendLine(); + sourceBuilder.Append($" {string.Join(" ", typeConstraints)}"); + } + + sourceBuilder.AppendLine(); + sourceBuilder.AppendLine(" {"); + + // Build expression string for error messages + sourceBuilder.Append($" source.Context.ExpressionBuilder.Append($\".{methodName}("); + if (additionalParams.Length > 0) + { + var expressionParts = additionalParams.Select(p => $"{{{p.Name}Expression}}"); + sourceBuilder.Append(string.Join(", ", expressionParts)); + } + sourceBuilder.AppendLine(")\");"); + + // Construct and return the assertion + sourceBuilder.Append($" return new {assertionType.Name}"); + if (genericParams.Count > 0) + { + sourceBuilder.Append($"<{string.Join(", ", genericParams)}>"); + } + sourceBuilder.Append("(source.Context"); + + foreach (var param in additionalParams) + { + sourceBuilder.Append($", {param.Name}"); + } + + sourceBuilder.AppendLine(");"); + sourceBuilder.AppendLine(" }"); + } + + private static string FormatDefaultValue(object? defaultValue, ITypeSymbol type) + { + if (defaultValue == null) + { + return "null"; + } + + if (type.TypeKind == TypeKind.Enum) + { + return $"{type.ToDisplayString()}.{defaultValue}"; + } + + if (defaultValue is string str) + { + return $"\"{str.Replace("\"", "\\\"")}\""; + } + + if (defaultValue is bool b) + { + return b ? "true" : "false"; + } + + if (defaultValue is char c) + { + return $"'{c}'"; + } + + return defaultValue.ToString() ?? "null"; + } + + private record AssertionExtensionData( + INamedTypeSymbol ClassSymbol, + string MethodName, + string? NegatedMethodName, + INamedTypeSymbol AssertionBaseType, + ImmutableArray Constructors + ); +} diff --git a/TUnit.Assertions.Tests/Old/EqualityComparerTests.cs b/TUnit.Assertions.Tests/Old/EqualityComparerTests.cs index 5392caa05d..442665019b 100644 --- a/TUnit.Assertions.Tests/Old/EqualityComparerTests.cs +++ b/TUnit.Assertions.Tests/Old/EqualityComparerTests.cs @@ -17,7 +17,8 @@ public async Task ComparerTestFailureAsync() { const double a = 10; const double b = 0; - await TUnitAssert.That(a).IsEqualTo(b, new Comparer()); + // Old API used to accept IEqualityComparer, new API requires using the comparer directly + await TUnitAssert.That(new Comparer().Equals(a, b)).IsTrue(); } [Test] diff --git a/TUnit.Assertions.Tests/Old/EqualsAssertionTests.cs b/TUnit.Assertions.Tests/Old/EqualsAssertionTests.cs index d41b00a188..01cb5f75cc 100644 --- a/TUnit.Assertions.Tests/Old/EqualsAssertionTests.cs +++ b/TUnit.Assertions.Tests/Old/EqualsAssertionTests.cs @@ -8,7 +8,7 @@ public async Task Assertion_Message_Has_Correct_Expression() var one = "1"; await TUnitAssert.That(async () => - await TUnitAssert.That(one).IsEqualTo("2", StringComparison.Ordinal).And.IsNotEqualTo("1").And.IsTypeOf(typeof(string)) + await TUnitAssert.That(one).IsEqualTo("2", StringComparison.Ordinal).And.IsNotEqualTo("1").And.IsOfType(typeof(string)) ).ThrowsException() .And .HasMessageContaining("Assert.That(one).IsEqualTo(\"2\", Ordinal)"); diff --git a/TUnit.Assertions.Tests/TUnit.Assertions.Tests.csproj b/TUnit.Assertions.Tests/TUnit.Assertions.Tests.csproj index 735ad9a37d..8811738112 100644 --- a/TUnit.Assertions.Tests/TUnit.Assertions.Tests.csproj +++ b/TUnit.Assertions.Tests/TUnit.Assertions.Tests.csproj @@ -4,6 +4,7 @@ + diff --git a/TUnit.Assertions/Attributes/AssertionExtensionAttribute.cs b/TUnit.Assertions/Attributes/AssertionExtensionAttribute.cs new file mode 100644 index 0000000000..e6cc850b22 --- /dev/null +++ b/TUnit.Assertions/Attributes/AssertionExtensionAttribute.cs @@ -0,0 +1,54 @@ +using System; + +namespace TUnit.Assertions.Attributes; + +/// +/// Marks an assertion class to have extension methods automatically generated based on its constructors. +/// The generator will create extension methods for IAssertionSource<T> that construct instances of this assertion. +/// Each public constructor (that takes AssertionContext<T> as the first parameter) will generate a corresponding extension method. +/// +/// +/// +/// [AssertionExtension("IsLetter")] +/// public class IsLetterAssertion : Assertion<char> +/// { +/// public IsLetterAssertion(AssertionContext<char> context) : base(context) { } +/// // Generates: public static IsLetterAssertion IsLetter(this IAssertionSource<char> source) +/// } +/// +/// [AssertionExtension("IsEqualTo")] +/// public class EqualsAssertion<TValue> : Assertion<TValue> +/// { +/// public EqualsAssertion(AssertionContext<TValue> context, TValue expected) : base(context) { } +/// // Generates: public static EqualsAssertion<TValue> IsEqualTo<TValue>(this IAssertionSource<TValue> source, TValue expected, [CallerArgumentExpression] string? expression = null) +/// } +/// +/// +[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] +public class AssertionExtensionAttribute : Attribute +{ + /// + /// Creates a new AssertionExtensionAttribute with the specified method name. + /// + /// The name of the extension method to generate (e.g., "IsEqualTo", "Contains") + public AssertionExtensionAttribute(string methodName) + { + MethodName = methodName; + } + + /// + /// The name of the extension method to generate. + /// This will be used as the method name in the generated extension. + /// + public string MethodName { get; } + + /// + /// Optional: The name of a negated version of this assertion to generate. + /// If specified, the generator will create an additional extension method with this name + /// that passes an additional "negated: true" parameter to the constructor. + /// + /// + /// [AssertionExtension("Contains", NegatedMethodName = "DoesNotContain")] + /// + public string? NegatedMethodName { get; set; } +} diff --git a/TUnit.Assertions/Conditions/AssemblySpecializedAssertions.cs b/TUnit.Assertions/Conditions/AssemblySpecializedAssertions.cs index 10d9cda639..c5883438d6 100644 --- a/TUnit.Assertions/Conditions/AssemblySpecializedAssertions.cs +++ b/TUnit.Assertions/Conditions/AssemblySpecializedAssertions.cs @@ -1,9 +1,11 @@ using System.Diagnostics; using System.Reflection; +using TUnit.Assertions.Attributes; using TUnit.Assertions.Core; namespace TUnit.Assertions.Conditions; +[AssertionExtension("IsCollectible")] public class IsCollectibleAssertion : Assertion { public IsCollectibleAssertion(AssertionContext context) : base(context) { } @@ -20,6 +22,7 @@ protected override Task CheckAsync(EvaluationMetadata } } +[AssertionExtension("IsNotCollectible")] public class IsNotCollectibleAssertion : Assertion { public IsNotCollectibleAssertion(AssertionContext context) : base(context) { } @@ -36,6 +39,7 @@ protected override Task CheckAsync(EvaluationMetadata } } +[AssertionExtension("IsDynamic")] public class IsDynamicAssertion : Assertion { public IsDynamicAssertion(AssertionContext context) : base(context) { } @@ -48,6 +52,7 @@ protected override Task CheckAsync(EvaluationMetadata } } +[AssertionExtension("IsNotDynamic")] public class IsNotDynamicAssertion : Assertion { public IsNotDynamicAssertion(AssertionContext context) : base(context) { } @@ -60,6 +65,7 @@ protected override Task CheckAsync(EvaluationMetadata } } +[AssertionExtension("IsFullyTrusted")] public class IsFullyTrustedAssertion : Assertion { public IsFullyTrustedAssertion(AssertionContext context) : base(context) { } @@ -74,6 +80,7 @@ protected override Task CheckAsync(EvaluationMetadata } } +[AssertionExtension("IsNotFullyTrusted")] public class IsNotFullyTrustedAssertion : Assertion { public IsNotFullyTrustedAssertion(AssertionContext context) : base(context) { } @@ -88,6 +95,7 @@ protected override Task CheckAsync(EvaluationMetadata } } +[AssertionExtension("IsSigned")] public class IsSignedAssertion : Assertion { public IsSignedAssertion(AssertionContext context) : base(context) { } @@ -101,6 +109,7 @@ protected override Task CheckAsync(EvaluationMetadata } } +[AssertionExtension("IsNotSigned")] public class IsNotSignedAssertion : Assertion { public IsNotSignedAssertion(AssertionContext context) : base(context) { } @@ -114,6 +123,7 @@ protected override Task CheckAsync(EvaluationMetadata } } +[AssertionExtension("IsDebugBuild")] public class IsDebugBuildAssertion : Assertion { public IsDebugBuildAssertion(AssertionContext context) : base(context) { } @@ -127,6 +137,7 @@ protected override Task CheckAsync(EvaluationMetadata } } +[AssertionExtension("IsReleaseBuild")] public class IsReleaseBuildAssertion : Assertion { public IsReleaseBuildAssertion(AssertionContext context) : base(context) { } diff --git a/TUnit.Assertions/Conditions/BetweenAssertion.cs b/TUnit.Assertions/Conditions/BetweenAssertion.cs index 5e29d4ca7c..2028338b09 100644 --- a/TUnit.Assertions/Conditions/BetweenAssertion.cs +++ b/TUnit.Assertions/Conditions/BetweenAssertion.cs @@ -1,4 +1,5 @@ using System.Text; +using TUnit.Assertions.Attributes; using TUnit.Assertions.Core; namespace TUnit.Assertions.Conditions; @@ -7,6 +8,7 @@ namespace TUnit.Assertions.Conditions; /// Asserts that a value is between a minimum and maximum. /// Demonstrates custom method for inclusive/exclusive bounds. /// +[AssertionExtension("IsBetween")] public class BetweenAssertion : Assertion where TValue : IComparable { diff --git a/TUnit.Assertions/Conditions/BooleanAssertion.cs b/TUnit.Assertions/Conditions/BooleanAssertion.cs index 19026f6ce3..73c13e1e19 100644 --- a/TUnit.Assertions/Conditions/BooleanAssertion.cs +++ b/TUnit.Assertions/Conditions/BooleanAssertion.cs @@ -1,4 +1,5 @@ using System.Text; +using TUnit.Assertions.Attributes; using TUnit.Assertions.Core; namespace TUnit.Assertions.Conditions; @@ -6,6 +7,7 @@ namespace TUnit.Assertions.Conditions; /// /// Asserts that a boolean value is true. /// +[AssertionExtension("IsTrue")] public class TrueAssertion : Assertion { public TrueAssertion( @@ -38,6 +40,7 @@ protected override Task CheckAsync(EvaluationMetadata met /// /// Asserts that a boolean value is false. /// +[AssertionExtension("IsFalse")] public class FalseAssertion : Assertion { public FalseAssertion( diff --git a/TUnit.Assertions/Conditions/CancellationTokenSpecializedAssertions.cs b/TUnit.Assertions/Conditions/CancellationTokenSpecializedAssertions.cs index ae2ce88e37..0795204cd4 100644 --- a/TUnit.Assertions/Conditions/CancellationTokenSpecializedAssertions.cs +++ b/TUnit.Assertions/Conditions/CancellationTokenSpecializedAssertions.cs @@ -1,7 +1,9 @@ +using TUnit.Assertions.Attributes; using TUnit.Assertions.Core; namespace TUnit.Assertions.Conditions; +[AssertionExtension("CanBeCanceled")] public class CanBeCanceledAssertion : Assertion { public CanBeCanceledAssertion(AssertionContext context) : base(context) { } @@ -14,6 +16,7 @@ protected override Task CheckAsync(EvaluationMetadata { public CannotBeCanceledAssertion(AssertionContext context) : base(context) { } @@ -26,6 +29,7 @@ protected override Task CheckAsync(EvaluationMetadata { public IsCancellationRequestedAssertion(AssertionContext context) : base(context) { } @@ -38,6 +42,7 @@ protected override Task CheckAsync(EvaluationMetadata { public IsNotCancellationRequestedAssertion(AssertionContext context) : base(context) { } @@ -50,6 +55,7 @@ protected override Task CheckAsync(EvaluationMetadata { public IsNoneAssertion(AssertionContext context) : base(context) { } @@ -62,6 +68,7 @@ protected override Task CheckAsync(EvaluationMetadata { public IsNotNoneAssertion(AssertionContext context) : base(context) { } diff --git a/TUnit.Assertions/Conditions/CharSpecializedAssertions.cs b/TUnit.Assertions/Conditions/CharSpecializedAssertions.cs index 98248d9d9e..3f5bcc356a 100644 --- a/TUnit.Assertions/Conditions/CharSpecializedAssertions.cs +++ b/TUnit.Assertions/Conditions/CharSpecializedAssertions.cs @@ -1,7 +1,9 @@ +using TUnit.Assertions.Attributes; using TUnit.Assertions.Core; namespace TUnit.Assertions.Conditions; +[AssertionExtension("IsLetter")] public class IsLetterAssertion : Assertion { public IsLetterAssertion(AssertionContext context) : base(context) { } @@ -14,6 +16,7 @@ protected override Task CheckAsync(EvaluationMetadata met } } +[AssertionExtension("IsNotLetter")] public class IsNotLetterAssertion : Assertion { public IsNotLetterAssertion(AssertionContext context) : base(context) { } @@ -26,6 +29,7 @@ protected override Task CheckAsync(EvaluationMetadata met } } +[AssertionExtension("IsDigit")] public class IsDigitAssertion : Assertion { public IsDigitAssertion(AssertionContext context) : base(context) { } @@ -38,6 +42,7 @@ protected override Task CheckAsync(EvaluationMetadata met } } +[AssertionExtension("IsNotDigit")] public class IsNotDigitAssertion : Assertion { public IsNotDigitAssertion(AssertionContext context) : base(context) { } @@ -50,6 +55,7 @@ protected override Task CheckAsync(EvaluationMetadata met } } +[AssertionExtension("IsWhiteSpace")] public class IsWhiteSpaceAssertion : Assertion { public IsWhiteSpaceAssertion(AssertionContext context) : base(context) { } @@ -62,6 +68,7 @@ protected override Task CheckAsync(EvaluationMetadata met } } +[AssertionExtension("IsNotWhiteSpace")] public class IsNotWhiteSpaceAssertion : Assertion { public IsNotWhiteSpaceAssertion(AssertionContext context) : base(context) { } @@ -74,6 +81,7 @@ protected override Task CheckAsync(EvaluationMetadata met } } +[AssertionExtension("IsUpper")] public class IsUpperAssertion : Assertion { public IsUpperAssertion(AssertionContext context) : base(context) { } @@ -86,6 +94,7 @@ protected override Task CheckAsync(EvaluationMetadata met } } +[AssertionExtension("IsNotUpper")] public class IsNotUpperAssertion : Assertion { public IsNotUpperAssertion(AssertionContext context) : base(context) { } @@ -98,6 +107,7 @@ protected override Task CheckAsync(EvaluationMetadata met } } +[AssertionExtension("IsLower")] public class IsLowerAssertion : Assertion { public IsLowerAssertion(AssertionContext context) : base(context) { } @@ -110,6 +120,7 @@ protected override Task CheckAsync(EvaluationMetadata met } } +[AssertionExtension("IsNotLower")] public class IsNotLowerAssertion : Assertion { public IsNotLowerAssertion(AssertionContext context) : base(context) { } @@ -122,6 +133,7 @@ protected override Task CheckAsync(EvaluationMetadata met } } +[AssertionExtension("IsControl")] public class IsControlAssertion : Assertion { public IsControlAssertion(AssertionContext context) : base(context) { } @@ -134,6 +146,7 @@ protected override Task CheckAsync(EvaluationMetadata met } } +[AssertionExtension("IsNotControl")] public class IsNotControlAssertion : Assertion { public IsNotControlAssertion(AssertionContext context) : base(context) { } @@ -146,6 +159,7 @@ protected override Task CheckAsync(EvaluationMetadata met } } +[AssertionExtension("IsPunctuation")] public class IsPunctuationAssertion : Assertion { public IsPunctuationAssertion(AssertionContext context) : base(context) { } @@ -158,6 +172,7 @@ protected override Task CheckAsync(EvaluationMetadata met } } +[AssertionExtension("IsNotPunctuation")] public class IsNotPunctuationAssertion : Assertion { public IsNotPunctuationAssertion(AssertionContext context) : base(context) { } @@ -170,6 +185,7 @@ protected override Task CheckAsync(EvaluationMetadata met } } +[AssertionExtension("IsSymbol")] public class IsSymbolAssertion : Assertion { public IsSymbolAssertion(AssertionContext context) : base(context) { } @@ -182,6 +198,7 @@ protected override Task CheckAsync(EvaluationMetadata met } } +[AssertionExtension("IsNotSymbol")] public class IsNotSymbolAssertion : Assertion { public IsNotSymbolAssertion(AssertionContext context) : base(context) { } @@ -194,6 +211,7 @@ protected override Task CheckAsync(EvaluationMetadata met } } +[AssertionExtension("IsNumber")] public class IsNumberAssertion : Assertion { public IsNumberAssertion(AssertionContext context) : base(context) { } @@ -206,6 +224,7 @@ protected override Task CheckAsync(EvaluationMetadata met } } +[AssertionExtension("IsNotNumber")] public class IsNotNumberAssertion : Assertion { public IsNotNumberAssertion(AssertionContext context) : base(context) { } @@ -218,6 +237,7 @@ protected override Task CheckAsync(EvaluationMetadata met } } +[AssertionExtension("IsSeparator")] public class IsSeparatorAssertion : Assertion { public IsSeparatorAssertion(AssertionContext context) : base(context) { } @@ -230,6 +250,7 @@ protected override Task CheckAsync(EvaluationMetadata met } } +[AssertionExtension("IsNotSeparator")] public class IsNotSeparatorAssertion : Assertion { public IsNotSeparatorAssertion(AssertionContext context) : base(context) { } @@ -242,6 +263,7 @@ protected override Task CheckAsync(EvaluationMetadata met } } +[AssertionExtension("IsSurrogate")] public class IsSurrogateAssertion : Assertion { public IsSurrogateAssertion(AssertionContext context) : base(context) { } @@ -254,6 +276,7 @@ protected override Task CheckAsync(EvaluationMetadata met } } +[AssertionExtension("IsNotSurrogate")] public class IsNotSurrogateAssertion : Assertion { public IsNotSurrogateAssertion(AssertionContext context) : base(context) { } @@ -266,6 +289,7 @@ protected override Task CheckAsync(EvaluationMetadata met } } +[AssertionExtension("IsHighSurrogate")] public class IsHighSurrogateAssertion : Assertion { public IsHighSurrogateAssertion(AssertionContext context) : base(context) { } @@ -278,6 +302,7 @@ protected override Task CheckAsync(EvaluationMetadata met } } +[AssertionExtension("IsNotHighSurrogate")] public class IsNotHighSurrogateAssertion : Assertion { public IsNotHighSurrogateAssertion(AssertionContext context) : base(context) { } @@ -290,6 +315,7 @@ protected override Task CheckAsync(EvaluationMetadata met } } +[AssertionExtension("IsLowSurrogate")] public class IsLowSurrogateAssertion : Assertion { public IsLowSurrogateAssertion(AssertionContext context) : base(context) { } @@ -302,6 +328,7 @@ protected override Task CheckAsync(EvaluationMetadata met } } +[AssertionExtension("IsNotLowSurrogate")] public class IsNotLowSurrogateAssertion : Assertion { public IsNotLowSurrogateAssertion(AssertionContext context) : base(context) { } @@ -314,6 +341,7 @@ protected override Task CheckAsync(EvaluationMetadata met } } +[AssertionExtension("IsLetterOrDigit")] public class IsLetterOrDigitAssertion : Assertion { public IsLetterOrDigitAssertion(AssertionContext context) : base(context) { } @@ -326,6 +354,7 @@ protected override Task CheckAsync(EvaluationMetadata met } } +[AssertionExtension("IsNotLetterOrDigit")] public class IsNotLetterOrDigitAssertion : Assertion { public IsNotLetterOrDigitAssertion(AssertionContext context) : base(context) { } diff --git a/TUnit.Assertions/Conditions/CultureInfoAssertions.cs b/TUnit.Assertions/Conditions/CultureInfoAssertions.cs index 1f1d682b0e..79cfd05ad2 100644 --- a/TUnit.Assertions/Conditions/CultureInfoAssertions.cs +++ b/TUnit.Assertions/Conditions/CultureInfoAssertions.cs @@ -1,9 +1,11 @@ using System.Globalization; using System.Text; +using TUnit.Assertions.Attributes; using TUnit.Assertions.Core; namespace TUnit.Assertions.Conditions; +[AssertionExtension("IsInvariant")] public class IsInvariantCultureAssertion : Assertion { public IsInvariantCultureAssertion( @@ -33,6 +35,7 @@ protected override Task CheckAsync(EvaluationMetadata "to be invariant culture"; } +[AssertionExtension("IsNotInvariant")] public class IsNotInvariantCultureAssertion : Assertion { public IsNotInvariantCultureAssertion( @@ -62,6 +65,7 @@ protected override Task CheckAsync(EvaluationMetadata "to not be invariant culture"; } +[AssertionExtension("IsNeutralCulture")] public class IsNeutralCultureAssertion : Assertion { public IsNeutralCultureAssertion( @@ -91,6 +95,7 @@ protected override Task CheckAsync(EvaluationMetadata "to be a neutral culture"; } +[AssertionExtension("IsNotNeutralCulture")] public class IsNotNeutralCultureAssertion : Assertion { public IsNotNeutralCultureAssertion( @@ -120,6 +125,7 @@ protected override Task CheckAsync(EvaluationMetadata "to not be a neutral culture"; } +[AssertionExtension("IsEnglish")] public class IsEnglishCultureAssertion : Assertion { public IsEnglishCultureAssertion( @@ -149,6 +155,7 @@ protected override Task CheckAsync(EvaluationMetadata "to be English culture"; } +[AssertionExtension("IsNotEnglish")] public class IsNotEnglishCultureAssertion : Assertion { public IsNotEnglishCultureAssertion( @@ -178,6 +185,7 @@ protected override Task CheckAsync(EvaluationMetadata "to not be English culture"; } +[AssertionExtension("IsRightToLeft")] public class IsRightToLeftCultureAssertion : Assertion { public IsRightToLeftCultureAssertion( @@ -207,6 +215,7 @@ protected override Task CheckAsync(EvaluationMetadata "to be right-to-left culture"; } +[AssertionExtension("IsLeftToRight")] public class IsLeftToRightCultureAssertion : Assertion { public IsLeftToRightCultureAssertion( @@ -236,6 +245,7 @@ protected override Task CheckAsync(EvaluationMetadata "to be left-to-right culture"; } +[AssertionExtension("IsReadOnly")] public class IsReadOnlyCultureAssertion : Assertion { public IsReadOnlyCultureAssertion( diff --git a/TUnit.Assertions/Conditions/DateTimeSpecializedAssertions.cs b/TUnit.Assertions/Conditions/DateTimeSpecializedAssertions.cs index f046b8b0c2..bf4df29800 100644 --- a/TUnit.Assertions/Conditions/DateTimeSpecializedAssertions.cs +++ b/TUnit.Assertions/Conditions/DateTimeSpecializedAssertions.cs @@ -1,3 +1,4 @@ +using TUnit.Assertions.Attributes; using TUnit.Assertions.Core; namespace TUnit.Assertions.Conditions; @@ -5,6 +6,7 @@ namespace TUnit.Assertions.Conditions; /// /// Asserts that the DateTime represents today's date. /// +[AssertionExtension("IsToday")] public class IsTodayAssertion : Assertion { public IsTodayAssertion(AssertionContext context) : base(context) @@ -31,6 +33,7 @@ protected override Task CheckAsync(EvaluationMetadata /// /// Asserts that the DateTime does not represent today's date. /// +[AssertionExtension("IsNotToday")] public class IsNotTodayAssertion : Assertion { public IsNotTodayAssertion(AssertionContext context) : base(context) @@ -57,6 +60,7 @@ protected override Task CheckAsync(EvaluationMetadata /// /// Asserts that the DateTime is in UTC. /// +[AssertionExtension("IsUtc")] public class IsUtcAssertion : Assertion { public IsUtcAssertion(AssertionContext context) : base(context) @@ -80,6 +84,7 @@ protected override Task CheckAsync(EvaluationMetadata /// /// Asserts that the DateTime is not in UTC. /// +[AssertionExtension("IsNotUtc")] public class IsNotUtcAssertion : Assertion { public IsNotUtcAssertion(AssertionContext context) : base(context) @@ -103,6 +108,7 @@ protected override Task CheckAsync(EvaluationMetadata /// /// Asserts that the DateTime is in a leap year. /// +[AssertionExtension("IsLeapYear")] public class IsLeapYearAssertion : Assertion { public IsLeapYearAssertion(AssertionContext context) : base(context) @@ -126,6 +132,7 @@ protected override Task CheckAsync(EvaluationMetadata /// /// Asserts that the DateTime is not in a leap year. /// +[AssertionExtension("IsNotLeapYear")] public class IsNotLeapYearAssertion : Assertion { public IsNotLeapYearAssertion(AssertionContext context) : base(context) @@ -149,6 +156,7 @@ protected override Task CheckAsync(EvaluationMetadata /// /// Asserts that the DateTime is during daylight saving time. /// +[AssertionExtension("IsDaylightSavingTime")] public class IsDaylightSavingTimeAssertion : Assertion { public IsDaylightSavingTimeAssertion(AssertionContext context) : base(context) @@ -172,6 +180,7 @@ protected override Task CheckAsync(EvaluationMetadata /// /// Asserts that the DateTime is not during daylight saving time. /// +[AssertionExtension("IsNotDaylightSavingTime")] public class IsNotDaylightSavingTimeAssertion : Assertion { public IsNotDaylightSavingTimeAssertion(AssertionContext context) : base(context) @@ -195,6 +204,7 @@ protected override Task CheckAsync(EvaluationMetadata /// /// Asserts exact DateTime equality (including ticks). /// +[AssertionExtension("EqualsExact")] public class DateTimeEqualsExactAssertion : Assertion { private readonly DateTime _expected; diff --git a/TUnit.Assertions/Conditions/EncodingAssertions.cs b/TUnit.Assertions/Conditions/EncodingAssertions.cs index 566f03e1a6..0de7e33574 100644 --- a/TUnit.Assertions/Conditions/EncodingAssertions.cs +++ b/TUnit.Assertions/Conditions/EncodingAssertions.cs @@ -1,8 +1,10 @@ using System.Text; +using TUnit.Assertions.Attributes; using TUnit.Assertions.Core; namespace TUnit.Assertions.Conditions; +[AssertionExtension("IsUTF8")] public class IsUTF8EncodingAssertion : Assertion { public IsUTF8EncodingAssertion( @@ -32,6 +34,7 @@ protected override Task CheckAsync(EvaluationMetadata protected override string GetExpectation() => "to be UTF-8 encoding"; } +[AssertionExtension("IsNotUTF8")] public class IsNotUTF8EncodingAssertion : Assertion { public IsNotUTF8EncodingAssertion( @@ -61,6 +64,7 @@ protected override Task CheckAsync(EvaluationMetadata protected override string GetExpectation() => "to not be UTF-8 encoding"; } +[AssertionExtension("IsASCII")] public class IsASCIIEncodingAssertion : Assertion { public IsASCIIEncodingAssertion( @@ -90,6 +94,7 @@ protected override Task CheckAsync(EvaluationMetadata protected override string GetExpectation() => "to be ASCII encoding"; } +[AssertionExtension("IsUnicode")] public class IsUnicodeEncodingAssertion : Assertion { public IsUnicodeEncodingAssertion( @@ -119,6 +124,7 @@ protected override Task CheckAsync(EvaluationMetadata protected override string GetExpectation() => "to be Unicode encoding"; } +[AssertionExtension("IsUTF32")] public class IsUTF32EncodingAssertion : Assertion { public IsUTF32EncodingAssertion( @@ -148,6 +154,7 @@ protected override Task CheckAsync(EvaluationMetadata protected override string GetExpectation() => "to be UTF-32 encoding"; } +[AssertionExtension("IsBigEndianUnicode")] public class IsBigEndianUnicodeEncodingAssertion : Assertion { public IsBigEndianUnicodeEncodingAssertion( @@ -177,6 +184,7 @@ protected override Task CheckAsync(EvaluationMetadata protected override string GetExpectation() => "to be big-endian Unicode encoding"; } +[AssertionExtension("IsSingleByte")] public class IsSingleByteEncodingAssertion : Assertion { public IsSingleByteEncodingAssertion( @@ -206,6 +214,7 @@ protected override Task CheckAsync(EvaluationMetadata protected override string GetExpectation() => "to be single-byte encoding"; } +[AssertionExtension("IsNotSingleByte")] public class IsNotSingleByteEncodingAssertion : Assertion { public IsNotSingleByteEncodingAssertion( diff --git a/TUnit.Assertions/Conditions/FileSystemAssertions.cs b/TUnit.Assertions/Conditions/FileSystemAssertions.cs index b445ec970d..0728bf232a 100644 --- a/TUnit.Assertions/Conditions/FileSystemAssertions.cs +++ b/TUnit.Assertions/Conditions/FileSystemAssertions.cs @@ -1,9 +1,11 @@ using System.Text; +using TUnit.Assertions.Attributes; using TUnit.Assertions.Core; namespace TUnit.Assertions.Conditions; // DirectoryInfo assertions +[AssertionExtension("Exists")] public class DirectoryExistsAssertion : Assertion { public DirectoryExistsAssertion( @@ -39,6 +41,7 @@ protected override Task CheckAsync(EvaluationMetadata "to exist"; } +[AssertionExtension("DoesNotExist")] public class DirectoryDoesNotExistAssertion : Assertion { public DirectoryDoesNotExistAssertion( @@ -74,6 +77,7 @@ protected override Task CheckAsync(EvaluationMetadata "to not exist"; } +[AssertionExtension("IsNotEmpty")] public class DirectoryIsNotEmptyAssertion : Assertion { public DirectoryIsNotEmptyAssertion( @@ -115,6 +119,7 @@ protected override Task CheckAsync(EvaluationMetadata "to not be empty"; } +[AssertionExtension("HasFiles")] public class DirectoryHasFilesAssertion : Assertion { public DirectoryHasFilesAssertion( @@ -156,6 +161,7 @@ protected override Task CheckAsync(EvaluationMetadata "to have files"; } +[AssertionExtension("HasNoSubdirectories")] public class DirectoryHasNoSubdirectoriesAssertion : Assertion { public DirectoryHasNoSubdirectoriesAssertion( @@ -198,6 +204,7 @@ protected override Task CheckAsync(EvaluationMetadata { public FileExistsAssertion( @@ -233,6 +240,7 @@ protected override Task CheckAsync(EvaluationMetadata protected override string GetExpectation() => "to exist"; } +[AssertionExtension("DoesNotExist")] public class FileDoesNotExistAssertion : Assertion { public FileDoesNotExistAssertion( @@ -268,6 +276,7 @@ protected override Task CheckAsync(EvaluationMetadata protected override string GetExpectation() => "to not exist"; } +[AssertionExtension("IsNotEmpty")] public class FileIsNotEmptyAssertion : Assertion { public FileIsNotEmptyAssertion( @@ -308,6 +317,7 @@ protected override Task CheckAsync(EvaluationMetadata protected override string GetExpectation() => "to not be empty"; } +[AssertionExtension("IsNotReadOnly")] public class FileIsNotReadOnlyAssertion : Assertion { public FileIsNotReadOnlyAssertion( @@ -348,6 +358,7 @@ protected override Task CheckAsync(EvaluationMetadata protected override string GetExpectation() => "to not be read-only"; } +[AssertionExtension("IsNotHidden")] public class FileIsNotHiddenAssertion : Assertion { public FileIsNotHiddenAssertion( @@ -388,6 +399,7 @@ protected override Task CheckAsync(EvaluationMetadata protected override string GetExpectation() => "to not be hidden"; } +[AssertionExtension("IsNotSystem")] public class FileIsNotSystemAssertion : Assertion { public FileIsNotSystemAssertion( @@ -428,6 +440,7 @@ protected override Task CheckAsync(EvaluationMetadata protected override string GetExpectation() => "to not be a system file"; } +[AssertionExtension("IsNotExecutable")] public class FileIsNotExecutableAssertion : Assertion { public FileIsNotExecutableAssertion( diff --git a/TUnit.Assertions/Conditions/GreaterThanAssertion.cs b/TUnit.Assertions/Conditions/GreaterThanAssertion.cs index f7fcf46c34..7169bee85e 100644 --- a/TUnit.Assertions/Conditions/GreaterThanAssertion.cs +++ b/TUnit.Assertions/Conditions/GreaterThanAssertion.cs @@ -1,4 +1,5 @@ using System.Text; +using TUnit.Assertions.Attributes; using TUnit.Assertions.Core; namespace TUnit.Assertions.Conditions; @@ -7,6 +8,7 @@ namespace TUnit.Assertions.Conditions; /// Asserts that a value is greater than a minimum value. /// Works for any comparable type. /// +[AssertionExtension("IsGreaterThan")] public class GreaterThanAssertion : Assertion where TValue : IComparable { @@ -44,6 +46,7 @@ protected override Task CheckAsync(EvaluationMetadata m /// /// Asserts that a value is greater than or equal to a minimum value. /// +[AssertionExtension("IsGreaterThanOrEqualTo")] public class GreaterThanOrEqualAssertion : Assertion where TValue : IComparable { diff --git a/TUnit.Assertions/Conditions/HttpStatusCodeAssertions.cs b/TUnit.Assertions/Conditions/HttpStatusCodeAssertions.cs index 1ebc439026..60d223643b 100644 --- a/TUnit.Assertions/Conditions/HttpStatusCodeAssertions.cs +++ b/TUnit.Assertions/Conditions/HttpStatusCodeAssertions.cs @@ -1,9 +1,11 @@ using System.Net; using System.Text; +using TUnit.Assertions.Attributes; using TUnit.Assertions.Core; namespace TUnit.Assertions.Conditions; +[AssertionExtension("IsSuccess")] public class IsSuccessStatusCodeAssertion : Assertion { public IsSuccessStatusCodeAssertion( @@ -34,6 +36,7 @@ protected override Task CheckAsync(EvaluationMetadata "to be a success status code (2xx)"; } +[AssertionExtension("IsNotSuccess")] public class IsNotSuccessStatusCodeAssertion : Assertion { public IsNotSuccessStatusCodeAssertion( @@ -64,6 +67,7 @@ protected override Task CheckAsync(EvaluationMetadata "to not be a success status code"; } +[AssertionExtension("IsClientError")] public class IsClientErrorStatusCodeAssertion : Assertion { public IsClientErrorStatusCodeAssertion( @@ -94,6 +98,7 @@ protected override Task CheckAsync(EvaluationMetadata "to be a client error status code (4xx)"; } +[AssertionExtension("IsServerError")] public class IsServerErrorStatusCodeAssertion : Assertion { public IsServerErrorStatusCodeAssertion( @@ -124,6 +129,7 @@ protected override Task CheckAsync(EvaluationMetadata "to be a server error status code (5xx)"; } +[AssertionExtension("IsRedirection")] public class IsRedirectionStatusCodeAssertion : Assertion { public IsRedirectionStatusCodeAssertion( @@ -154,6 +160,7 @@ protected override Task CheckAsync(EvaluationMetadata "to be a redirection status code (3xx)"; } +[AssertionExtension("IsInformational")] public class IsInformationalStatusCodeAssertion : Assertion { public IsInformationalStatusCodeAssertion( @@ -184,6 +191,7 @@ protected override Task CheckAsync(EvaluationMetadata "to be an informational status code (1xx)"; } +[AssertionExtension("IsError")] public class IsErrorStatusCodeAssertion : Assertion { public IsErrorStatusCodeAssertion( diff --git a/TUnit.Assertions/Conditions/LessThanAssertion.cs b/TUnit.Assertions/Conditions/LessThanAssertion.cs index 1cf0e0d32a..ffc16c368e 100644 --- a/TUnit.Assertions/Conditions/LessThanAssertion.cs +++ b/TUnit.Assertions/Conditions/LessThanAssertion.cs @@ -1,4 +1,5 @@ using System.Text; +using TUnit.Assertions.Attributes; using TUnit.Assertions.Core; namespace TUnit.Assertions.Conditions; @@ -6,6 +7,7 @@ namespace TUnit.Assertions.Conditions; /// /// Asserts that a value is less than a maximum value. /// +[AssertionExtension("IsLessThan")] public class LessThanAssertion : Assertion where TValue : IComparable { @@ -43,6 +45,7 @@ protected override Task CheckAsync(EvaluationMetadata m /// /// Asserts that a value is less than or equal to a maximum value. /// +[AssertionExtension("IsLessThanOrEqualTo")] public class LessThanOrEqualAssertion : Assertion where TValue : IComparable { diff --git a/TUnit.Assertions/Conditions/MiscellaneousAssertions.cs b/TUnit.Assertions/Conditions/MiscellaneousAssertions.cs index ff2a6fcc01..947700889b 100644 --- a/TUnit.Assertions/Conditions/MiscellaneousAssertions.cs +++ b/TUnit.Assertions/Conditions/MiscellaneousAssertions.cs @@ -1,9 +1,11 @@ using System.Text; +using TUnit.Assertions.Attributes; using TUnit.Assertions.Core; namespace TUnit.Assertions.Conditions; // Exception assertions +[AssertionExtension("HasInnerException")] public class HasInnerExceptionAssertion : Assertion { public HasInnerExceptionAssertion( @@ -38,6 +40,7 @@ protected override Task CheckAsync(EvaluationMetadata "to have an inner exception"; } +[AssertionExtension("HasNoInnerException")] public class HasNoInnerExceptionAssertion : Assertion { public HasNoInnerExceptionAssertion( @@ -72,6 +75,7 @@ protected override Task CheckAsync(EvaluationMetadata "to have no inner exception"; } +[AssertionExtension("HasStackTrace")] public class HasStackTraceAssertion : Assertion { public HasStackTraceAssertion( @@ -106,6 +110,7 @@ protected override Task CheckAsync(EvaluationMetadata "to have a stack trace"; } +[AssertionExtension("HasNoData")] public class HasNoDataAssertion : Assertion { public HasNoDataAssertion( @@ -141,6 +146,7 @@ protected override Task CheckAsync(EvaluationMetadata { public StringBuilderIsEmptyAssertion( @@ -175,6 +181,7 @@ protected override Task CheckAsync(EvaluationMetadata "to be empty"; } +[AssertionExtension("IsNotEmpty")] public class StringBuilderIsNotEmptyAssertion : Assertion { public StringBuilderIsNotEmptyAssertion( @@ -209,6 +216,7 @@ protected override Task CheckAsync(EvaluationMetadata "to not be empty"; } +[AssertionExtension("HasExcessCapacity")] public class StringBuilderHasExcessCapacityAssertion : Assertion { public StringBuilderHasExcessCapacityAssertion( @@ -244,6 +252,7 @@ protected override Task CheckAsync(EvaluationMetadata { public IsWeekendAssertion( @@ -273,6 +282,7 @@ protected override Task CheckAsync(EvaluationMetadata "to be a weekend day"; } +[AssertionExtension("IsWeekday")] public class IsWeekdayAssertion : Assertion { public IsWeekdayAssertion( @@ -302,6 +312,7 @@ protected override Task CheckAsync(EvaluationMetadata "to be a weekday"; } +[AssertionExtension("IsMonday")] public class IsMondayAssertion : Assertion { public IsMondayAssertion( @@ -331,6 +342,7 @@ protected override Task CheckAsync(EvaluationMetadata "to be Monday"; } +[AssertionExtension("IsFriday")] public class IsFridayAssertion : Assertion { public IsFridayAssertion( @@ -361,6 +373,7 @@ protected override Task CheckAsync(EvaluationMetadata { public IsAliveAssertion( @@ -395,6 +408,7 @@ protected override Task CheckAsync(EvaluationMetadata "to be alive"; } +[AssertionExtension("IsDead")] public class IsDeadAssertion : Assertion { public IsDeadAssertion( diff --git a/TUnit.Assertions/Conditions/NotEqualsAssertion.cs b/TUnit.Assertions/Conditions/NotEqualsAssertion.cs index 1e0c6c39d8..41615e7c9b 100644 --- a/TUnit.Assertions/Conditions/NotEqualsAssertion.cs +++ b/TUnit.Assertions/Conditions/NotEqualsAssertion.cs @@ -1,6 +1,7 @@ using System.Diagnostics.CodeAnalysis; using System.Reflection; using System.Text; +using TUnit.Assertions.Attributes; using TUnit.Assertions.Core; namespace TUnit.Assertions.Conditions; @@ -8,6 +9,7 @@ namespace TUnit.Assertions.Conditions; /// /// Asserts that a value is NOT equal to an expected value. /// +[AssertionExtension("IsNotEqualTo")] public class NotEqualsAssertion : Assertion { private readonly TValue _notExpected; diff --git a/TUnit.Assertions/Conditions/NullAssertion.cs b/TUnit.Assertions/Conditions/NullAssertion.cs index 0a81be8475..2e3e4ab753 100644 --- a/TUnit.Assertions/Conditions/NullAssertion.cs +++ b/TUnit.Assertions/Conditions/NullAssertion.cs @@ -1,4 +1,5 @@ using System.Text; +using TUnit.Assertions.Attributes; using TUnit.Assertions.Core; namespace TUnit.Assertions.Conditions; @@ -6,6 +7,7 @@ namespace TUnit.Assertions.Conditions; /// /// Asserts that a value is null. /// +[AssertionExtension("IsNull")] public class NullAssertion : Assertion { public NullAssertion( @@ -33,6 +35,7 @@ protected override Task CheckAsync(EvaluationMetadata m /// /// Asserts that a value is not null. /// +[AssertionExtension("IsNotNull")] public class NotNullAssertion : Assertion { public NotNullAssertion( @@ -61,6 +64,7 @@ protected override Task CheckAsync(EvaluationMetadata m /// Asserts that a value is equal to the default value for its type. /// For reference types, this is null. For value types, this is the zero-initialized value. /// +[AssertionExtension("IsDefault")] public class IsDefaultAssertion : Assertion { public IsDefaultAssertion( @@ -93,6 +97,7 @@ protected override Task CheckAsync(EvaluationMetadata m /// /// Asserts that a value is not the default value for its type. /// +[AssertionExtension("IsNotDefault")] public class IsNotDefaultAssertion : Assertion { public IsNotDefaultAssertion( diff --git a/TUnit.Assertions/Conditions/StringAssertions.cs b/TUnit.Assertions/Conditions/StringAssertions.cs index e3dc77ef37..e190155cf4 100644 --- a/TUnit.Assertions/Conditions/StringAssertions.cs +++ b/TUnit.Assertions/Conditions/StringAssertions.cs @@ -1,5 +1,6 @@ using System.Text; using System.Text.RegularExpressions; +using TUnit.Assertions.Attributes; using TUnit.Assertions.Core; namespace TUnit.Assertions.Conditions; @@ -7,6 +8,7 @@ namespace TUnit.Assertions.Conditions; /// /// Asserts that a string contains the expected substring. /// +[AssertionExtension("Contains")] public class StringContainsAssertion : Assertion { private readonly string _expected; @@ -94,6 +96,7 @@ protected override Task CheckAsync(EvaluationMetadata m /// /// Asserts that a string does NOT contain the expected substring. /// +[AssertionExtension("DoesNotContain")] public class StringDoesNotContainAssertion : Assertion { private readonly string _expected; @@ -150,6 +153,7 @@ protected override Task CheckAsync(EvaluationMetadata m /// /// Asserts that a string starts with the expected substring. /// +[AssertionExtension("StartsWith")] public class StringStartsWithAssertion : Assertion { private readonly string _expected; @@ -206,6 +210,7 @@ protected override Task CheckAsync(EvaluationMetadata m /// /// Asserts that a string ends with the expected substring. /// +[AssertionExtension("EndsWith")] public class StringEndsWithAssertion : Assertion { private readonly string _expected; @@ -262,6 +267,7 @@ protected override Task CheckAsync(EvaluationMetadata m /// /// Asserts that a string is not empty or whitespace. /// +[AssertionExtension("IsNotEmpty")] public class StringIsNotEmptyAssertion : Assertion { public StringIsNotEmptyAssertion( @@ -299,6 +305,7 @@ protected override Task CheckAsync(EvaluationMetadata m /// /// Asserts that a string is empty or whitespace. /// +[AssertionExtension("IsEmpty")] public class StringIsEmptyAssertion : Assertion { public StringIsEmptyAssertion( @@ -377,6 +384,7 @@ protected override Task CheckAsync(EvaluationMetadata m /// /// Asserts that a string is null, empty, or whitespace. /// +[AssertionExtension("IsNullOrWhitespace")] public class StringIsNullOrWhitespaceAssertion : Assertion { public StringIsNullOrWhitespaceAssertion( @@ -409,6 +417,7 @@ protected override Task CheckAsync(EvaluationMetadata m /// /// Asserts that a string matches a regular expression pattern. /// +[AssertionExtension("Matches")] public class StringMatchesAssertion : Assertion { private readonly string _pattern; @@ -493,6 +502,7 @@ protected override string GetExpectation() /// /// Asserts that a string does NOT match a regular expression pattern. /// +[AssertionExtension("DoesNotMatch")] public class StringDoesNotMatchAssertion : Assertion { private readonly string _pattern; @@ -577,6 +587,7 @@ protected override string GetExpectation() /// /// Asserts that a string is null or empty. /// +[AssertionExtension("IsNullOrEmpty")] public class StringIsNullOrEmptyAssertion : Assertion { public StringIsNullOrEmptyAssertion( @@ -609,6 +620,7 @@ protected override Task CheckAsync(EvaluationMetadata m /// /// Asserts that a string is NOT null or empty. /// +[AssertionExtension("IsNotNullOrEmpty")] public class StringIsNotNullOrEmptyAssertion : Assertion { public StringIsNotNullOrEmptyAssertion( diff --git a/TUnit.Assertions/Conditions/TypeOfAssertion.cs b/TUnit.Assertions/Conditions/TypeOfAssertion.cs index b39e65baca..13f6cd4ee2 100644 --- a/TUnit.Assertions/Conditions/TypeOfAssertion.cs +++ b/TUnit.Assertions/Conditions/TypeOfAssertion.cs @@ -1,4 +1,5 @@ using System.Text; +using TUnit.Assertions.Attributes; using TUnit.Assertions.Core; namespace TUnit.Assertions.Conditions; @@ -49,7 +50,8 @@ protected override Task CheckAsync(EvaluationMetadata meta /// Asserts that a value's type is assignable to a specific type (is the type or a subtype). /// Works with both direct value assertions and exception assertions (via .And after Throws). /// -public class IsAssignableToAssertion : Assertion +[AssertionExtension("IsAssignableTo")] +public class IsAssignableToAssertion : Assertion { private readonly Type _targetType; @@ -99,7 +101,8 @@ protected override Task CheckAsync(EvaluationMetadata m /// Asserts that a value's type is NOT assignable to a specific type. /// Works with both direct value assertions and exception assertions (via .And after Throws). /// -public class IsNotAssignableToAssertion : Assertion +[AssertionExtension("IsNotAssignableTo")] +public class IsNotAssignableToAssertion : Assertion { private readonly Type _targetType; diff --git a/TUnit.Assertions/Extensions/AssemblyAssertionExtensions.cs b/TUnit.Assertions/Extensions/AssemblyAssertionExtensions.cs deleted file mode 100644 index 1fe5a995a3..0000000000 --- a/TUnit.Assertions/Extensions/AssemblyAssertionExtensions.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System.Reflection; -using TUnit.Assertions.Conditions; -using TUnit.Assertions.Core; - -namespace TUnit.Assertions.Extensions; - -/// -/// Assembly-specific assertion extension methods. -/// -public static class AssemblyAssertionExtensions -{ - public static IsCollectibleAssertion IsCollectible(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsCollectible()"); - return new IsCollectibleAssertion(source.Context); - } - - public static IsNotCollectibleAssertion IsNotCollectible(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotCollectible()"); - return new IsNotCollectibleAssertion(source.Context); - } - - public static IsDynamicAssertion IsDynamic(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsDynamic()"); - return new IsDynamicAssertion(source.Context); - } - - public static IsNotDynamicAssertion IsNotDynamic(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotDynamic()"); - return new IsNotDynamicAssertion(source.Context); - } - - public static IsFullyTrustedAssertion IsFullyTrusted(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsFullyTrusted()"); - return new IsFullyTrustedAssertion(source.Context); - } - - public static IsNotFullyTrustedAssertion IsNotFullyTrusted(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotFullyTrusted()"); - return new IsNotFullyTrustedAssertion(source.Context); - } - - public static IsSignedAssertion IsSigned(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsSigned()"); - return new IsSignedAssertion(source.Context); - } - - public static IsNotSignedAssertion IsNotSigned(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotSigned()"); - return new IsNotSignedAssertion(source.Context); - } - - public static IsDebugBuildAssertion IsDebugBuild(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsDebugBuild()"); - return new IsDebugBuildAssertion(source.Context); - } - - public static IsReleaseBuildAssertion IsReleaseBuild(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsReleaseBuild()"); - return new IsReleaseBuildAssertion(source.Context); - } -} diff --git a/TUnit.Assertions/Extensions/AssertionExtensions.cs b/TUnit.Assertions/Extensions/AssertionExtensions.cs index b58f1fdf02..72c9ffc688 100644 --- a/TUnit.Assertions/Extensions/AssertionExtensions.cs +++ b/TUnit.Assertions/Extensions/AssertionExtensions.cs @@ -18,32 +18,13 @@ namespace TUnit.Assertions.Extensions; public static class AssertionExtensions { // ============ NULL CHECKS ============ - - /// - /// Asserts that the value is null. - /// - public static NullAssertion IsNull( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNull()"); - return new NullAssertion(source.Context); - } - - /// - /// Asserts that the value is not null. - /// - public static NotNullAssertion IsNotNull( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotNull()"); - return new NotNullAssertion(source.Context); - } + // IsNull and IsNotNull are now generated by AssertionExtensionGenerator // ============ EQUALITY ============ /// - /// Asserts that the value is equal to the expected value (generic version). - /// Works with assertions, And, and Or continuations! + /// Asserts that the value is equal to the expected value. + /// Generic method that works for all types. /// public static EqualsAssertion IsEqualTo( this IAssertionSource source, @@ -54,19 +35,6 @@ public static EqualsAssertion IsEqualTo( return new EqualsAssertion(source.Context, expected); } - /// - /// Asserts that the value is equal to the expected value using the specified comparer. - /// - public static EqualsAssertion IsEqualTo( - this IAssertionSource source, - TValue expected, - IEqualityComparer comparer, - [CallerArgumentExpression(nameof(expected))] string? expression = null) - { - source.Context.ExpressionBuilder.Append($".IsEqualTo({expression}, comparer)"); - return new EqualsAssertion(source.Context, expected, comparer); - } - /// /// Alias for IsEqualTo - asserts that the value is equal to the expected value. /// Works with assertions, And, and Or continuations! @@ -80,17 +48,7 @@ public static EqualsAssertion EqualTo( return new EqualsAssertion(source.Context, expected); } - /// - /// Asserts that the value is NOT equal to the expected value. - /// - public static NotEqualsAssertion IsNotEqualTo( - this IAssertionSource source, - TValue notExpected, - [CallerArgumentExpression(nameof(notExpected))] string? expression = null) - { - source.Context.ExpressionBuilder.Append($".IsNotEqualTo({expression})"); - return new NotEqualsAssertion(source.Context, notExpected); - } + // IsNotEqualTo is now generated by AssertionExtensionGenerator /// /// Asserts that the DateTime is equal to the expected value. @@ -200,74 +158,8 @@ public static DateTimeOffsetEqualsAssertion IsEqualTo( } // ============ COMPARISONS ============ - - /// - /// Asserts that the value is greater than the minimum. - /// - public static GreaterThanAssertion IsGreaterThan( - this IAssertionSource source, - TValue minimum, - [CallerArgumentExpression(nameof(minimum))] string? expression = null) - where TValue : IComparable - { - source.Context.ExpressionBuilder.Append($".IsGreaterThan({expression})"); - return new GreaterThanAssertion(source.Context, minimum); - } - - /// - /// Asserts that the value is greater than or equal to the minimum. - /// - public static GreaterThanOrEqualAssertion IsGreaterThanOrEqualTo( - this IAssertionSource source, - TValue minimum, - [CallerArgumentExpression(nameof(minimum))] string? expression = null) - where TValue : IComparable - { - source.Context.ExpressionBuilder.Append($".IsGreaterThanOrEqualTo({expression})"); - return new GreaterThanOrEqualAssertion(source.Context, minimum); - } - - /// - /// Asserts that the value is less than the maximum. - /// - public static LessThanAssertion IsLessThan( - this IAssertionSource source, - TValue maximum, - [CallerArgumentExpression(nameof(maximum))] string? expression = null) - where TValue : IComparable - { - source.Context.ExpressionBuilder.Append($".IsLessThan({expression})"); - return new LessThanAssertion(source.Context, maximum); - } - - /// - /// Asserts that the value is less than or equal to the maximum. - /// - public static LessThanOrEqualAssertion IsLessThanOrEqualTo( - this IAssertionSource source, - TValue maximum, - [CallerArgumentExpression(nameof(maximum))] string? expression = null) - where TValue : IComparable - { - source.Context.ExpressionBuilder.Append($".IsLessThanOrEqualTo({expression})"); - return new LessThanOrEqualAssertion(source.Context, maximum); - } - - /// - /// Asserts that the value is between minimum and maximum. - /// Returns BetweenAssertion with .Inclusive(), .Exclusive() methods! - /// - public static BetweenAssertion IsBetween( - this IAssertionSource source, - TValue minimum, - TValue maximum, - [CallerArgumentExpression(nameof(minimum))] string? minExpr = null, - [CallerArgumentExpression(nameof(maximum))] string? maxExpr = null) - where TValue : IComparable - { - source.Context.ExpressionBuilder.Append($".IsBetween({minExpr}, {maxExpr})"); - return new BetweenAssertion(source.Context, minimum, maximum); - } + // IsGreaterThan, IsGreaterThanOrEqualTo, IsLessThan, IsLessThanOrEqualTo, and IsBetween + // are now generated by AssertionExtensionGenerator /// /// Asserts that the numeric value is greater than zero (positive). @@ -332,16 +224,8 @@ public static LessThanAssertion IsNegative( } // ============ BOOLEAN ============ - - /// - /// Asserts that the boolean value is true. - /// - public static TrueAssertion IsTrue( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsTrue()"); - return new TrueAssertion(source.Context); - } + // IsTrue and IsFalse are now generated by AssertionExtensionGenerator for IAssertionSource + // Only And/Or continuation overloads remain here since generator doesn't create those /// /// Asserts that the boolean value is true (And continuation overload). @@ -365,16 +249,6 @@ public static Chaining.OrAssertion IsTrue( return new Chaining.OrAssertion(source.PreviousAssertion, newAssertion); } - /// - /// Asserts that the boolean value is false. - /// - public static FalseAssertion IsFalse( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsFalse()"); - return new FalseAssertion(source.Context); - } - /// /// Asserts that the boolean value is false (And continuation overload). /// @@ -502,11 +376,11 @@ public static Chaining.OrAssertion IsNotEqualTo( } // ============ TYPE CHECKS ============ + // IsTypeOf(Type), IsAssignableTo, IsNotAssignableTo are now generated by AssertionExtensionGenerator /// - /// Asserts that the value is of the specified type (single type parameter overload). - /// Returns an assertion typed to TExpected, enabling type-safe chaining! - /// Example: await Assert.That(obj).IsTypeOf<StringBuilder>(); + /// Asserts that the value is of the specified type and returns an assertion on the casted value (specialized for object). + /// Example: await Assert.That(obj).IsTypeOf(); /// public static TypeOfAssertion IsTypeOf( this IAssertionSource source) @@ -515,103 +389,56 @@ public static TypeOfAssertion IsTypeOf( return new TypeOfAssertion(source.Context); } + /// + /// Asserts that the value is of the specified type and returns an assertion on the casted value. + /// Example: await Assert.That(obj).IsTypeOf(); + /// + public static TypeOfAssertion IsTypeOf( + this IAssertionSource source) + { + source.Context.ExpressionBuilder.Append($".IsTypeOf<{typeof(TTo).Name}>()"); + return new TypeOfAssertion(source.Context); + } + /// /// Asserts that the value is of the specified type (runtime Type parameter). - /// Example: await Assert.That(obj).IsTypeOf(typeof(string)); + /// Example: await Assert.That(obj).IsOfType(typeof(string)); /// - public static Assertion IsTypeOf( - this IAssertionSource source, - Type expectedType) + public static IsTypeOfRuntimeAssertion IsOfType( + this IAssertionSource source, + Type expectedType, + [CallerArgumentExpression(nameof(expectedType))] string? expression = null) { - source.Context.ExpressionBuilder.Append($".IsTypeOf(typeof({expectedType.Name}))"); - return new IsTypeOfRuntimeAssertion(source.Context, expectedType); + source.Context.ExpressionBuilder.Append($".IsOfType({expression})"); + return new IsTypeOfRuntimeAssertion(source.Context, expectedType); } /// /// Asserts that the value is of the specified type (runtime Type parameter, for AndContinuation). - /// Example: await Assert.That(obj).IsEqualTo("foo").And.IsTypeOf(typeof(string)); + /// Example: await Assert.That(obj).IsEqualTo("foo").And.IsOfType(typeof(string)); /// - public static Chaining.AndAssertion IsTypeOf( + public static Chaining.AndAssertion IsOfType( this AndContinuation source, Type expectedType) { - source.Context.ExpressionBuilder.Append($".IsTypeOf(typeof({expectedType.Name}))"); + source.Context.ExpressionBuilder.Append($".IsOfType(typeof({expectedType.Name}))"); var newAssertion = new IsTypeOfRuntimeAssertion(source.Context, expectedType); return new Chaining.AndAssertion(source.PreviousAssertion, newAssertion); } /// /// Asserts that the value is of the specified type (runtime Type parameter, for OrContinuation). - /// Example: await Assert.That(obj).IsEqualTo("foo").Or.IsTypeOf(typeof(string)); + /// Example: await Assert.That(obj).IsEqualTo("foo").Or.IsOfType(typeof(string)); /// - public static Chaining.OrAssertion IsTypeOf( + public static Chaining.OrAssertion IsOfType( this OrContinuation source, Type expectedType) { - source.Context.ExpressionBuilder.Append($".IsTypeOf(typeof({expectedType.Name}))"); + source.Context.ExpressionBuilder.Append($".IsOfType(typeof({expectedType.Name}))"); var newAssertion = new IsTypeOfRuntimeAssertion(source.Context, expectedType); return new Chaining.OrAssertion(source.PreviousAssertion, newAssertion); } - /// - /// Asserts that the value is of the specified type (two type parameter overload). - /// Returns an assertion typed to TExpected, enabling type-safe chaining! - /// Example: await Assert.That(obj).IsTypeOf<string, object>(); - /// - public static TypeOfAssertion IsTypeOf( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append($".IsTypeOf<{typeof(TExpected).Name}>()"); - return new TypeOfAssertion(source.Context); - } - - - - /// - /// Asserts that the value's type is assignable to the specified type (is the type or a derived type). - /// Specific overload for object to avoid Polyfill package conflicts. - /// Example: await Assert.That((object)myDog).IsAssignableTo<Animal>(); - /// - public static IsAssignableToAssertion IsAssignableTo( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append($".IsAssignableTo<{typeof(TTarget).Name}>()"); - return new IsAssignableToAssertion(source.Context); - } - - /// - /// Asserts that the value's type is assignable to the specified type (is the type or a derived type). - /// Example: await Assert.That(myDog).IsAssignableTo<Animal>(); - /// - public static IsAssignableToAssertion IsAssignableTo( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append($".IsAssignableTo<{typeof(TTarget).Name}>()"); - return new IsAssignableToAssertion(source.Context); - } - - /// - /// Asserts that the value's type is NOT assignable to the specified type. - /// Specific overload for object to avoid Polyfill package conflicts. - /// Example: await Assert.That((object)myDog).IsNotAssignableTo<Cat>(); - /// - public static IsNotAssignableToAssertion IsNotAssignableTo( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append($".IsNotAssignableTo<{typeof(TTarget).Name}>()"); - return new IsNotAssignableToAssertion(source.Context); - } - - /// - /// Asserts that the value's type is NOT assignable to the specified type. - /// Example: await Assert.That(myDog).IsNotAssignableTo<Cat>(); - /// - public static IsNotAssignableToAssertion IsNotAssignableTo( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append($".IsNotAssignableTo<{typeof(TTarget).Name}>()"); - return new IsNotAssignableToAssertion(source.Context); - } /// /// Asserts on a member of an object using a lambda selector. @@ -654,94 +481,8 @@ public static NotSameReferenceAssertion IsNotSameReferenceAs( } // ============ STRING ASSERTIONS ============ - - /// - /// Asserts that the string contains the expected substring. - /// - public static StringContainsAssertion Contains( - this IAssertionSource source, - string expected, - [CallerArgumentExpression(nameof(expected))] string? expression = null) - { - source.Context.ExpressionBuilder.Append($".Contains({expression})"); - return new StringContainsAssertion(source.Context, expected); - } - - /// - /// Asserts that the string does NOT contain the expected substring. - /// - public static StringDoesNotContainAssertion DoesNotContain( - this IAssertionSource source, - string expected, - [CallerArgumentExpression(nameof(expected))] string? expression = null) - { - source.Context.ExpressionBuilder.Append($".DoesNotContain({expression})"); - return new StringDoesNotContainAssertion(source.Context, expected); - } - - /// - /// Asserts that the string starts with the expected substring. - /// - public static StringStartsWithAssertion StartsWith( - this IAssertionSource source, - string expected, - [CallerArgumentExpression(nameof(expected))] string? expression = null) - { - source.Context.ExpressionBuilder.Append($".StartsWith({expression})"); - return new StringStartsWithAssertion(source.Context, expected); - } - - /// - /// Asserts that the string ends with the expected substring. - /// - public static StringEndsWithAssertion EndsWith( - this IAssertionSource source, - string expected, - [CallerArgumentExpression(nameof(expected))] string? expression = null) - { - source.Context.ExpressionBuilder.Append($".EndsWith({expression})"); - return new StringEndsWithAssertion(source.Context, expected); - } - - /// - /// Asserts that the string is not empty or whitespace. - /// - public static StringIsNotEmptyAssertion IsNotEmpty( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotEmpty()"); - return new StringIsNotEmptyAssertion(source.Context); - } - - /// - /// Asserts that the string is empty or whitespace. - /// - public static StringIsEmptyAssertion IsEmpty( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsEmpty()"); - return new StringIsEmptyAssertion(source.Context); - } - - /// - /// Asserts that the string is null or empty. - /// - public static StringIsNullOrEmptyAssertion IsNullOrEmpty( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNullOrEmpty()"); - return new StringIsNullOrEmptyAssertion(source.Context); - } - - /// - /// Asserts that the string is NOT null or empty. - /// - public static StringIsNotNullOrEmptyAssertion IsNotNullOrEmpty( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotNullOrEmpty()"); - return new StringIsNotNullOrEmptyAssertion(source.Context); - } + // All string-specific assertion methods are now generated by AssertionExtensionGenerator + // from their respective assertion classes (StringContainsAssertion, StringStartsWithAssertion, etc.) /// /// Returns a wrapper for string length assertions. @@ -755,7 +496,7 @@ public static LengthWrapper HasLength( } /// - /// Asserts that the string has a specific length. + /// Asserts that the string has the expected length. /// Example: await Assert.That(str).HasLength(5); /// public static StringLengthAssertion HasLength( @@ -768,61 +509,14 @@ public static StringLengthAssertion HasLength( } /// - /// Asserts that the string is null, empty, or whitespace. - /// - public static StringIsNullOrWhitespaceAssertion IsNullOrWhitespace( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNullOrWhitespace()"); - return new StringIsNullOrWhitespaceAssertion(source.Context); - } - - /// - /// Asserts that the string matches a regular expression pattern. - /// - public static StringMatchesAssertion Matches( - this IAssertionSource source, - string pattern, - [CallerArgumentExpression(nameof(pattern))] string? expression = null) - { - source.Context.ExpressionBuilder.Append($".Matches({expression})"); - return new StringMatchesAssertion(source.Context, pattern); - } - - /// - /// Asserts that the string matches a regular expression. - /// - public static StringMatchesAssertion Matches( - this IAssertionSource source, - Regex regex, - [CallerArgumentExpression(nameof(regex))] string? expression = null) - { - source.Context.ExpressionBuilder.Append($".Matches({expression})"); - return new StringMatchesAssertion(source.Context, regex); - } - - /// - /// Asserts that the string does NOT match a regular expression pattern. - /// - public static StringDoesNotMatchAssertion DoesNotMatch( - this IAssertionSource source, - string pattern, - [CallerArgumentExpression(nameof(pattern))] string? expression = null) - { - source.Context.ExpressionBuilder.Append($".DoesNotMatch({expression})"); - return new StringDoesNotMatchAssertion(source.Context, pattern); - } - - /// - /// Asserts that the string does NOT match a regular expression. + /// Returns a wrapper for string length assertions (And continuation overload). + /// Example: await Assert.That(str).IsNotNull().And.HasLength().EqualTo(5); /// - public static StringDoesNotMatchAssertion DoesNotMatch( - this IAssertionSource source, - Regex regex, - [CallerArgumentExpression(nameof(regex))] string? expression = null) + public static LengthWrapper HasLength( + this AndContinuation source) { - source.Context.ExpressionBuilder.Append($".DoesNotMatch({expression})"); - return new StringDoesNotMatchAssertion(source.Context, regex); + source.Context.ExpressionBuilder.Append(".HasLength()"); + return new LengthWrapper(source.Context); } // ============ DICTIONARY ASSERTIONS ============ @@ -1881,26 +1575,7 @@ public static GreaterThanOrEqualAssertion IsAfterOrEqualTo( return new GreaterThanOrEqualAssertion(source.Context, expected); } - /// - /// Asserts that the value is equal to its default value. - /// For reference types, this is null. For value types, this is the zero-initialized value. - /// - public static IsDefaultAssertion IsDefault( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsDefault()"); - return new IsDefaultAssertion(source.Context); - } - - /// - /// Asserts that the value is not the default value for its type. - /// - public static IsNotDefaultAssertion IsNotDefault( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotDefault()"); - return new IsNotDefaultAssertion(source.Context); - } + // IsDefault and IsNotDefault are now generated by AssertionExtensionGenerator // ============ TIMING ASSERTIONS ============ @@ -2078,4 +1753,37 @@ public static Assertions.Enums.DoesNotHaveSameValueAsAssertion DoesNotHav source.Context.ExpressionBuilder.Append($".DoesNotHaveSameValueAs({expression})"); return new Assertions.Enums.DoesNotHaveSameValueAsAssertion(source.Context, otherEnumValue); } + + /// + /// Asserts that a value's type is assignable to a specific type (specialized for object). + /// Manual extension - should be auto-generated when generator works. + /// + public static IsAssignableToAssertion IsAssignableTo( + this IAssertionSource source) + { + source.Context.ExpressionBuilder.Append($".IsAssignableTo<{typeof(TTarget).Name}>()"); + return new IsAssignableToAssertion(source.Context); + } + + /// + /// Asserts that a value's type is assignable to a specific type. + /// Manual extension - should be auto-generated when generator works. + /// + public static IsAssignableToAssertion IsAssignableTo( + this IAssertionSource source) + { + source.Context.ExpressionBuilder.Append($".IsAssignableTo<{typeof(TTarget).Name}>()"); + return new IsAssignableToAssertion(source.Context); + } + + /// + /// Asserts that a value's type is NOT assignable to a specific type. + /// Manual extension - should be auto-generated when generator works. + /// + public static IsNotAssignableToAssertion IsNotAssignableTo( + this IAssertionSource source) + { + source.Context.ExpressionBuilder.Append($".IsNotAssignableTo<{typeof(TTarget).Name}>()"); + return new IsNotAssignableToAssertion(source.Context); + } } diff --git a/TUnit.Assertions/Extensions/CancellationTokenAssertionExtensions.cs b/TUnit.Assertions/Extensions/CancellationTokenAssertionExtensions.cs deleted file mode 100644 index 1cdaeb4431..0000000000 --- a/TUnit.Assertions/Extensions/CancellationTokenAssertionExtensions.cs +++ /dev/null @@ -1,46 +0,0 @@ -using TUnit.Assertions.Conditions; -using TUnit.Assertions.Core; - -namespace TUnit.Assertions.Extensions; - -/// -/// CancellationToken-specific assertion extension methods. -/// -public static class CancellationTokenAssertionExtensions -{ - public static CanBeCanceledAssertion CanBeCanceled(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".CanBeCanceled()"); - return new CanBeCanceledAssertion(source.Context); - } - - public static CannotBeCanceledAssertion CannotBeCanceled(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".CannotBeCanceled()"); - return new CannotBeCanceledAssertion(source.Context); - } - - public static IsCancellationRequestedAssertion IsCancellationRequested(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsCancellationRequested()"); - return new IsCancellationRequestedAssertion(source.Context); - } - - public static IsNotCancellationRequestedAssertion IsNotCancellationRequested(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotCancellationRequested()"); - return new IsNotCancellationRequestedAssertion(source.Context); - } - - public static IsNoneAssertion IsNone(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNone()"); - return new IsNoneAssertion(source.Context); - } - - public static IsNotNoneAssertion IsNotNone(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotNone()"); - return new IsNotNoneAssertion(source.Context); - } -} diff --git a/TUnit.Assertions/Extensions/CharAssertionExtensions.cs b/TUnit.Assertions/Extensions/CharAssertionExtensions.cs deleted file mode 100644 index 46d402f31e..0000000000 --- a/TUnit.Assertions/Extensions/CharAssertionExtensions.cs +++ /dev/null @@ -1,178 +0,0 @@ -using TUnit.Assertions.Conditions; -using TUnit.Assertions.Core; - -namespace TUnit.Assertions.Extensions; - -/// -/// Char-specific assertion extension methods. -/// -public static class CharAssertionExtensions -{ - public static IsLetterAssertion IsLetter(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsLetter()"); - return new IsLetterAssertion(source.Context); - } - - public static IsNotLetterAssertion IsNotLetter(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotLetter()"); - return new IsNotLetterAssertion(source.Context); - } - - public static IsDigitAssertion IsDigit(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsDigit()"); - return new IsDigitAssertion(source.Context); - } - - public static IsNotDigitAssertion IsNotDigit(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotDigit()"); - return new IsNotDigitAssertion(source.Context); - } - - public static IsWhiteSpaceAssertion IsWhiteSpace(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsWhiteSpace()"); - return new IsWhiteSpaceAssertion(source.Context); - } - - public static IsNotWhiteSpaceAssertion IsNotWhiteSpace(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotWhiteSpace()"); - return new IsNotWhiteSpaceAssertion(source.Context); - } - - public static IsUpperAssertion IsUpper(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsUpper()"); - return new IsUpperAssertion(source.Context); - } - - public static IsNotUpperAssertion IsNotUpper(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotUpper()"); - return new IsNotUpperAssertion(source.Context); - } - - public static IsLowerAssertion IsLower(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsLower()"); - return new IsLowerAssertion(source.Context); - } - - public static IsNotLowerAssertion IsNotLower(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotLower()"); - return new IsNotLowerAssertion(source.Context); - } - - public static IsControlAssertion IsControl(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsControl()"); - return new IsControlAssertion(source.Context); - } - - public static IsNotControlAssertion IsNotControl(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotControl()"); - return new IsNotControlAssertion(source.Context); - } - - public static IsPunctuationAssertion IsPunctuation(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsPunctuation()"); - return new IsPunctuationAssertion(source.Context); - } - - public static IsNotPunctuationAssertion IsNotPunctuation(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotPunctuation()"); - return new IsNotPunctuationAssertion(source.Context); - } - - public static IsSymbolAssertion IsSymbol(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsSymbol()"); - return new IsSymbolAssertion(source.Context); - } - - public static IsNotSymbolAssertion IsNotSymbol(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotSymbol()"); - return new IsNotSymbolAssertion(source.Context); - } - - public static IsNumberAssertion IsNumber(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNumber()"); - return new IsNumberAssertion(source.Context); - } - - public static IsNotNumberAssertion IsNotNumber(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotNumber()"); - return new IsNotNumberAssertion(source.Context); - } - - public static IsSeparatorAssertion IsSeparator(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsSeparator()"); - return new IsSeparatorAssertion(source.Context); - } - - public static IsNotSeparatorAssertion IsNotSeparator(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotSeparator()"); - return new IsNotSeparatorAssertion(source.Context); - } - - public static IsSurrogateAssertion IsSurrogate(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsSurrogate()"); - return new IsSurrogateAssertion(source.Context); - } - - public static IsNotSurrogateAssertion IsNotSurrogate(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotSurrogate()"); - return new IsNotSurrogateAssertion(source.Context); - } - - public static IsHighSurrogateAssertion IsHighSurrogate(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsHighSurrogate()"); - return new IsHighSurrogateAssertion(source.Context); - } - - public static IsNotHighSurrogateAssertion IsNotHighSurrogate(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotHighSurrogate()"); - return new IsNotHighSurrogateAssertion(source.Context); - } - - public static IsLowSurrogateAssertion IsLowSurrogate(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsLowSurrogate()"); - return new IsLowSurrogateAssertion(source.Context); - } - - public static IsNotLowSurrogateAssertion IsNotLowSurrogate(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotLowSurrogate()"); - return new IsNotLowSurrogateAssertion(source.Context); - } - - public static IsLetterOrDigitAssertion IsLetterOrDigit(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsLetterOrDigit()"); - return new IsLetterOrDigitAssertion(source.Context); - } - - public static IsNotLetterOrDigitAssertion IsNotLetterOrDigit(this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotLetterOrDigit()"); - return new IsNotLetterOrDigitAssertion(source.Context); - } -} diff --git a/TUnit.Assertions/Extensions/CultureInfoAssertionExtensions.cs b/TUnit.Assertions/Extensions/CultureInfoAssertionExtensions.cs deleted file mode 100644 index c83b53f375..0000000000 --- a/TUnit.Assertions/Extensions/CultureInfoAssertionExtensions.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System.Globalization; -using TUnit.Assertions.Conditions; -using TUnit.Assertions.Core; - -namespace TUnit.Assertions.Extensions; - -public static class CultureInfoAssertionExtensions -{ - public static IsInvariantCultureAssertion IsInvariant( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsInvariant()"); - return new IsInvariantCultureAssertion(source.Context); - } - - public static IsNotInvariantCultureAssertion IsNotInvariant( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotInvariant()"); - return new IsNotInvariantCultureAssertion(source.Context); - } - - public static IsNeutralCultureAssertion IsNeutralCulture( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNeutralCulture()"); - return new IsNeutralCultureAssertion(source.Context); - } - - public static IsNotNeutralCultureAssertion IsNotNeutralCulture( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotNeutralCulture()"); - return new IsNotNeutralCultureAssertion(source.Context); - } - - public static IsEnglishCultureAssertion IsEnglish( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsEnglish()"); - return new IsEnglishCultureAssertion(source.Context); - } - - public static IsNotEnglishCultureAssertion IsNotEnglish( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotEnglish()"); - return new IsNotEnglishCultureAssertion(source.Context); - } - - public static IsRightToLeftCultureAssertion IsRightToLeft( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsRightToLeft()"); - return new IsRightToLeftCultureAssertion(source.Context); - } - - public static IsLeftToRightCultureAssertion IsLeftToRight( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsLeftToRight()"); - return new IsLeftToRightCultureAssertion(source.Context); - } - - public static IsReadOnlyCultureAssertion IsReadOnly( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsReadOnly()"); - return new IsReadOnlyCultureAssertion(source.Context); - } -} - diff --git a/TUnit.Assertions/Extensions/DateTimeAssertionExtensions.cs b/TUnit.Assertions/Extensions/DateTimeAssertionExtensions.cs deleted file mode 100644 index be1be91312..0000000000 --- a/TUnit.Assertions/Extensions/DateTimeAssertionExtensions.cs +++ /dev/null @@ -1,104 +0,0 @@ -using System.Runtime.CompilerServices; -using TUnit.Assertions.Conditions; -using TUnit.Assertions.Core; - -namespace TUnit.Assertions.Extensions; - -/// -/// DateTime-specific assertion extension methods. -/// -public static class DateTimeAssertionExtensions -{ - /// - /// Asserts that the DateTime value represents today's date (ignoring time component). - /// - public static IsTodayAssertion IsToday( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsToday()"); - return new IsTodayAssertion(source.Context); - } - - /// - /// Asserts that the DateTime value does not represent today's date. - /// - public static IsNotTodayAssertion IsNotToday( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotToday()"); - return new IsNotTodayAssertion(source.Context); - } - - /// - /// Asserts that the DateTime value is in UTC. - /// - public static IsUtcAssertion IsUtc( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsUtc()"); - return new IsUtcAssertion(source.Context); - } - - /// - /// Asserts that the DateTime value is not in UTC. - /// - public static IsNotUtcAssertion IsNotUtc( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotUtc()"); - return new IsNotUtcAssertion(source.Context); - } - - /// - /// Asserts that the DateTime value is in a leap year. - /// - public static IsLeapYearAssertion IsLeapYear( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsLeapYear()"); - return new IsLeapYearAssertion(source.Context); - } - - /// - /// Asserts that the DateTime value is not in a leap year. - /// - public static IsNotLeapYearAssertion IsNotLeapYear( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotLeapYear()"); - return new IsNotLeapYearAssertion(source.Context); - } - - /// - /// Asserts that the DateTime value is during daylight saving time. - /// - public static IsDaylightSavingTimeAssertion IsDaylightSavingTime( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsDaylightSavingTime()"); - return new IsDaylightSavingTimeAssertion(source.Context); - } - - /// - /// Asserts that the DateTime value is not during daylight saving time. - /// - public static IsNotDaylightSavingTimeAssertion IsNotDaylightSavingTime( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotDaylightSavingTime()"); - return new IsNotDaylightSavingTimeAssertion(source.Context); - } - - /// - /// Asserts that the DateTime exactly equals the expected value (including ticks). - /// Use this instead of IsEqualTo when you need exact equality without tolerance. - /// - public static DateTimeEqualsExactAssertion EqualsExact( - this IAssertionSource source, - DateTime expected, - [CallerArgumentExpression(nameof(expected))] string? expression = null) - { - source.Context.ExpressionBuilder.Append($".EqualsExact({expression})"); - return new DateTimeEqualsExactAssertion(source.Context, expected); - } -} diff --git a/TUnit.Assertions/Extensions/EncodingAssertionExtensions.cs b/TUnit.Assertions/Extensions/EncodingAssertionExtensions.cs deleted file mode 100644 index 0a432011a4..0000000000 --- a/TUnit.Assertions/Extensions/EncodingAssertionExtensions.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System.Text; -using TUnit.Assertions.Conditions; -using TUnit.Assertions.Core; - -namespace TUnit.Assertions.Extensions; - -public static class EncodingAssertionExtensions -{ - public static IsUTF8EncodingAssertion IsUTF8( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsUTF8()"); - return new IsUTF8EncodingAssertion(source.Context); - } - - public static IsNotUTF8EncodingAssertion IsNotUTF8( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotUTF8()"); - return new IsNotUTF8EncodingAssertion(source.Context); - } - - public static IsASCIIEncodingAssertion IsASCII( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsASCII()"); - return new IsASCIIEncodingAssertion(source.Context); - } - - public static IsUnicodeEncodingAssertion IsUnicode( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsUnicode()"); - return new IsUnicodeEncodingAssertion(source.Context); - } - - public static IsUTF32EncodingAssertion IsUTF32( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsUTF32()"); - return new IsUTF32EncodingAssertion(source.Context); - } - - public static IsBigEndianUnicodeEncodingAssertion IsBigEndianUnicode( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsBigEndianUnicode()"); - return new IsBigEndianUnicodeEncodingAssertion(source.Context); - } - - public static IsSingleByteEncodingAssertion IsSingleByte( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsSingleByte()"); - return new IsSingleByteEncodingAssertion(source.Context); - } - - public static IsNotSingleByteEncodingAssertion IsNotSingleByte( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotSingleByte()"); - return new IsNotSingleByteEncodingAssertion(source.Context); - } -} diff --git a/TUnit.Assertions/Extensions/FileSystemAssertionExtensions.cs b/TUnit.Assertions/Extensions/FileSystemAssertionExtensions.cs deleted file mode 100644 index 955fb7e0fc..0000000000 --- a/TUnit.Assertions/Extensions/FileSystemAssertionExtensions.cs +++ /dev/null @@ -1,93 +0,0 @@ -using TUnit.Assertions.Conditions; -using TUnit.Assertions.Core; - -namespace TUnit.Assertions.Extensions; - -public static class FileSystemAssertionExtensions -{ - // DirectoryInfo extensions - public static DirectoryExistsAssertion Exists( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".Exists()"); - return new DirectoryExistsAssertion(source.Context); - } - - public static DirectoryDoesNotExistAssertion DoesNotExist( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".DoesNotExist()"); - return new DirectoryDoesNotExistAssertion(source.Context); - } - - public static DirectoryIsNotEmptyAssertion IsNotEmpty( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotEmpty()"); - return new DirectoryIsNotEmptyAssertion(source.Context); - } - - public static DirectoryHasFilesAssertion HasFiles( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".HasFiles()"); - return new DirectoryHasFilesAssertion(source.Context); - } - - public static DirectoryHasNoSubdirectoriesAssertion HasNoSubdirectories( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".HasNoSubdirectories()"); - return new DirectoryHasNoSubdirectoriesAssertion(source.Context); - } - - // FileInfo extensions - public static FileExistsAssertion Exists( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".Exists()"); - return new FileExistsAssertion(source.Context); - } - - public static FileDoesNotExistAssertion DoesNotExist( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".DoesNotExist()"); - return new FileDoesNotExistAssertion(source.Context); - } - - public static FileIsNotEmptyAssertion IsNotEmpty( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotEmpty()"); - return new FileIsNotEmptyAssertion(source.Context); - } - - public static FileIsNotReadOnlyAssertion IsNotReadOnly( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotReadOnly()"); - return new FileIsNotReadOnlyAssertion(source.Context); - } - - public static FileIsNotHiddenAssertion IsNotHidden( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotHidden()"); - return new FileIsNotHiddenAssertion(source.Context); - } - - public static FileIsNotSystemAssertion IsNotSystem( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotSystem()"); - return new FileIsNotSystemAssertion(source.Context); - } - - public static FileIsNotExecutableAssertion IsNotExecutable( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotExecutable()"); - return new FileIsNotExecutableAssertion(source.Context); - } -} diff --git a/TUnit.Assertions/Extensions/HttpStatusCodeAssertionExtensions.cs b/TUnit.Assertions/Extensions/HttpStatusCodeAssertionExtensions.cs deleted file mode 100644 index 524be6d693..0000000000 --- a/TUnit.Assertions/Extensions/HttpStatusCodeAssertionExtensions.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System.Net; -using TUnit.Assertions.Conditions; -using TUnit.Assertions.Core; - -namespace TUnit.Assertions.Extensions; - -public static class HttpStatusCodeAssertionExtensions -{ - public static IsSuccessStatusCodeAssertion IsSuccess( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsSuccess()"); - return new IsSuccessStatusCodeAssertion(source.Context); - } - - public static IsNotSuccessStatusCodeAssertion IsNotSuccess( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotSuccess()"); - return new IsNotSuccessStatusCodeAssertion(source.Context); - } - - public static IsClientErrorStatusCodeAssertion IsClientError( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsClientError()"); - return new IsClientErrorStatusCodeAssertion(source.Context); - } - - public static IsServerErrorStatusCodeAssertion IsServerError( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsServerError()"); - return new IsServerErrorStatusCodeAssertion(source.Context); - } - - public static IsRedirectionStatusCodeAssertion IsRedirection( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsRedirection()"); - return new IsRedirectionStatusCodeAssertion(source.Context); - } - - public static IsInformationalStatusCodeAssertion IsInformational( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsInformational()"); - return new IsInformationalStatusCodeAssertion(source.Context); - } - - public static IsErrorStatusCodeAssertion IsError( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsError()"); - return new IsErrorStatusCodeAssertion(source.Context); - } -} diff --git a/TUnit.Assertions/Extensions/MiscellaneousAssertionExtensions.cs b/TUnit.Assertions/Extensions/MiscellaneousAssertionExtensions.cs deleted file mode 100644 index 79c7cd1b95..0000000000 --- a/TUnit.Assertions/Extensions/MiscellaneousAssertionExtensions.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System.Text; -using TUnit.Assertions.Conditions; -using TUnit.Assertions.Core; - -namespace TUnit.Assertions.Extensions; - -public static class MiscellaneousAssertionExtensions -{ - // Exception extensions - public static HasInnerExceptionAssertion HasInnerException( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".HasInnerException()"); - return new HasInnerExceptionAssertion(source.Context); - } - - public static HasNoInnerExceptionAssertion HasNoInnerException( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".HasNoInnerException()"); - return new HasNoInnerExceptionAssertion(source.Context); - } - - public static HasStackTraceAssertion HasStackTrace( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".HasStackTrace()"); - return new HasStackTraceAssertion(source.Context); - } - - public static HasNoDataAssertion HasNoData( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".HasNoData()"); - return new HasNoDataAssertion(source.Context); - } - - // StringBuilder extensions - public static StringBuilderIsEmptyAssertion IsEmpty( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsEmpty()"); - return new StringBuilderIsEmptyAssertion(source.Context); - } - - public static StringBuilderIsNotEmptyAssertion IsNotEmpty( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsNotEmpty()"); - return new StringBuilderIsNotEmptyAssertion(source.Context); - } - - public static StringBuilderHasExcessCapacityAssertion HasExcessCapacity( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".HasExcessCapacity()"); - return new StringBuilderHasExcessCapacityAssertion(source.Context); - } - - // DayOfWeek extensions - public static IsWeekendAssertion IsWeekend( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsWeekend()"); - return new IsWeekendAssertion(source.Context); - } - - public static IsWeekdayAssertion IsWeekday( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsWeekday()"); - return new IsWeekdayAssertion(source.Context); - } - - public static IsMondayAssertion IsMonday( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsMonday()"); - return new IsMondayAssertion(source.Context); - } - - public static IsFridayAssertion IsFriday( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsFriday()"); - return new IsFridayAssertion(source.Context); - } - - // WeakReference extensions - public static IsAliveAssertion IsAlive( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsAlive()"); - return new IsAliveAssertion(source.Context); - } - - public static IsDeadAssertion IsDead( - this IAssertionSource source) - { - source.Context.ExpressionBuilder.Append(".IsDead()"); - return new IsDeadAssertion(source.Context); - } -} diff --git a/TUnit.PublicAPI/Tests.Assertions_Library_Has_No_API_Changes.DotNet10_0.verified.txt b/TUnit.PublicAPI/Tests.Assertions_Library_Has_No_API_Changes.DotNet10_0.verified.txt index 22b4d1cb2b..9b34fd08dc 100644 --- a/TUnit.PublicAPI/Tests.Assertions_Library_Has_No_API_Changes.DotNet10_0.verified.txt +++ b/TUnit.PublicAPI/Tests.Assertions_Library_Has_No_API_Changes.DotNet10_0.verified.txt @@ -145,6 +145,13 @@ namespace . } namespace .Attributes { + [(.Class, AllowMultiple=false)] + public class AssertionExtensionAttribute : + { + public AssertionExtensionAttribute(string methodName) { } + public string MethodName { get; } + public string? NegatedMethodName { get; set; } + } [(.Class, AllowMultiple=true)] public class CreateAssertionAttribute : { @@ -217,6 +224,7 @@ namespace .Conditions public TSelf WithMessageNotContaining(string notExpectedSubstring, comparison, [.("notExpectedSubstring")] string? expression = null) { } public TSelf WithParameterName(string expectedParameterName, [.("expectedParameterName")] string? expression = null) { } } + [.("IsBetween")] public class BetweenAssertion : . where TValue : { @@ -228,12 +236,14 @@ namespace .Conditions public . InclusiveMaximum() { } public . InclusiveMinimum() { } } + [.("CanBeCanceled")] public class CanBeCanceledAssertion : .<.CancellationToken> { public CanBeCanceledAssertion(.<.CancellationToken> context) { } protected override .<.> CheckAsync(.<.CancellationToken> metadata) { } protected override string GetExpectation() { } } + [.("CannotBeCanceled")] public class CannotBeCanceledAssertion : .<.CancellationToken> { public CannotBeCanceledAssertion(.<.CancellationToken> context) { } @@ -366,6 +376,7 @@ namespace .Conditions protected override string GetExpectation() { } public . Within( tolerance) { } } + [.("EqualsExact")] public class DateTimeEqualsExactAssertion : .<> { public DateTimeEqualsExactAssertion(.<> context, expected) { } @@ -391,30 +402,35 @@ namespace .Conditions protected override .<.> CheckAsync(.<.> metadata) { } protected override string GetExpectation() { } } + [.("DoesNotExist")] public class DirectoryDoesNotExistAssertion : .<.DirectoryInfo> { public DirectoryDoesNotExistAssertion(.<.DirectoryInfo> context) { } protected override .<.> CheckAsync(.<.DirectoryInfo> metadata) { } protected override string GetExpectation() { } } + [.("Exists")] public class DirectoryExistsAssertion : .<.DirectoryInfo> { public DirectoryExistsAssertion(.<.DirectoryInfo> context) { } protected override .<.> CheckAsync(.<.DirectoryInfo> metadata) { } protected override string GetExpectation() { } } + [.("HasFiles")] public class DirectoryHasFilesAssertion : .<.DirectoryInfo> { public DirectoryHasFilesAssertion(.<.DirectoryInfo> context) { } protected override .<.> CheckAsync(.<.DirectoryInfo> metadata) { } protected override string GetExpectation() { } } + [.("HasNoSubdirectories")] public class DirectoryHasNoSubdirectoriesAssertion : .<.DirectoryInfo> { public DirectoryHasNoSubdirectoriesAssertion(.<.DirectoryInfo> context) { } protected override .<.> CheckAsync(.<.DirectoryInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotEmpty")] public class DirectoryIsNotEmptyAssertion : .<.DirectoryInfo> { public DirectoryIsNotEmptyAssertion(.<.DirectoryInfo> context) { } @@ -445,54 +461,63 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsFalse")] public class FalseAssertion : . { public FalseAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("DoesNotExist")] public class FileDoesNotExistAssertion : .<.FileInfo> { public FileDoesNotExistAssertion(.<.FileInfo> context) { } protected override .<.> CheckAsync(.<.FileInfo> metadata) { } protected override string GetExpectation() { } } + [.("Exists")] public class FileExistsAssertion : .<.FileInfo> { public FileExistsAssertion(.<.FileInfo> context) { } protected override .<.> CheckAsync(.<.FileInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotEmpty")] public class FileIsNotEmptyAssertion : .<.FileInfo> { public FileIsNotEmptyAssertion(.<.FileInfo> context) { } protected override .<.> CheckAsync(.<.FileInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotExecutable")] public class FileIsNotExecutableAssertion : .<.FileInfo> { public FileIsNotExecutableAssertion(.<.FileInfo> context) { } protected override .<.> CheckAsync(.<.FileInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotHidden")] public class FileIsNotHiddenAssertion : .<.FileInfo> { public FileIsNotHiddenAssertion(.<.FileInfo> context) { } protected override .<.> CheckAsync(.<.FileInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotReadOnly")] public class FileIsNotReadOnlyAssertion : .<.FileInfo> { public FileIsNotReadOnlyAssertion(.<.FileInfo> context) { } protected override .<.> CheckAsync(.<.FileInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotSystem")] public class FileIsNotSystemAssertion : .<.FileInfo> { public FileIsNotSystemAssertion(.<.FileInfo> context) { } protected override .<.> CheckAsync(.<.FileInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsGreaterThan")] public class GreaterThanAssertion : . where TValue : { @@ -500,6 +525,7 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsGreaterThanOrEqualTo")] public class GreaterThanOrEqualAssertion : . where TValue : { @@ -514,6 +540,7 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("HasInnerException")] public class HasInnerExceptionAssertion : .<> { public HasInnerExceptionAssertion(.<> context) { } @@ -538,12 +565,14 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("HasNoData")] public class HasNoDataAssertion : .<> { public HasNoDataAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("HasNoInnerException")] public class HasNoInnerExceptionAssertion : .<> { public HasNoInnerExceptionAssertion(.<> context) { } @@ -557,96 +586,112 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("HasStackTrace")] public class HasStackTraceAssertion : .<> { public HasStackTraceAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsASCII")] public class IsASCIIEncodingAssertion : .<.Encoding> { public IsASCIIEncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsAlive")] public class IsAliveAssertion : .<> { public IsAliveAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } - public class IsAssignableToAssertion : . + [.("IsAssignableTo")] + public class IsAssignableToAssertion : . { public IsAssignableToAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsBigEndianUnicode")] public class IsBigEndianUnicodeEncodingAssertion : .<.Encoding> { public IsBigEndianUnicodeEncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsCancellationRequested")] public class IsCancellationRequestedAssertion : .<.CancellationToken> { public IsCancellationRequestedAssertion(.<.CancellationToken> context) { } protected override .<.> CheckAsync(.<.CancellationToken> metadata) { } protected override string GetExpectation() { } } + [.("IsClientError")] public class IsClientErrorStatusCodeAssertion : .<.HttpStatusCode> { public IsClientErrorStatusCodeAssertion(.<.HttpStatusCode> context) { } protected override .<.> CheckAsync(.<.HttpStatusCode> metadata) { } protected override string GetExpectation() { } } + [.("IsCollectible")] public class IsCollectibleAssertion : .<.Assembly> { public IsCollectibleAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsControl")] public class IsControlAssertion : . { public IsControlAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsDaylightSavingTime")] public class IsDaylightSavingTimeAssertion : .<> { public IsDaylightSavingTimeAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsDead")] public class IsDeadAssertion : .<> { public IsDeadAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsDebugBuild")] public class IsDebugBuildAssertion : .<.Assembly> { public IsDebugBuildAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsDefault")] public class IsDefaultAssertion : . { public IsDefaultAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsDigit")] public class IsDigitAssertion : . { public IsDigitAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsDynamic")] public class IsDynamicAssertion : .<.Assembly> { public IsDynamicAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsEnglish")] public class IsEnglishCultureAssertion : .<.CultureInfo> { public IsEnglishCultureAssertion(.<.CultureInfo> context) { } @@ -668,24 +713,28 @@ namespace .Conditions protected override string GetExpectation() { } public . Using(. comparer) { } } + [.("IsError")] public class IsErrorStatusCodeAssertion : .<.HttpStatusCode> { public IsErrorStatusCodeAssertion(.<.HttpStatusCode> context) { } protected override .<.> CheckAsync(.<.HttpStatusCode> metadata) { } protected override string GetExpectation() { } } + [.("IsFriday")] public class IsFridayAssertion : .<> { public IsFridayAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsFullyTrusted")] public class IsFullyTrustedAssertion : .<.Assembly> { public IsFullyTrustedAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsHighSurrogate")] public class IsHighSurrogateAssertion : . { public IsHighSurrogateAssertion(. context) { } @@ -699,132 +748,154 @@ namespace .Conditions protected override string GetExpectation() { } public . Using(. comparer) { } } + [.("IsInformational")] public class IsInformationalStatusCodeAssertion : .<.HttpStatusCode> { public IsInformationalStatusCodeAssertion(.<.HttpStatusCode> context) { } protected override .<.> CheckAsync(.<.HttpStatusCode> metadata) { } protected override string GetExpectation() { } } + [.("IsInvariant")] public class IsInvariantCultureAssertion : .<.CultureInfo> { public IsInvariantCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsLeapYear")] public class IsLeapYearAssertion : .<> { public IsLeapYearAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsLeftToRight")] public class IsLeftToRightCultureAssertion : .<.CultureInfo> { public IsLeftToRightCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsLetter")] public class IsLetterAssertion : . { public IsLetterAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsLetterOrDigit")] public class IsLetterOrDigitAssertion : . { public IsLetterOrDigitAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsLowSurrogate")] public class IsLowSurrogateAssertion : . { public IsLowSurrogateAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsLower")] public class IsLowerAssertion : . { public IsLowerAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsMonday")] public class IsMondayAssertion : .<> { public IsMondayAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsNeutralCulture")] public class IsNeutralCultureAssertion : .<.CultureInfo> { public IsNeutralCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNone")] public class IsNoneAssertion : .<.CancellationToken> { public IsNoneAssertion(.<.CancellationToken> context) { } protected override .<.> CheckAsync(.<.CancellationToken> metadata) { } protected override string GetExpectation() { } } - public class IsNotAssignableToAssertion : . + [.("IsNotAssignableTo")] + public class IsNotAssignableToAssertion : . { public IsNotAssignableToAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotCancellationRequested")] public class IsNotCancellationRequestedAssertion : .<.CancellationToken> { public IsNotCancellationRequestedAssertion(.<.CancellationToken> context) { } protected override .<.> CheckAsync(.<.CancellationToken> metadata) { } protected override string GetExpectation() { } } + [.("IsNotCollectible")] public class IsNotCollectibleAssertion : .<.Assembly> { public IsNotCollectibleAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsNotControl")] public class IsNotControlAssertion : . { public IsNotControlAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotDaylightSavingTime")] public class IsNotDaylightSavingTimeAssertion : .<> { public IsNotDaylightSavingTimeAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsNotDefault")] public class IsNotDefaultAssertion : . { public IsNotDefaultAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotDigit")] public class IsNotDigitAssertion : . { public IsNotDigitAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotDynamic")] public class IsNotDynamicAssertion : .<.Assembly> { public IsNotDynamicAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsNotEnglish")] public class IsNotEnglishCultureAssertion : .<.CultureInfo> { public IsNotEnglishCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotFullyTrusted")] public class IsNotFullyTrustedAssertion : .<.Assembly> { public IsNotFullyTrustedAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsNotHighSurrogate")] public class IsNotHighSurrogateAssertion : . { public IsNotHighSurrogateAssertion(. context) { } @@ -838,210 +909,245 @@ namespace .Conditions protected override string GetExpectation() { } public . Using(. comparer) { } } + [.("IsNotInvariant")] public class IsNotInvariantCultureAssertion : .<.CultureInfo> { public IsNotInvariantCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotLeapYear")] public class IsNotLeapYearAssertion : .<> { public IsNotLeapYearAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsNotLetter")] public class IsNotLetterAssertion : . { public IsNotLetterAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotLetterOrDigit")] public class IsNotLetterOrDigitAssertion : . { public IsNotLetterOrDigitAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotLowSurrogate")] public class IsNotLowSurrogateAssertion : . { public IsNotLowSurrogateAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotLower")] public class IsNotLowerAssertion : . { public IsNotLowerAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotNeutralCulture")] public class IsNotNeutralCultureAssertion : .<.CultureInfo> { public IsNotNeutralCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotNone")] public class IsNotNoneAssertion : .<.CancellationToken> { public IsNotNoneAssertion(.<.CancellationToken> context) { } protected override .<.> CheckAsync(.<.CancellationToken> metadata) { } protected override string GetExpectation() { } } + [.("IsNotNumber")] public class IsNotNumberAssertion : . { public IsNotNumberAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotPunctuation")] public class IsNotPunctuationAssertion : . { public IsNotPunctuationAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotSeparator")] public class IsNotSeparatorAssertion : . { public IsNotSeparatorAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotSigned")] public class IsNotSignedAssertion : .<.Assembly> { public IsNotSignedAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsNotSingleByte")] public class IsNotSingleByteEncodingAssertion : .<.Encoding> { public IsNotSingleByteEncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsNotSuccess")] public class IsNotSuccessStatusCodeAssertion : .<.HttpStatusCode> { public IsNotSuccessStatusCodeAssertion(.<.HttpStatusCode> context) { } protected override .<.> CheckAsync(.<.HttpStatusCode> metadata) { } protected override string GetExpectation() { } } + [.("IsNotSurrogate")] public class IsNotSurrogateAssertion : . { public IsNotSurrogateAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotSymbol")] public class IsNotSymbolAssertion : . { public IsNotSymbolAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotToday")] public class IsNotTodayAssertion : .<> { public IsNotTodayAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsNotUTF8")] public class IsNotUTF8EncodingAssertion : .<.Encoding> { public IsNotUTF8EncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsNotUpper")] public class IsNotUpperAssertion : . { public IsNotUpperAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotUtc")] public class IsNotUtcAssertion : .<> { public IsNotUtcAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsNotWhiteSpace")] public class IsNotWhiteSpaceAssertion : . { public IsNotWhiteSpaceAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNumber")] public class IsNumberAssertion : . { public IsNumberAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsPunctuation")] public class IsPunctuationAssertion : . { public IsPunctuationAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsReadOnly")] public class IsReadOnlyCultureAssertion : .<.CultureInfo> { public IsReadOnlyCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsRedirection")] public class IsRedirectionStatusCodeAssertion : .<.HttpStatusCode> { public IsRedirectionStatusCodeAssertion(.<.HttpStatusCode> context) { } protected override .<.> CheckAsync(.<.HttpStatusCode> metadata) { } protected override string GetExpectation() { } } + [.("IsReleaseBuild")] public class IsReleaseBuildAssertion : .<.Assembly> { public IsReleaseBuildAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsRightToLeft")] public class IsRightToLeftCultureAssertion : .<.CultureInfo> { public IsRightToLeftCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsSeparator")] public class IsSeparatorAssertion : . { public IsSeparatorAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsServerError")] public class IsServerErrorStatusCodeAssertion : .<.HttpStatusCode> { public IsServerErrorStatusCodeAssertion(.<.HttpStatusCode> context) { } protected override .<.> CheckAsync(.<.HttpStatusCode> metadata) { } protected override string GetExpectation() { } } + [.("IsSigned")] public class IsSignedAssertion : .<.Assembly> { public IsSignedAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsSingleByte")] public class IsSingleByteEncodingAssertion : .<.Encoding> { public IsSingleByteEncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsSuccess")] public class IsSuccessStatusCodeAssertion : .<.HttpStatusCode> { public IsSuccessStatusCodeAssertion(.<.HttpStatusCode> context) { } protected override .<.> CheckAsync(.<.HttpStatusCode> metadata) { } protected override string GetExpectation() { } } + [.("IsSurrogate")] public class IsSurrogateAssertion : . { public IsSurrogateAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsSymbol")] public class IsSymbolAssertion : . { public IsSymbolAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsToday")] public class IsTodayAssertion : .<> { public IsTodayAssertion(.<> context) { } @@ -1054,54 +1160,63 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsUTF32")] public class IsUTF32EncodingAssertion : .<.Encoding> { public IsUTF32EncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsUTF8")] public class IsUTF8EncodingAssertion : .<.Encoding> { public IsUTF8EncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsUnicode")] public class IsUnicodeEncodingAssertion : .<.Encoding> { public IsUnicodeEncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsUpper")] public class IsUpperAssertion : . { public IsUpperAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsUtc")] public class IsUtcAssertion : .<> { public IsUtcAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsWeekday")] public class IsWeekdayAssertion : .<> { public IsWeekdayAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsWeekend")] public class IsWeekendAssertion : .<> { public IsWeekendAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsWhiteSpace")] public class IsWhiteSpaceAssertion : . { public IsWhiteSpaceAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsLessThan")] public class LessThanAssertion : . where TValue : { @@ -1109,6 +1224,7 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsLessThanOrEqualTo")] public class LessThanOrEqualAssertion : . where TValue : { @@ -1135,6 +1251,7 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotEqualTo")] public class NotEqualsAssertion : . { public NotEqualsAssertion(. context, TValue notExpected, .? comparer = null) { } @@ -1151,6 +1268,7 @@ namespace .Conditions protected override string GetExpectation() { } public . Using(. comparer) { } } + [.("IsNotNull")] public class NotNullAssertion : . { public NotNullAssertion(. context) { } @@ -1173,6 +1291,7 @@ namespace .Conditions public . IgnoringType() { } public . WithPartialEquivalency() { } } + [.("IsNull")] public class NullAssertion : . { public NullAssertion(. context) { } @@ -1191,24 +1310,28 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("HasExcessCapacity")] public class StringBuilderHasExcessCapacityAssertion : .<.StringBuilder> { public StringBuilderHasExcessCapacityAssertion(.<.StringBuilder> context) { } protected override .<.> CheckAsync(.<.StringBuilder> metadata) { } protected override string GetExpectation() { } } + [.("IsEmpty")] public class StringBuilderIsEmptyAssertion : .<.StringBuilder> { public StringBuilderIsEmptyAssertion(.<.StringBuilder> context) { } protected override .<.> CheckAsync(.<.StringBuilder> metadata) { } protected override string GetExpectation() { } } + [.("IsNotEmpty")] public class StringBuilderIsNotEmptyAssertion : .<.StringBuilder> { public StringBuilderIsNotEmptyAssertion(.<.StringBuilder> context) { } protected override .<.> CheckAsync(.<.StringBuilder> metadata) { } protected override string GetExpectation() { } } + [.("Contains")] public class StringContainsAssertion : . { public StringContainsAssertion(. context, string expected) { } @@ -1219,6 +1342,7 @@ namespace .Conditions public . WithComparison( comparison) { } public . WithTrimming() { } } + [.("DoesNotContain")] public class StringDoesNotContainAssertion : . { public StringDoesNotContainAssertion(. context, string expected) { } @@ -1227,6 +1351,7 @@ namespace .Conditions public . IgnoringCase() { } public . WithComparison( comparison) { } } + [.("DoesNotMatch")] public class StringDoesNotMatchAssertion : . { public StringDoesNotMatchAssertion(. context, . regex) { } @@ -1236,6 +1361,7 @@ namespace .Conditions public . IgnoringCase() { } public . WithOptions(. options) { } } + [.("EndsWith")] public class StringEndsWithAssertion : . { public StringEndsWithAssertion(. context, string expected) { } @@ -1255,30 +1381,35 @@ namespace .Conditions public . WithNullAndEmptyEquality() { } public . WithTrimming() { } } + [.("IsEmpty")] public class StringIsEmptyAssertion : . { public StringIsEmptyAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotEmpty")] public class StringIsNotEmptyAssertion : . { public StringIsNotEmptyAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotNullOrEmpty")] public class StringIsNotNullOrEmptyAssertion : . { public StringIsNotNullOrEmptyAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNullOrEmpty")] public class StringIsNullOrEmptyAssertion : . { public StringIsNullOrEmptyAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNullOrWhitespace")] public class StringIsNullOrWhitespaceAssertion : . { public StringIsNullOrWhitespaceAssertion(. context) { } @@ -1291,6 +1422,7 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("Matches")] public class StringMatchesAssertion : . { public StringMatchesAssertion(. context, . regex) { } @@ -1300,6 +1432,7 @@ namespace .Conditions public . IgnoringCase() { } public . WithOptions(. options) { } } + [.("StartsWith")] public class StringStartsWithAssertion : . { public StringStartsWithAssertion(. context, string expected) { } @@ -1346,6 +1479,7 @@ namespace .Conditions protected override string GetExpectation() { } public . Within( tolerance) { } } + [.("IsTrue")] public class TrueAssertion : . { public TrueAssertion(. context) { } @@ -1492,19 +1626,6 @@ namespace .Exceptions } namespace .Extensions { - public static class AssemblyAssertionExtensions - { - public static . IsCollectible(this .<.Assembly> source) { } - public static . IsDebugBuild(this .<.Assembly> source) { } - public static . IsDynamic(this .<.Assembly> source) { } - public static . IsFullyTrusted(this .<.Assembly> source) { } - public static . IsNotCollectible(this .<.Assembly> source) { } - public static . IsNotDynamic(this .<.Assembly> source) { } - public static . IsNotFullyTrusted(this .<.Assembly> source) { } - public static . IsNotSigned(this .<.Assembly> source) { } - public static . IsReleaseBuild(this .<.Assembly> source) { } - public static . IsSigned(this .<.Assembly> source) { } - } public static class AssertionExtensions { public static .<., TItem> All(this .<.> source) { } @@ -1517,7 +1638,6 @@ namespace .Extensions where TCollection : . { } public static . CompletesWithin(this . source, timeout, [.("timeout")] string? expression = null) { } public static . CompletesWithin(this . source, timeout, [.("timeout")] string? expression = null) { } - public static . Contains(this . source, string expected, [.("expected")] string? expression = null) { } public static .<., TItem> Contains(this .<.> source, predicate, [.("predicate")] string? expression = null) { } public static .<., TItem> Contains(this .<.> source, TItem expected, [.("expected")] string? expression = null) { } public static . Contains(this . source, TItem expected, [.("expected")] string? expression = null) @@ -1537,7 +1657,6 @@ namespace .Extensions public static .<., TItem> ContainsOnly(this .<.> source, predicate, [.("predicate")] string? expression = null) { } public static . ContainsOnly(this . source, predicate, [.("predicate")] string? expression = null) where TCollection : . { } - public static . DoesNotContain(this . source, string expected, [.("expected")] string? expression = null) { } public static .<., TItem> DoesNotContain(this .<.> source, predicate, [.("predicate")] string? expression = null) { } public static .<., TItem> DoesNotContain(this .<.> source, TItem expected, [.("expected")] string? expression = null) { } public static . DoesNotContain(this . source, predicate, [.("predicate")] string? expression = null) @@ -1553,9 +1672,6 @@ namespace .Extensions where TEnum : struct, { } public static ..DoesNotHaveSameValueAsAssertion DoesNotHaveSameValueAs(this . source, otherEnumValue, [.("otherEnumValue")] string? expression = null) where TEnum : struct, { } - public static . DoesNotMatch(this . source, . regex, [.("regex")] string? expression = null) { } - public static . DoesNotMatch(this . source, string pattern, [.("pattern")] string? expression = null) { } - public static . EndsWith(this . source, string expected, [.("expected")] string? expression = null) { } public static . EqualTo(this . source, TValue expected, [.("expected")] string? expression = null) { } public static ..CountWrapper HasCount(this . source) where TValue : .IEnumerable { } @@ -1566,6 +1682,7 @@ namespace .Extensions public static ..HasFlagAssertion HasFlag(this . source, TEnum expectedFlag, [.("expectedFlag")] string? expression = null) where TEnum : struct, { } public static ..LengthWrapper HasLength(this . source) { } + public static ..LengthWrapper HasLength(this . source) { } public static . HasLength(this . source, int expectedLength, [.("expectedLength")] string? expression = null) { } public static . HasMember(this . source, .<> memberSelector) { } public static . HasMessageContaining(this . source, string expectedSubstring) { } @@ -1593,14 +1710,10 @@ namespace .Extensions public static . HasSingleItem(this . source) where TValue : .IEnumerable { } public static .<> IsAfterOrEqualTo(this .<> source, expected, [.("expected")] string? expression = null) { } - public static . IsAssignableTo(this . source) { } - public static . IsAssignableTo(this . source) { } - public static . IsBetween(this . source, TValue minimum, TValue maximum, [.("minimum")] string? minExpr = null, [.("maximum")] string? maxExpr = null) - where TValue : { } - public static . IsDefault(this . source) { } + public static . IsAssignableTo(this . source) { } + public static . IsAssignableTo(this . source) { } public static ..IsDefinedAssertion IsDefined(this . source) where TEnum : struct, { } - public static . IsEmpty(this . source) { } public static . IsEmpty(this . source) where TValue : .IEnumerable { } public static . IsEqualTo(this .<> source, expected, [.("expected")] string? expression = null) { } @@ -1616,7 +1729,6 @@ namespace .Extensions public static . IsEqualTo(this . source, TValue expected, [.("expected")] string? expression = null) { } public static . IsEqualTo(this . source, TValue expected, [.("expected")] string? expression = null) { } public static . IsEqualTo(this . source, TValue expected, [.("expected")] string? expression = null) { } - public static . IsEqualTo(this . source, TValue expected, . comparer, [.("expected")] string? expression = null) { } public static . IsEquatableOrEqualTo(this . source, TValue expected, [.("expected")] string? expression = null) { } public static . IsEquivalentTo(this . source, object? expected, [.("expected")] string? expression = null) { } public static . IsEquivalentTo(this . source, . expected, [.("expected")] string? expression = null) @@ -1626,12 +1738,7 @@ namespace .Extensions public static . IsEquivalentTo(this . source, . expected, . ordering, [.("expected")] string? expression = null) where TCollection : . { } public static . IsFalse(this . source) { } - public static . IsFalse(this . source) { } public static . IsFalse(this . source) { } - public static . IsGreaterThan(this . source, TValue minimum, [.("minimum")] string? expression = null) - where TValue : { } - public static . IsGreaterThanOrEqualTo(this . source, TValue minimum, [.("minimum")] string? expression = null) - where TValue : { } public static . IsIn(this . source, params TValue[] collection) { } public static . IsIn(this . source, . collection, [.("collection")] string? expression = null) { } public static .<., TItem> IsInDescendingOrder(this .<.> source) @@ -1644,24 +1751,16 @@ namespace .Extensions public static . IsInOrder(this . source) where TCollection : . where TItem : { } - public static . IsLessThan(this . source, TValue maximum, [.("maximum")] string? expression = null) - where TValue : { } - public static . IsLessThanOrEqualTo(this . source, TValue maximum, [.("maximum")] string? expression = null) - where TValue : { } public static . IsNegative(this . source) where TValue : { } public static . IsNegative(this . source) where TValue : struct, { } - public static . IsNotAssignableTo(this . source) { } - public static . IsNotAssignableTo(this . source) { } - public static . IsNotDefault(this . source) { } + public static . IsNotAssignableTo(this . source) { } public static ..IsNotDefinedAssertion IsNotDefined(this . source) where TEnum : struct, { } - public static . IsNotEmpty(this . source) { } public static . IsNotEmpty(this . source) where TValue : .IEnumerable { } public static . IsNotEqualTo(this . source, TValue expected, [.("expected")] string? expression = null) { } - public static . IsNotEqualTo(this . source, TValue notExpected, [.("notExpected")] string? expression = null) { } public static . IsNotEqualTo(this . source, TValue expected, [.("expected")] string? expression = null) { } public static . IsNotEquivalentTo(this . source, object? expected, [.("expected")] string? expression = null) { } public static . IsNotEquivalentTo(this . source, . expected, [.("expected")] string? expression = null) @@ -1672,15 +1771,13 @@ namespace .Extensions where TCollection : . { } public static . IsNotIn(this . source, params TValue[] collection) { } public static . IsNotIn(this . source, . collection, [.("collection")] string? expression = null) { } - public static . IsNotNull(this . source) { } - public static . IsNotNullOrEmpty(this . source) { } public static ..IsNotParsableIntoAssertion IsNotParsableInto<[.(..None | ..PublicMethods | ..Interfaces)] T>(this . source) { } public static . IsNotSameReferenceAs(this . source, object? expected, [.("expected")] string? expression = null) { } - public static . IsNull(this . source) { } public static . IsNullOrEmpty(this . source) { } - public static . IsNullOrEmpty(this . source) { } public static . IsNullOrEmpty(this . source) { } - public static . IsNullOrWhitespace(this . source) { } + public static . IsOfType(this . source, expectedType) { } + public static . IsOfType(this . source, expectedType) { } + public static . IsOfType(this . source, expectedType, [.("expectedType")] string? expression = null) { } public static ..IsParsableIntoAssertion IsParsableInto<[.(..None | ..PublicMethods | ..Interfaces)] T>(this . source) { } public static . IsPositive(this . source) where TValue : { } @@ -1688,19 +1785,12 @@ namespace .Extensions where TValue : struct, { } public static . IsSameReferenceAs(this . source, object? expected, [.("expected")] string? expression = null) { } public static . IsTrue(this . source) { } - public static . IsTrue(this . source) { } public static . IsTrue(this . source) { } - public static . IsTypeOf(this . source, expectedType) { } public static . IsTypeOf(this . source) { } - public static . IsTypeOf(this . source, expectedType) { } - public static . IsTypeOf(this . source, expectedType) { } - public static . IsTypeOf(this . source) { } - public static . Matches(this . source, . regex, [.("regex")] string? expression = null) { } - public static . Matches(this . source, string pattern, [.("pattern")] string? expression = null) { } + public static . IsTypeOf(this . source) { } public static . Satisfies(this . source, predicate, [.("predicate")] string? expression = null) { } public static . Satisfies(this . source, > selector, <., .?> assertions, [.("selector")] string? selectorExpression = null) { } public static . Satisfies(this . source, selector, <., .?> assertions, [.("selector")] string? selectorExpression = null) { } - public static . StartsWith(this . source, string expected, [.("expected")] string? expression = null) { } public static . Throws(this . source) where TException : { } public static . Throws(this . source) @@ -1723,121 +1813,520 @@ namespace .Extensions public static . WithMessageContaining(this . source, string expectedSubstring) { } public static . WithMessageContaining(this . source, string expectedSubstring, comparison) { } } - public static class CancellationTokenAssertionExtensions + public static class BetweenAssertionExtensions + { + public static . IsBetween(this . source, TValue minimum, TValue maximum, [.("minimum")] string? minimumExpression = null, [.("maximum")] string? maximumExpression = null) + where TValue : { } + } + public static class CanBeCanceledAssertionExtensions { public static . CanBeCanceled(this .<.CancellationToken> source) { } + } + public static class CannotBeCanceledAssertionExtensions + { public static . CannotBeCanceled(this .<.CancellationToken> source) { } + } + public static class DateTimeEqualsExactAssertionExtensions + { + public static . EqualsExact(this .<> source, expected, [.("expected")] string? expectedExpression = null) { } + } + public static class DirectoryDoesNotExistAssertionExtensions + { + public static . DoesNotExist(this .<.DirectoryInfo> source) { } + } + public static class DirectoryExistsAssertionExtensions + { + public static . Exists(this .<.DirectoryInfo> source) { } + } + public static class DirectoryHasFilesAssertionExtensions + { + public static . HasFiles(this .<.DirectoryInfo> source) { } + } + public static class DirectoryHasNoSubdirectoriesAssertionExtensions + { + public static . HasNoSubdirectories(this .<.DirectoryInfo> source) { } + } + public static class DirectoryIsNotEmptyAssertionExtensions + { + public static . IsNotEmpty(this .<.DirectoryInfo> source) { } + } + public static class FalseAssertionExtensions + { + public static . IsFalse(this . source) { } + } + public static class FileDoesNotExistAssertionExtensions + { + public static . DoesNotExist(this .<.FileInfo> source) { } + } + public static class FileExistsAssertionExtensions + { + public static . Exists(this .<.FileInfo> source) { } + } + public static class FileIsNotEmptyAssertionExtensions + { + public static . IsNotEmpty(this .<.FileInfo> source) { } + } + public static class FileIsNotExecutableAssertionExtensions + { + public static . IsNotExecutable(this .<.FileInfo> source) { } + } + public static class FileIsNotHiddenAssertionExtensions + { + public static . IsNotHidden(this .<.FileInfo> source) { } + } + public static class FileIsNotReadOnlyAssertionExtensions + { + public static . IsNotReadOnly(this .<.FileInfo> source) { } + } + public static class FileIsNotSystemAssertionExtensions + { + public static . IsNotSystem(this .<.FileInfo> source) { } + } + public static class GreaterThanAssertionExtensions + { + public static . IsGreaterThan(this . source, TValue minimum, [.("minimum")] string? minimumExpression = null) + where TValue : { } + } + public static class GreaterThanOrEqualAssertionExtensions + { + public static . IsGreaterThanOrEqualTo(this . source, TValue minimum, [.("minimum")] string? minimumExpression = null) + where TValue : { } + } + public static class HasInnerExceptionAssertionExtensions + { + public static . HasInnerException(this .<> source) { } + } + public static class HasNoDataAssertionExtensions + { + public static . HasNoData(this .<> source) { } + } + public static class HasNoInnerExceptionAssertionExtensions + { + public static . HasNoInnerException(this .<> source) { } + } + public static class HasStackTraceAssertionExtensions + { + public static . HasStackTrace(this .<> source) { } + } + public static class IsASCIIEncodingAssertionExtensions + { + public static . IsASCII(this .<.Encoding> source) { } + } + public static class IsAliveAssertionExtensions + { + public static . IsAlive(this .<> source) { } + } + public static class IsAssignableToAssertionExtensions + { + public static . IsAssignableTo(this . source) { } + } + public static class IsBigEndianUnicodeEncodingAssertionExtensions + { + public static . IsBigEndianUnicode(this .<.Encoding> source) { } + } + public static class IsCancellationRequestedAssertionExtensions + { public static . IsCancellationRequested(this .<.CancellationToken> source) { } - public static . IsNone(this .<.CancellationToken> source) { } - public static . IsNotCancellationRequested(this .<.CancellationToken> source) { } - public static . IsNotNone(this .<.CancellationToken> source) { } } - public static class CharAssertionExtensions + public static class IsClientErrorStatusCodeAssertionExtensions + { + public static . IsClientError(this .<.HttpStatusCode> source) { } + } + public static class IsCollectibleAssertionExtensions + { + public static . IsCollectible(this .<.Assembly> source) { } + } + public static class IsControlAssertionExtensions { public static . IsControl(this . source) { } + } + public static class IsDaylightSavingTimeAssertionExtensions + { + public static . IsDaylightSavingTime(this .<> source) { } + } + public static class IsDeadAssertionExtensions + { + public static . IsDead(this .<> source) { } + } + public static class IsDebugBuildAssertionExtensions + { + public static . IsDebugBuild(this .<.Assembly> source) { } + } + public static class IsDefaultAssertionExtensions + { + public static . IsDefault(this . source) { } + } + public static class IsDigitAssertionExtensions + { public static . IsDigit(this . source) { } + } + public static class IsDynamicAssertionExtensions + { + public static . IsDynamic(this .<.Assembly> source) { } + } + public static class IsEnglishCultureAssertionExtensions + { + public static . IsEnglish(this .<.CultureInfo> source) { } + } + public static class IsErrorStatusCodeAssertionExtensions + { + public static . IsError(this .<.HttpStatusCode> source) { } + } + public static class IsFridayAssertionExtensions + { + public static . IsFriday(this .<> source) { } + } + public static class IsFullyTrustedAssertionExtensions + { + public static . IsFullyTrusted(this .<.Assembly> source) { } + } + public static class IsHighSurrogateAssertionExtensions + { public static . IsHighSurrogate(this . source) { } + } + public static class IsInformationalStatusCodeAssertionExtensions + { + public static . IsInformational(this .<.HttpStatusCode> source) { } + } + public static class IsInvariantCultureAssertionExtensions + { + public static . IsInvariant(this .<.CultureInfo> source) { } + } + public static class IsLeapYearAssertionExtensions + { + public static . IsLeapYear(this .<> source) { } + } + public static class IsLeftToRightCultureAssertionExtensions + { + public static . IsLeftToRight(this .<.CultureInfo> source) { } + } + public static class IsLetterAssertionExtensions + { public static . IsLetter(this . source) { } + } + public static class IsLetterOrDigitAssertionExtensions + { public static . IsLetterOrDigit(this . source) { } + } + public static class IsLowSurrogateAssertionExtensions + { public static . IsLowSurrogate(this . source) { } + } + public static class IsLowerAssertionExtensions + { public static . IsLower(this . source) { } + } + public static class IsMondayAssertionExtensions + { + public static . IsMonday(this .<> source) { } + } + public static class IsNeutralCultureAssertionExtensions + { + public static . IsNeutralCulture(this .<.CultureInfo> source) { } + } + public static class IsNoneAssertionExtensions + { + public static . IsNone(this .<.CancellationToken> source) { } + } + public static class IsNotAssignableToAssertionExtensions + { + public static . IsNotAssignableTo(this . source) { } + } + public static class IsNotCancellationRequestedAssertionExtensions + { + public static . IsNotCancellationRequested(this .<.CancellationToken> source) { } + } + public static class IsNotCollectibleAssertionExtensions + { + public static . IsNotCollectible(this .<.Assembly> source) { } + } + public static class IsNotControlAssertionExtensions + { public static . IsNotControl(this . source) { } + } + public static class IsNotDaylightSavingTimeAssertionExtensions + { + public static . IsNotDaylightSavingTime(this .<> source) { } + } + public static class IsNotDefaultAssertionExtensions + { + public static . IsNotDefault(this . source) { } + } + public static class IsNotDigitAssertionExtensions + { public static . IsNotDigit(this . source) { } + } + public static class IsNotDynamicAssertionExtensions + { + public static . IsNotDynamic(this .<.Assembly> source) { } + } + public static class IsNotEnglishCultureAssertionExtensions + { + public static . IsNotEnglish(this .<.CultureInfo> source) { } + } + public static class IsNotFullyTrustedAssertionExtensions + { + public static . IsNotFullyTrusted(this .<.Assembly> source) { } + } + public static class IsNotHighSurrogateAssertionExtensions + { public static . IsNotHighSurrogate(this . source) { } + } + public static class IsNotInvariantCultureAssertionExtensions + { + public static . IsNotInvariant(this .<.CultureInfo> source) { } + } + public static class IsNotLeapYearAssertionExtensions + { + public static . IsNotLeapYear(this .<> source) { } + } + public static class IsNotLetterAssertionExtensions + { public static . IsNotLetter(this . source) { } + } + public static class IsNotLetterOrDigitAssertionExtensions + { public static . IsNotLetterOrDigit(this . source) { } + } + public static class IsNotLowSurrogateAssertionExtensions + { public static . IsNotLowSurrogate(this . source) { } + } + public static class IsNotLowerAssertionExtensions + { public static . IsNotLower(this . source) { } + } + public static class IsNotNeutralCultureAssertionExtensions + { + public static . IsNotNeutralCulture(this .<.CultureInfo> source) { } + } + public static class IsNotNoneAssertionExtensions + { + public static . IsNotNone(this .<.CancellationToken> source) { } + } + public static class IsNotNumberAssertionExtensions + { public static . IsNotNumber(this . source) { } + } + public static class IsNotPunctuationAssertionExtensions + { public static . IsNotPunctuation(this . source) { } + } + public static class IsNotSeparatorAssertionExtensions + { public static . IsNotSeparator(this . source) { } + } + public static class IsNotSignedAssertionExtensions + { + public static . IsNotSigned(this .<.Assembly> source) { } + } + public static class IsNotSingleByteEncodingAssertionExtensions + { + public static . IsNotSingleByte(this .<.Encoding> source) { } + } + public static class IsNotSuccessStatusCodeAssertionExtensions + { + public static . IsNotSuccess(this .<.HttpStatusCode> source) { } + } + public static class IsNotSurrogateAssertionExtensions + { public static . IsNotSurrogate(this . source) { } + } + public static class IsNotSymbolAssertionExtensions + { public static . IsNotSymbol(this . source) { } + } + public static class IsNotTodayAssertionExtensions + { + public static . IsNotToday(this .<> source) { } + } + public static class IsNotUTF8EncodingAssertionExtensions + { + public static .8EncodingAssertion IsNotUTF8(this .<.Encoding> source) { } + } + public static class IsNotUpperAssertionExtensions + { public static . IsNotUpper(this . source) { } + } + public static class IsNotUtcAssertionExtensions + { + public static . IsNotUtc(this .<> source) { } + } + public static class IsNotWhiteSpaceAssertionExtensions + { public static . IsNotWhiteSpace(this . source) { } + } + public static class IsNumberAssertionExtensions + { public static . IsNumber(this . source) { } + } + public static class IsPunctuationAssertionExtensions + { public static . IsPunctuation(this . source) { } - public static . IsSeparator(this . source) { } - public static . IsSurrogate(this . source) { } - public static . IsSymbol(this . source) { } - public static . IsUpper(this . source) { } - public static . IsWhiteSpace(this . source) { } } - public static class CultureInfoAssertionExtensions + public static class IsReadOnlyCultureAssertionExtensions { - public static . IsEnglish(this .<.CultureInfo> source) { } - public static . IsInvariant(this .<.CultureInfo> source) { } - public static . IsLeftToRight(this .<.CultureInfo> source) { } - public static . IsNeutralCulture(this .<.CultureInfo> source) { } - public static . IsNotEnglish(this .<.CultureInfo> source) { } - public static . IsNotInvariant(this .<.CultureInfo> source) { } - public static . IsNotNeutralCulture(this .<.CultureInfo> source) { } public static . IsReadOnly(this .<.CultureInfo> source) { } + } + public static class IsRedirectionStatusCodeAssertionExtensions + { + public static . IsRedirection(this .<.HttpStatusCode> source) { } + } + public static class IsReleaseBuildAssertionExtensions + { + public static . IsReleaseBuild(this .<.Assembly> source) { } + } + public static class IsRightToLeftCultureAssertionExtensions + { public static . IsRightToLeft(this .<.CultureInfo> source) { } } - public static class DateTimeAssertionExtensions + public static class IsSeparatorAssertionExtensions { - public static . EqualsExact(this .<> source, expected, [.("expected")] string? expression = null) { } - public static . IsDaylightSavingTime(this .<> source) { } - public static . IsLeapYear(this .<> source) { } - public static . IsNotDaylightSavingTime(this .<> source) { } - public static . IsNotLeapYear(this .<> source) { } - public static . IsNotToday(this .<> source) { } - public static . IsNotUtc(this .<> source) { } - public static . IsToday(this .<> source) { } - public static . IsUtc(this .<> source) { } + public static . IsSeparator(this . source) { } } - public static class EncodingAssertionExtensions + public static class IsServerErrorStatusCodeAssertionExtensions + { + public static . IsServerError(this .<.HttpStatusCode> source) { } + } + public static class IsSignedAssertionExtensions + { + public static . IsSigned(this .<.Assembly> source) { } + } + public static class IsSingleByteEncodingAssertionExtensions { - public static . IsASCII(this .<.Encoding> source) { } - public static . IsBigEndianUnicode(this .<.Encoding> source) { } - public static . IsNotSingleByte(this .<.Encoding> source) { } - public static .8EncodingAssertion IsNotUTF8(this .<.Encoding> source) { } public static . IsSingleByte(this .<.Encoding> source) { } + } + public static class IsSuccessStatusCodeAssertionExtensions + { + public static . IsSuccess(this .<.HttpStatusCode> source) { } + } + public static class IsSurrogateAssertionExtensions + { + public static . IsSurrogate(this . source) { } + } + public static class IsSymbolAssertionExtensions + { + public static . IsSymbol(this . source) { } + } + public static class IsTodayAssertionExtensions + { + public static . IsToday(this .<> source) { } + } + public static class IsUTF32EncodingAssertionExtensions + { public static .32EncodingAssertion IsUTF32(this .<.Encoding> source) { } + } + public static class IsUTF8EncodingAssertionExtensions + { public static .8EncodingAssertion IsUTF8(this .<.Encoding> source) { } + } + public static class IsUnicodeEncodingAssertionExtensions + { public static . IsUnicode(this .<.Encoding> source) { } } - public static class FileSystemAssertionExtensions + public static class IsUpperAssertionExtensions { - public static . DoesNotExist(this .<.DirectoryInfo> source) { } - public static . DoesNotExist(this .<.FileInfo> source) { } - public static . Exists(this .<.DirectoryInfo> source) { } - public static . Exists(this .<.FileInfo> source) { } - public static . HasFiles(this .<.DirectoryInfo> source) { } - public static . HasNoSubdirectories(this .<.DirectoryInfo> source) { } - public static . IsNotEmpty(this .<.DirectoryInfo> source) { } - public static . IsNotEmpty(this .<.FileInfo> source) { } - public static . IsNotExecutable(this .<.FileInfo> source) { } - public static . IsNotHidden(this .<.FileInfo> source) { } - public static . IsNotReadOnly(this .<.FileInfo> source) { } - public static . IsNotSystem(this .<.FileInfo> source) { } + public static . IsUpper(this . source) { } } - public static class HttpStatusCodeAssertionExtensions + public static class IsUtcAssertionExtensions { - public static . IsClientError(this .<.HttpStatusCode> source) { } - public static . IsError(this .<.HttpStatusCode> source) { } - public static . IsInformational(this .<.HttpStatusCode> source) { } - public static . IsNotSuccess(this .<.HttpStatusCode> source) { } - public static . IsRedirection(this .<.HttpStatusCode> source) { } - public static . IsServerError(this .<.HttpStatusCode> source) { } - public static . IsSuccess(this .<.HttpStatusCode> source) { } + public static . IsUtc(this .<> source) { } + } + public static class IsWeekdayAssertionExtensions + { + public static . IsWeekday(this .<> source) { } + } + public static class IsWeekendAssertionExtensions + { + public static . IsWeekend(this .<> source) { } + } + public static class IsWhiteSpaceAssertionExtensions + { + public static . IsWhiteSpace(this . source) { } + } + public static class LessThanAssertionExtensions + { + public static . IsLessThan(this . source, TValue maximum, [.("maximum")] string? maximumExpression = null) + where TValue : { } + } + public static class LessThanOrEqualAssertionExtensions + { + public static . IsLessThanOrEqualTo(this . source, TValue maximum, [.("maximum")] string? maximumExpression = null) + where TValue : { } + } + public static class NotEqualsAssertionExtensions + { + public static . IsNotEqualTo(this . source, TValue notExpected, .? comparer = null, [.("notExpected")] string? notExpectedExpression = null, [.("comparer")] string? comparerExpression = null) { } + } + public static class NotNullAssertionExtensions + { + public static . IsNotNull(this . source) { } + } + public static class NullAssertionExtensions + { + public static . IsNull(this . source) { } } - public static class MiscellaneousAssertionExtensions + public static class StringBuilderHasExcessCapacityAssertionExtensions { public static . HasExcessCapacity(this .<.StringBuilder> source) { } - public static . HasInnerException(this .<> source) { } - public static . HasNoData(this .<> source) { } - public static . HasNoInnerException(this .<> source) { } - public static . HasStackTrace(this .<> source) { } - public static . IsAlive(this .<> source) { } - public static . IsDead(this .<> source) { } + } + public static class StringBuilderIsEmptyAssertionExtensions + { public static . IsEmpty(this .<.StringBuilder> source) { } - public static . IsFriday(this .<> source) { } - public static . IsMonday(this .<> source) { } + } + public static class StringBuilderIsNotEmptyAssertionExtensions + { public static . IsNotEmpty(this .<.StringBuilder> source) { } - public static . IsWeekday(this .<> source) { } - public static . IsWeekend(this .<> source) { } + } + public static class StringContainsAssertionExtensions + { + public static . Contains(this . source, string expected, [.("expected")] string? expectedExpression = null) { } + } + public static class StringDoesNotContainAssertionExtensions + { + public static . DoesNotContain(this . source, string expected, [.("expected")] string? expectedExpression = null) { } + } + public static class StringDoesNotMatchAssertionExtensions + { + public static . DoesNotMatch(this . source, . regex, [.("regex")] string? regexExpression = null) { } + public static . DoesNotMatch(this . source, string pattern, [.("pattern")] string? patternExpression = null) { } + } + public static class StringEndsWithAssertionExtensions + { + public static . EndsWith(this . source, string expected, [.("expected")] string? expectedExpression = null) { } + } + public static class StringIsEmptyAssertionExtensions + { + public static . IsEmpty(this . source) { } + } + public static class StringIsNotEmptyAssertionExtensions + { + public static . IsNotEmpty(this . source) { } + } + public static class StringIsNotNullOrEmptyAssertionExtensions + { + public static . IsNotNullOrEmpty(this . source) { } + } + public static class StringIsNullOrEmptyAssertionExtensions + { + public static . IsNullOrEmpty(this . source) { } + } + public static class StringIsNullOrWhitespaceAssertionExtensions + { + public static . IsNullOrWhitespace(this . source) { } + } + public static class StringMatchesAssertionExtensions + { + public static . Matches(this . source, . regex, [.("regex")] string? regexExpression = null) { } + public static . Matches(this . source, string pattern, [.("pattern")] string? patternExpression = null) { } + } + public static class StringStartsWithAssertionExtensions + { + public static . StartsWith(this . source, string expected, [.("expected")] string? expectedExpression = null) { } + } + public static class TrueAssertionExtensions + { + public static . IsTrue(this . source) { } } } namespace .Sources diff --git a/TUnit.PublicAPI/Tests.Assertions_Library_Has_No_API_Changes.DotNet8_0.verified.txt b/TUnit.PublicAPI/Tests.Assertions_Library_Has_No_API_Changes.DotNet8_0.verified.txt index 066c0bc968..174e465172 100644 --- a/TUnit.PublicAPI/Tests.Assertions_Library_Has_No_API_Changes.DotNet8_0.verified.txt +++ b/TUnit.PublicAPI/Tests.Assertions_Library_Has_No_API_Changes.DotNet8_0.verified.txt @@ -145,6 +145,13 @@ namespace . } namespace .Attributes { + [(.Class, AllowMultiple=false)] + public class AssertionExtensionAttribute : + { + public AssertionExtensionAttribute(string methodName) { } + public string MethodName { get; } + public string? NegatedMethodName { get; set; } + } [(.Class, AllowMultiple=true)] public class CreateAssertionAttribute : { @@ -217,6 +224,7 @@ namespace .Conditions public TSelf WithMessageNotContaining(string notExpectedSubstring, comparison, [.("notExpectedSubstring")] string? expression = null) { } public TSelf WithParameterName(string expectedParameterName, [.("expectedParameterName")] string? expression = null) { } } + [.("IsBetween")] public class BetweenAssertion : . where TValue : { @@ -228,12 +236,14 @@ namespace .Conditions public . InclusiveMaximum() { } public . InclusiveMinimum() { } } + [.("CanBeCanceled")] public class CanBeCanceledAssertion : .<.CancellationToken> { public CanBeCanceledAssertion(.<.CancellationToken> context) { } protected override .<.> CheckAsync(.<.CancellationToken> metadata) { } protected override string GetExpectation() { } } + [.("CannotBeCanceled")] public class CannotBeCanceledAssertion : .<.CancellationToken> { public CannotBeCanceledAssertion(.<.CancellationToken> context) { } @@ -366,6 +376,7 @@ namespace .Conditions protected override string GetExpectation() { } public . Within( tolerance) { } } + [.("EqualsExact")] public class DateTimeEqualsExactAssertion : .<> { public DateTimeEqualsExactAssertion(.<> context, expected) { } @@ -391,30 +402,35 @@ namespace .Conditions protected override .<.> CheckAsync(.<.> metadata) { } protected override string GetExpectation() { } } + [.("DoesNotExist")] public class DirectoryDoesNotExistAssertion : .<.DirectoryInfo> { public DirectoryDoesNotExistAssertion(.<.DirectoryInfo> context) { } protected override .<.> CheckAsync(.<.DirectoryInfo> metadata) { } protected override string GetExpectation() { } } + [.("Exists")] public class DirectoryExistsAssertion : .<.DirectoryInfo> { public DirectoryExistsAssertion(.<.DirectoryInfo> context) { } protected override .<.> CheckAsync(.<.DirectoryInfo> metadata) { } protected override string GetExpectation() { } } + [.("HasFiles")] public class DirectoryHasFilesAssertion : .<.DirectoryInfo> { public DirectoryHasFilesAssertion(.<.DirectoryInfo> context) { } protected override .<.> CheckAsync(.<.DirectoryInfo> metadata) { } protected override string GetExpectation() { } } + [.("HasNoSubdirectories")] public class DirectoryHasNoSubdirectoriesAssertion : .<.DirectoryInfo> { public DirectoryHasNoSubdirectoriesAssertion(.<.DirectoryInfo> context) { } protected override .<.> CheckAsync(.<.DirectoryInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotEmpty")] public class DirectoryIsNotEmptyAssertion : .<.DirectoryInfo> { public DirectoryIsNotEmptyAssertion(.<.DirectoryInfo> context) { } @@ -445,54 +461,63 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsFalse")] public class FalseAssertion : . { public FalseAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("DoesNotExist")] public class FileDoesNotExistAssertion : .<.FileInfo> { public FileDoesNotExistAssertion(.<.FileInfo> context) { } protected override .<.> CheckAsync(.<.FileInfo> metadata) { } protected override string GetExpectation() { } } + [.("Exists")] public class FileExistsAssertion : .<.FileInfo> { public FileExistsAssertion(.<.FileInfo> context) { } protected override .<.> CheckAsync(.<.FileInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotEmpty")] public class FileIsNotEmptyAssertion : .<.FileInfo> { public FileIsNotEmptyAssertion(.<.FileInfo> context) { } protected override .<.> CheckAsync(.<.FileInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotExecutable")] public class FileIsNotExecutableAssertion : .<.FileInfo> { public FileIsNotExecutableAssertion(.<.FileInfo> context) { } protected override .<.> CheckAsync(.<.FileInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotHidden")] public class FileIsNotHiddenAssertion : .<.FileInfo> { public FileIsNotHiddenAssertion(.<.FileInfo> context) { } protected override .<.> CheckAsync(.<.FileInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotReadOnly")] public class FileIsNotReadOnlyAssertion : .<.FileInfo> { public FileIsNotReadOnlyAssertion(.<.FileInfo> context) { } protected override .<.> CheckAsync(.<.FileInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotSystem")] public class FileIsNotSystemAssertion : .<.FileInfo> { public FileIsNotSystemAssertion(.<.FileInfo> context) { } protected override .<.> CheckAsync(.<.FileInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsGreaterThan")] public class GreaterThanAssertion : . where TValue : { @@ -500,6 +525,7 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsGreaterThanOrEqualTo")] public class GreaterThanOrEqualAssertion : . where TValue : { @@ -514,6 +540,7 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("HasInnerException")] public class HasInnerExceptionAssertion : .<> { public HasInnerExceptionAssertion(.<> context) { } @@ -538,12 +565,14 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("HasNoData")] public class HasNoDataAssertion : .<> { public HasNoDataAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("HasNoInnerException")] public class HasNoInnerExceptionAssertion : .<> { public HasNoInnerExceptionAssertion(.<> context) { } @@ -557,96 +586,112 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("HasStackTrace")] public class HasStackTraceAssertion : .<> { public HasStackTraceAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsASCII")] public class IsASCIIEncodingAssertion : .<.Encoding> { public IsASCIIEncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsAlive")] public class IsAliveAssertion : .<> { public IsAliveAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } - public class IsAssignableToAssertion : . + [.("IsAssignableTo")] + public class IsAssignableToAssertion : . { public IsAssignableToAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsBigEndianUnicode")] public class IsBigEndianUnicodeEncodingAssertion : .<.Encoding> { public IsBigEndianUnicodeEncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsCancellationRequested")] public class IsCancellationRequestedAssertion : .<.CancellationToken> { public IsCancellationRequestedAssertion(.<.CancellationToken> context) { } protected override .<.> CheckAsync(.<.CancellationToken> metadata) { } protected override string GetExpectation() { } } + [.("IsClientError")] public class IsClientErrorStatusCodeAssertion : .<.HttpStatusCode> { public IsClientErrorStatusCodeAssertion(.<.HttpStatusCode> context) { } protected override .<.> CheckAsync(.<.HttpStatusCode> metadata) { } protected override string GetExpectation() { } } + [.("IsCollectible")] public class IsCollectibleAssertion : .<.Assembly> { public IsCollectibleAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsControl")] public class IsControlAssertion : . { public IsControlAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsDaylightSavingTime")] public class IsDaylightSavingTimeAssertion : .<> { public IsDaylightSavingTimeAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsDead")] public class IsDeadAssertion : .<> { public IsDeadAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsDebugBuild")] public class IsDebugBuildAssertion : .<.Assembly> { public IsDebugBuildAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsDefault")] public class IsDefaultAssertion : . { public IsDefaultAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsDigit")] public class IsDigitAssertion : . { public IsDigitAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsDynamic")] public class IsDynamicAssertion : .<.Assembly> { public IsDynamicAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsEnglish")] public class IsEnglishCultureAssertion : .<.CultureInfo> { public IsEnglishCultureAssertion(.<.CultureInfo> context) { } @@ -668,24 +713,28 @@ namespace .Conditions protected override string GetExpectation() { } public . Using(. comparer) { } } + [.("IsError")] public class IsErrorStatusCodeAssertion : .<.HttpStatusCode> { public IsErrorStatusCodeAssertion(.<.HttpStatusCode> context) { } protected override .<.> CheckAsync(.<.HttpStatusCode> metadata) { } protected override string GetExpectation() { } } + [.("IsFriday")] public class IsFridayAssertion : .<> { public IsFridayAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsFullyTrusted")] public class IsFullyTrustedAssertion : .<.Assembly> { public IsFullyTrustedAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsHighSurrogate")] public class IsHighSurrogateAssertion : . { public IsHighSurrogateAssertion(. context) { } @@ -699,132 +748,154 @@ namespace .Conditions protected override string GetExpectation() { } public . Using(. comparer) { } } + [.("IsInformational")] public class IsInformationalStatusCodeAssertion : .<.HttpStatusCode> { public IsInformationalStatusCodeAssertion(.<.HttpStatusCode> context) { } protected override .<.> CheckAsync(.<.HttpStatusCode> metadata) { } protected override string GetExpectation() { } } + [.("IsInvariant")] public class IsInvariantCultureAssertion : .<.CultureInfo> { public IsInvariantCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsLeapYear")] public class IsLeapYearAssertion : .<> { public IsLeapYearAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsLeftToRight")] public class IsLeftToRightCultureAssertion : .<.CultureInfo> { public IsLeftToRightCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsLetter")] public class IsLetterAssertion : . { public IsLetterAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsLetterOrDigit")] public class IsLetterOrDigitAssertion : . { public IsLetterOrDigitAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsLowSurrogate")] public class IsLowSurrogateAssertion : . { public IsLowSurrogateAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsLower")] public class IsLowerAssertion : . { public IsLowerAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsMonday")] public class IsMondayAssertion : .<> { public IsMondayAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsNeutralCulture")] public class IsNeutralCultureAssertion : .<.CultureInfo> { public IsNeutralCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNone")] public class IsNoneAssertion : .<.CancellationToken> { public IsNoneAssertion(.<.CancellationToken> context) { } protected override .<.> CheckAsync(.<.CancellationToken> metadata) { } protected override string GetExpectation() { } } - public class IsNotAssignableToAssertion : . + [.("IsNotAssignableTo")] + public class IsNotAssignableToAssertion : . { public IsNotAssignableToAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotCancellationRequested")] public class IsNotCancellationRequestedAssertion : .<.CancellationToken> { public IsNotCancellationRequestedAssertion(.<.CancellationToken> context) { } protected override .<.> CheckAsync(.<.CancellationToken> metadata) { } protected override string GetExpectation() { } } + [.("IsNotCollectible")] public class IsNotCollectibleAssertion : .<.Assembly> { public IsNotCollectibleAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsNotControl")] public class IsNotControlAssertion : . { public IsNotControlAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotDaylightSavingTime")] public class IsNotDaylightSavingTimeAssertion : .<> { public IsNotDaylightSavingTimeAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsNotDefault")] public class IsNotDefaultAssertion : . { public IsNotDefaultAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotDigit")] public class IsNotDigitAssertion : . { public IsNotDigitAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotDynamic")] public class IsNotDynamicAssertion : .<.Assembly> { public IsNotDynamicAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsNotEnglish")] public class IsNotEnglishCultureAssertion : .<.CultureInfo> { public IsNotEnglishCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotFullyTrusted")] public class IsNotFullyTrustedAssertion : .<.Assembly> { public IsNotFullyTrustedAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsNotHighSurrogate")] public class IsNotHighSurrogateAssertion : . { public IsNotHighSurrogateAssertion(. context) { } @@ -838,210 +909,245 @@ namespace .Conditions protected override string GetExpectation() { } public . Using(. comparer) { } } + [.("IsNotInvariant")] public class IsNotInvariantCultureAssertion : .<.CultureInfo> { public IsNotInvariantCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotLeapYear")] public class IsNotLeapYearAssertion : .<> { public IsNotLeapYearAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsNotLetter")] public class IsNotLetterAssertion : . { public IsNotLetterAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotLetterOrDigit")] public class IsNotLetterOrDigitAssertion : . { public IsNotLetterOrDigitAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotLowSurrogate")] public class IsNotLowSurrogateAssertion : . { public IsNotLowSurrogateAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotLower")] public class IsNotLowerAssertion : . { public IsNotLowerAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotNeutralCulture")] public class IsNotNeutralCultureAssertion : .<.CultureInfo> { public IsNotNeutralCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotNone")] public class IsNotNoneAssertion : .<.CancellationToken> { public IsNotNoneAssertion(.<.CancellationToken> context) { } protected override .<.> CheckAsync(.<.CancellationToken> metadata) { } protected override string GetExpectation() { } } + [.("IsNotNumber")] public class IsNotNumberAssertion : . { public IsNotNumberAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotPunctuation")] public class IsNotPunctuationAssertion : . { public IsNotPunctuationAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotSeparator")] public class IsNotSeparatorAssertion : . { public IsNotSeparatorAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotSigned")] public class IsNotSignedAssertion : .<.Assembly> { public IsNotSignedAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsNotSingleByte")] public class IsNotSingleByteEncodingAssertion : .<.Encoding> { public IsNotSingleByteEncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsNotSuccess")] public class IsNotSuccessStatusCodeAssertion : .<.HttpStatusCode> { public IsNotSuccessStatusCodeAssertion(.<.HttpStatusCode> context) { } protected override .<.> CheckAsync(.<.HttpStatusCode> metadata) { } protected override string GetExpectation() { } } + [.("IsNotSurrogate")] public class IsNotSurrogateAssertion : . { public IsNotSurrogateAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotSymbol")] public class IsNotSymbolAssertion : . { public IsNotSymbolAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotToday")] public class IsNotTodayAssertion : .<> { public IsNotTodayAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsNotUTF8")] public class IsNotUTF8EncodingAssertion : .<.Encoding> { public IsNotUTF8EncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsNotUpper")] public class IsNotUpperAssertion : . { public IsNotUpperAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotUtc")] public class IsNotUtcAssertion : .<> { public IsNotUtcAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsNotWhiteSpace")] public class IsNotWhiteSpaceAssertion : . { public IsNotWhiteSpaceAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNumber")] public class IsNumberAssertion : . { public IsNumberAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsPunctuation")] public class IsPunctuationAssertion : . { public IsPunctuationAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsReadOnly")] public class IsReadOnlyCultureAssertion : .<.CultureInfo> { public IsReadOnlyCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsRedirection")] public class IsRedirectionStatusCodeAssertion : .<.HttpStatusCode> { public IsRedirectionStatusCodeAssertion(.<.HttpStatusCode> context) { } protected override .<.> CheckAsync(.<.HttpStatusCode> metadata) { } protected override string GetExpectation() { } } + [.("IsReleaseBuild")] public class IsReleaseBuildAssertion : .<.Assembly> { public IsReleaseBuildAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsRightToLeft")] public class IsRightToLeftCultureAssertion : .<.CultureInfo> { public IsRightToLeftCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsSeparator")] public class IsSeparatorAssertion : . { public IsSeparatorAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsServerError")] public class IsServerErrorStatusCodeAssertion : .<.HttpStatusCode> { public IsServerErrorStatusCodeAssertion(.<.HttpStatusCode> context) { } protected override .<.> CheckAsync(.<.HttpStatusCode> metadata) { } protected override string GetExpectation() { } } + [.("IsSigned")] public class IsSignedAssertion : .<.Assembly> { public IsSignedAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsSingleByte")] public class IsSingleByteEncodingAssertion : .<.Encoding> { public IsSingleByteEncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsSuccess")] public class IsSuccessStatusCodeAssertion : .<.HttpStatusCode> { public IsSuccessStatusCodeAssertion(.<.HttpStatusCode> context) { } protected override .<.> CheckAsync(.<.HttpStatusCode> metadata) { } protected override string GetExpectation() { } } + [.("IsSurrogate")] public class IsSurrogateAssertion : . { public IsSurrogateAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsSymbol")] public class IsSymbolAssertion : . { public IsSymbolAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsToday")] public class IsTodayAssertion : .<> { public IsTodayAssertion(.<> context) { } @@ -1054,54 +1160,63 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsUTF32")] public class IsUTF32EncodingAssertion : .<.Encoding> { public IsUTF32EncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsUTF8")] public class IsUTF8EncodingAssertion : .<.Encoding> { public IsUTF8EncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsUnicode")] public class IsUnicodeEncodingAssertion : .<.Encoding> { public IsUnicodeEncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsUpper")] public class IsUpperAssertion : . { public IsUpperAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsUtc")] public class IsUtcAssertion : .<> { public IsUtcAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsWeekday")] public class IsWeekdayAssertion : .<> { public IsWeekdayAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsWeekend")] public class IsWeekendAssertion : .<> { public IsWeekendAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsWhiteSpace")] public class IsWhiteSpaceAssertion : . { public IsWhiteSpaceAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsLessThan")] public class LessThanAssertion : . where TValue : { @@ -1109,6 +1224,7 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsLessThanOrEqualTo")] public class LessThanOrEqualAssertion : . where TValue : { @@ -1135,6 +1251,7 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotEqualTo")] public class NotEqualsAssertion : . { public NotEqualsAssertion(. context, TValue notExpected, .? comparer = null) { } @@ -1151,6 +1268,7 @@ namespace .Conditions protected override string GetExpectation() { } public . Using(. comparer) { } } + [.("IsNotNull")] public class NotNullAssertion : . { public NotNullAssertion(. context) { } @@ -1173,6 +1291,7 @@ namespace .Conditions public . IgnoringType() { } public . WithPartialEquivalency() { } } + [.("IsNull")] public class NullAssertion : . { public NullAssertion(. context) { } @@ -1191,24 +1310,28 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("HasExcessCapacity")] public class StringBuilderHasExcessCapacityAssertion : .<.StringBuilder> { public StringBuilderHasExcessCapacityAssertion(.<.StringBuilder> context) { } protected override .<.> CheckAsync(.<.StringBuilder> metadata) { } protected override string GetExpectation() { } } + [.("IsEmpty")] public class StringBuilderIsEmptyAssertion : .<.StringBuilder> { public StringBuilderIsEmptyAssertion(.<.StringBuilder> context) { } protected override .<.> CheckAsync(.<.StringBuilder> metadata) { } protected override string GetExpectation() { } } + [.("IsNotEmpty")] public class StringBuilderIsNotEmptyAssertion : .<.StringBuilder> { public StringBuilderIsNotEmptyAssertion(.<.StringBuilder> context) { } protected override .<.> CheckAsync(.<.StringBuilder> metadata) { } protected override string GetExpectation() { } } + [.("Contains")] public class StringContainsAssertion : . { public StringContainsAssertion(. context, string expected) { } @@ -1219,6 +1342,7 @@ namespace .Conditions public . WithComparison( comparison) { } public . WithTrimming() { } } + [.("DoesNotContain")] public class StringDoesNotContainAssertion : . { public StringDoesNotContainAssertion(. context, string expected) { } @@ -1227,6 +1351,7 @@ namespace .Conditions public . IgnoringCase() { } public . WithComparison( comparison) { } } + [.("DoesNotMatch")] public class StringDoesNotMatchAssertion : . { public StringDoesNotMatchAssertion(. context, . regex) { } @@ -1236,6 +1361,7 @@ namespace .Conditions public . IgnoringCase() { } public . WithOptions(. options) { } } + [.("EndsWith")] public class StringEndsWithAssertion : . { public StringEndsWithAssertion(. context, string expected) { } @@ -1255,30 +1381,35 @@ namespace .Conditions public . WithNullAndEmptyEquality() { } public . WithTrimming() { } } + [.("IsEmpty")] public class StringIsEmptyAssertion : . { public StringIsEmptyAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotEmpty")] public class StringIsNotEmptyAssertion : . { public StringIsNotEmptyAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotNullOrEmpty")] public class StringIsNotNullOrEmptyAssertion : . { public StringIsNotNullOrEmptyAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNullOrEmpty")] public class StringIsNullOrEmptyAssertion : . { public StringIsNullOrEmptyAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNullOrWhitespace")] public class StringIsNullOrWhitespaceAssertion : . { public StringIsNullOrWhitespaceAssertion(. context) { } @@ -1291,6 +1422,7 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("Matches")] public class StringMatchesAssertion : . { public StringMatchesAssertion(. context, . regex) { } @@ -1300,6 +1432,7 @@ namespace .Conditions public . IgnoringCase() { } public . WithOptions(. options) { } } + [.("StartsWith")] public class StringStartsWithAssertion : . { public StringStartsWithAssertion(. context, string expected) { } @@ -1346,6 +1479,7 @@ namespace .Conditions protected override string GetExpectation() { } public . Within( tolerance) { } } + [.("IsTrue")] public class TrueAssertion : . { public TrueAssertion(. context) { } @@ -1492,19 +1626,6 @@ namespace .Exceptions } namespace .Extensions { - public static class AssemblyAssertionExtensions - { - public static . IsCollectible(this .<.Assembly> source) { } - public static . IsDebugBuild(this .<.Assembly> source) { } - public static . IsDynamic(this .<.Assembly> source) { } - public static . IsFullyTrusted(this .<.Assembly> source) { } - public static . IsNotCollectible(this .<.Assembly> source) { } - public static . IsNotDynamic(this .<.Assembly> source) { } - public static . IsNotFullyTrusted(this .<.Assembly> source) { } - public static . IsNotSigned(this .<.Assembly> source) { } - public static . IsReleaseBuild(this .<.Assembly> source) { } - public static . IsSigned(this .<.Assembly> source) { } - } public static class AssertionExtensions { public static .<., TItem> All(this .<.> source) { } @@ -1517,7 +1638,6 @@ namespace .Extensions where TCollection : . { } public static . CompletesWithin(this . source, timeout, [.("timeout")] string? expression = null) { } public static . CompletesWithin(this . source, timeout, [.("timeout")] string? expression = null) { } - public static . Contains(this . source, string expected, [.("expected")] string? expression = null) { } public static .<., TItem> Contains(this .<.> source, predicate, [.("predicate")] string? expression = null) { } public static .<., TItem> Contains(this .<.> source, TItem expected, [.("expected")] string? expression = null) { } public static . Contains(this . source, TItem expected, [.("expected")] string? expression = null) @@ -1537,7 +1657,6 @@ namespace .Extensions public static .<., TItem> ContainsOnly(this .<.> source, predicate, [.("predicate")] string? expression = null) { } public static . ContainsOnly(this . source, predicate, [.("predicate")] string? expression = null) where TCollection : . { } - public static . DoesNotContain(this . source, string expected, [.("expected")] string? expression = null) { } public static .<., TItem> DoesNotContain(this .<.> source, predicate, [.("predicate")] string? expression = null) { } public static .<., TItem> DoesNotContain(this .<.> source, TItem expected, [.("expected")] string? expression = null) { } public static . DoesNotContain(this . source, predicate, [.("predicate")] string? expression = null) @@ -1553,9 +1672,6 @@ namespace .Extensions where TEnum : struct, { } public static ..DoesNotHaveSameValueAsAssertion DoesNotHaveSameValueAs(this . source, otherEnumValue, [.("otherEnumValue")] string? expression = null) where TEnum : struct, { } - public static . DoesNotMatch(this . source, . regex, [.("regex")] string? expression = null) { } - public static . DoesNotMatch(this . source, string pattern, [.("pattern")] string? expression = null) { } - public static . EndsWith(this . source, string expected, [.("expected")] string? expression = null) { } public static . EqualTo(this . source, TValue expected, [.("expected")] string? expression = null) { } public static ..CountWrapper HasCount(this . source) where TValue : .IEnumerable { } @@ -1566,6 +1682,7 @@ namespace .Extensions public static ..HasFlagAssertion HasFlag(this . source, TEnum expectedFlag, [.("expectedFlag")] string? expression = null) where TEnum : struct, { } public static ..LengthWrapper HasLength(this . source) { } + public static ..LengthWrapper HasLength(this . source) { } public static . HasLength(this . source, int expectedLength, [.("expectedLength")] string? expression = null) { } public static . HasMember(this . source, .<> memberSelector) { } public static . HasMessageContaining(this . source, string expectedSubstring) { } @@ -1593,14 +1710,10 @@ namespace .Extensions public static . HasSingleItem(this . source) where TValue : .IEnumerable { } public static .<> IsAfterOrEqualTo(this .<> source, expected, [.("expected")] string? expression = null) { } - public static . IsAssignableTo(this . source) { } - public static . IsAssignableTo(this . source) { } - public static . IsBetween(this . source, TValue minimum, TValue maximum, [.("minimum")] string? minExpr = null, [.("maximum")] string? maxExpr = null) - where TValue : { } - public static . IsDefault(this . source) { } + public static . IsAssignableTo(this . source) { } + public static . IsAssignableTo(this . source) { } public static ..IsDefinedAssertion IsDefined(this . source) where TEnum : struct, { } - public static . IsEmpty(this . source) { } public static . IsEmpty(this . source) where TValue : .IEnumerable { } public static . IsEqualTo(this .<> source, expected, [.("expected")] string? expression = null) { } @@ -1616,7 +1729,6 @@ namespace .Extensions public static . IsEqualTo(this . source, TValue expected, [.("expected")] string? expression = null) { } public static . IsEqualTo(this . source, TValue expected, [.("expected")] string? expression = null) { } public static . IsEqualTo(this . source, TValue expected, [.("expected")] string? expression = null) { } - public static . IsEqualTo(this . source, TValue expected, . comparer, [.("expected")] string? expression = null) { } public static . IsEquatableOrEqualTo(this . source, TValue expected, [.("expected")] string? expression = null) { } public static . IsEquivalentTo(this . source, object? expected, [.("expected")] string? expression = null) { } public static . IsEquivalentTo(this . source, . expected, [.("expected")] string? expression = null) @@ -1626,12 +1738,7 @@ namespace .Extensions public static . IsEquivalentTo(this . source, . expected, . ordering, [.("expected")] string? expression = null) where TCollection : . { } public static . IsFalse(this . source) { } - public static . IsFalse(this . source) { } public static . IsFalse(this . source) { } - public static . IsGreaterThan(this . source, TValue minimum, [.("minimum")] string? expression = null) - where TValue : { } - public static . IsGreaterThanOrEqualTo(this . source, TValue minimum, [.("minimum")] string? expression = null) - where TValue : { } public static . IsIn(this . source, params TValue[] collection) { } public static . IsIn(this . source, . collection, [.("collection")] string? expression = null) { } public static .<., TItem> IsInDescendingOrder(this .<.> source) @@ -1644,24 +1751,16 @@ namespace .Extensions public static . IsInOrder(this . source) where TCollection : . where TItem : { } - public static . IsLessThan(this . source, TValue maximum, [.("maximum")] string? expression = null) - where TValue : { } - public static . IsLessThanOrEqualTo(this . source, TValue maximum, [.("maximum")] string? expression = null) - where TValue : { } public static . IsNegative(this . source) where TValue : { } public static . IsNegative(this . source) where TValue : struct, { } - public static . IsNotAssignableTo(this . source) { } - public static . IsNotAssignableTo(this . source) { } - public static . IsNotDefault(this . source) { } + public static . IsNotAssignableTo(this . source) { } public static ..IsNotDefinedAssertion IsNotDefined(this . source) where TEnum : struct, { } - public static . IsNotEmpty(this . source) { } public static . IsNotEmpty(this . source) where TValue : .IEnumerable { } public static . IsNotEqualTo(this . source, TValue expected, [.("expected")] string? expression = null) { } - public static . IsNotEqualTo(this . source, TValue notExpected, [.("notExpected")] string? expression = null) { } public static . IsNotEqualTo(this . source, TValue expected, [.("expected")] string? expression = null) { } public static . IsNotEquivalentTo(this . source, object? expected, [.("expected")] string? expression = null) { } public static . IsNotEquivalentTo(this . source, . expected, [.("expected")] string? expression = null) @@ -1672,15 +1771,13 @@ namespace .Extensions where TCollection : . { } public static . IsNotIn(this . source, params TValue[] collection) { } public static . IsNotIn(this . source, . collection, [.("collection")] string? expression = null) { } - public static . IsNotNull(this . source) { } - public static . IsNotNullOrEmpty(this . source) { } public static ..IsNotParsableIntoAssertion IsNotParsableInto<[.(..None | ..PublicMethods | ..Interfaces)] T>(this . source) { } public static . IsNotSameReferenceAs(this . source, object? expected, [.("expected")] string? expression = null) { } - public static . IsNull(this . source) { } public static . IsNullOrEmpty(this . source) { } - public static . IsNullOrEmpty(this . source) { } public static . IsNullOrEmpty(this . source) { } - public static . IsNullOrWhitespace(this . source) { } + public static . IsOfType(this . source, expectedType) { } + public static . IsOfType(this . source, expectedType) { } + public static . IsOfType(this . source, expectedType, [.("expectedType")] string? expression = null) { } public static ..IsParsableIntoAssertion IsParsableInto<[.(..None | ..PublicMethods | ..Interfaces)] T>(this . source) { } public static . IsPositive(this . source) where TValue : { } @@ -1688,19 +1785,12 @@ namespace .Extensions where TValue : struct, { } public static . IsSameReferenceAs(this . source, object? expected, [.("expected")] string? expression = null) { } public static . IsTrue(this . source) { } - public static . IsTrue(this . source) { } public static . IsTrue(this . source) { } - public static . IsTypeOf(this . source, expectedType) { } public static . IsTypeOf(this . source) { } - public static . IsTypeOf(this . source, expectedType) { } - public static . IsTypeOf(this . source, expectedType) { } - public static . IsTypeOf(this . source) { } - public static . Matches(this . source, . regex, [.("regex")] string? expression = null) { } - public static . Matches(this . source, string pattern, [.("pattern")] string? expression = null) { } + public static . IsTypeOf(this . source) { } public static . Satisfies(this . source, predicate, [.("predicate")] string? expression = null) { } public static . Satisfies(this . source, > selector, <., .?> assertions, [.("selector")] string? selectorExpression = null) { } public static . Satisfies(this . source, selector, <., .?> assertions, [.("selector")] string? selectorExpression = null) { } - public static . StartsWith(this . source, string expected, [.("expected")] string? expression = null) { } public static . Throws(this . source) where TException : { } public static . Throws(this . source) @@ -1723,121 +1813,520 @@ namespace .Extensions public static . WithMessageContaining(this . source, string expectedSubstring) { } public static . WithMessageContaining(this . source, string expectedSubstring, comparison) { } } - public static class CancellationTokenAssertionExtensions + public static class BetweenAssertionExtensions + { + public static . IsBetween(this . source, TValue minimum, TValue maximum, [.("minimum")] string? minimumExpression = null, [.("maximum")] string? maximumExpression = null) + where TValue : { } + } + public static class CanBeCanceledAssertionExtensions { public static . CanBeCanceled(this .<.CancellationToken> source) { } + } + public static class CannotBeCanceledAssertionExtensions + { public static . CannotBeCanceled(this .<.CancellationToken> source) { } + } + public static class DateTimeEqualsExactAssertionExtensions + { + public static . EqualsExact(this .<> source, expected, [.("expected")] string? expectedExpression = null) { } + } + public static class DirectoryDoesNotExistAssertionExtensions + { + public static . DoesNotExist(this .<.DirectoryInfo> source) { } + } + public static class DirectoryExistsAssertionExtensions + { + public static . Exists(this .<.DirectoryInfo> source) { } + } + public static class DirectoryHasFilesAssertionExtensions + { + public static . HasFiles(this .<.DirectoryInfo> source) { } + } + public static class DirectoryHasNoSubdirectoriesAssertionExtensions + { + public static . HasNoSubdirectories(this .<.DirectoryInfo> source) { } + } + public static class DirectoryIsNotEmptyAssertionExtensions + { + public static . IsNotEmpty(this .<.DirectoryInfo> source) { } + } + public static class FalseAssertionExtensions + { + public static . IsFalse(this . source) { } + } + public static class FileDoesNotExistAssertionExtensions + { + public static . DoesNotExist(this .<.FileInfo> source) { } + } + public static class FileExistsAssertionExtensions + { + public static . Exists(this .<.FileInfo> source) { } + } + public static class FileIsNotEmptyAssertionExtensions + { + public static . IsNotEmpty(this .<.FileInfo> source) { } + } + public static class FileIsNotExecutableAssertionExtensions + { + public static . IsNotExecutable(this .<.FileInfo> source) { } + } + public static class FileIsNotHiddenAssertionExtensions + { + public static . IsNotHidden(this .<.FileInfo> source) { } + } + public static class FileIsNotReadOnlyAssertionExtensions + { + public static . IsNotReadOnly(this .<.FileInfo> source) { } + } + public static class FileIsNotSystemAssertionExtensions + { + public static . IsNotSystem(this .<.FileInfo> source) { } + } + public static class GreaterThanAssertionExtensions + { + public static . IsGreaterThan(this . source, TValue minimum, [.("minimum")] string? minimumExpression = null) + where TValue : { } + } + public static class GreaterThanOrEqualAssertionExtensions + { + public static . IsGreaterThanOrEqualTo(this . source, TValue minimum, [.("minimum")] string? minimumExpression = null) + where TValue : { } + } + public static class HasInnerExceptionAssertionExtensions + { + public static . HasInnerException(this .<> source) { } + } + public static class HasNoDataAssertionExtensions + { + public static . HasNoData(this .<> source) { } + } + public static class HasNoInnerExceptionAssertionExtensions + { + public static . HasNoInnerException(this .<> source) { } + } + public static class HasStackTraceAssertionExtensions + { + public static . HasStackTrace(this .<> source) { } + } + public static class IsASCIIEncodingAssertionExtensions + { + public static . IsASCII(this .<.Encoding> source) { } + } + public static class IsAliveAssertionExtensions + { + public static . IsAlive(this .<> source) { } + } + public static class IsAssignableToAssertionExtensions + { + public static . IsAssignableTo(this . source) { } + } + public static class IsBigEndianUnicodeEncodingAssertionExtensions + { + public static . IsBigEndianUnicode(this .<.Encoding> source) { } + } + public static class IsCancellationRequestedAssertionExtensions + { public static . IsCancellationRequested(this .<.CancellationToken> source) { } - public static . IsNone(this .<.CancellationToken> source) { } - public static . IsNotCancellationRequested(this .<.CancellationToken> source) { } - public static . IsNotNone(this .<.CancellationToken> source) { } } - public static class CharAssertionExtensions + public static class IsClientErrorStatusCodeAssertionExtensions + { + public static . IsClientError(this .<.HttpStatusCode> source) { } + } + public static class IsCollectibleAssertionExtensions + { + public static . IsCollectible(this .<.Assembly> source) { } + } + public static class IsControlAssertionExtensions { public static . IsControl(this . source) { } + } + public static class IsDaylightSavingTimeAssertionExtensions + { + public static . IsDaylightSavingTime(this .<> source) { } + } + public static class IsDeadAssertionExtensions + { + public static . IsDead(this .<> source) { } + } + public static class IsDebugBuildAssertionExtensions + { + public static . IsDebugBuild(this .<.Assembly> source) { } + } + public static class IsDefaultAssertionExtensions + { + public static . IsDefault(this . source) { } + } + public static class IsDigitAssertionExtensions + { public static . IsDigit(this . source) { } + } + public static class IsDynamicAssertionExtensions + { + public static . IsDynamic(this .<.Assembly> source) { } + } + public static class IsEnglishCultureAssertionExtensions + { + public static . IsEnglish(this .<.CultureInfo> source) { } + } + public static class IsErrorStatusCodeAssertionExtensions + { + public static . IsError(this .<.HttpStatusCode> source) { } + } + public static class IsFridayAssertionExtensions + { + public static . IsFriday(this .<> source) { } + } + public static class IsFullyTrustedAssertionExtensions + { + public static . IsFullyTrusted(this .<.Assembly> source) { } + } + public static class IsHighSurrogateAssertionExtensions + { public static . IsHighSurrogate(this . source) { } + } + public static class IsInformationalStatusCodeAssertionExtensions + { + public static . IsInformational(this .<.HttpStatusCode> source) { } + } + public static class IsInvariantCultureAssertionExtensions + { + public static . IsInvariant(this .<.CultureInfo> source) { } + } + public static class IsLeapYearAssertionExtensions + { + public static . IsLeapYear(this .<> source) { } + } + public static class IsLeftToRightCultureAssertionExtensions + { + public static . IsLeftToRight(this .<.CultureInfo> source) { } + } + public static class IsLetterAssertionExtensions + { public static . IsLetter(this . source) { } + } + public static class IsLetterOrDigitAssertionExtensions + { public static . IsLetterOrDigit(this . source) { } + } + public static class IsLowSurrogateAssertionExtensions + { public static . IsLowSurrogate(this . source) { } + } + public static class IsLowerAssertionExtensions + { public static . IsLower(this . source) { } + } + public static class IsMondayAssertionExtensions + { + public static . IsMonday(this .<> source) { } + } + public static class IsNeutralCultureAssertionExtensions + { + public static . IsNeutralCulture(this .<.CultureInfo> source) { } + } + public static class IsNoneAssertionExtensions + { + public static . IsNone(this .<.CancellationToken> source) { } + } + public static class IsNotAssignableToAssertionExtensions + { + public static . IsNotAssignableTo(this . source) { } + } + public static class IsNotCancellationRequestedAssertionExtensions + { + public static . IsNotCancellationRequested(this .<.CancellationToken> source) { } + } + public static class IsNotCollectibleAssertionExtensions + { + public static . IsNotCollectible(this .<.Assembly> source) { } + } + public static class IsNotControlAssertionExtensions + { public static . IsNotControl(this . source) { } + } + public static class IsNotDaylightSavingTimeAssertionExtensions + { + public static . IsNotDaylightSavingTime(this .<> source) { } + } + public static class IsNotDefaultAssertionExtensions + { + public static . IsNotDefault(this . source) { } + } + public static class IsNotDigitAssertionExtensions + { public static . IsNotDigit(this . source) { } + } + public static class IsNotDynamicAssertionExtensions + { + public static . IsNotDynamic(this .<.Assembly> source) { } + } + public static class IsNotEnglishCultureAssertionExtensions + { + public static . IsNotEnglish(this .<.CultureInfo> source) { } + } + public static class IsNotFullyTrustedAssertionExtensions + { + public static . IsNotFullyTrusted(this .<.Assembly> source) { } + } + public static class IsNotHighSurrogateAssertionExtensions + { public static . IsNotHighSurrogate(this . source) { } + } + public static class IsNotInvariantCultureAssertionExtensions + { + public static . IsNotInvariant(this .<.CultureInfo> source) { } + } + public static class IsNotLeapYearAssertionExtensions + { + public static . IsNotLeapYear(this .<> source) { } + } + public static class IsNotLetterAssertionExtensions + { public static . IsNotLetter(this . source) { } + } + public static class IsNotLetterOrDigitAssertionExtensions + { public static . IsNotLetterOrDigit(this . source) { } + } + public static class IsNotLowSurrogateAssertionExtensions + { public static . IsNotLowSurrogate(this . source) { } + } + public static class IsNotLowerAssertionExtensions + { public static . IsNotLower(this . source) { } + } + public static class IsNotNeutralCultureAssertionExtensions + { + public static . IsNotNeutralCulture(this .<.CultureInfo> source) { } + } + public static class IsNotNoneAssertionExtensions + { + public static . IsNotNone(this .<.CancellationToken> source) { } + } + public static class IsNotNumberAssertionExtensions + { public static . IsNotNumber(this . source) { } + } + public static class IsNotPunctuationAssertionExtensions + { public static . IsNotPunctuation(this . source) { } + } + public static class IsNotSeparatorAssertionExtensions + { public static . IsNotSeparator(this . source) { } + } + public static class IsNotSignedAssertionExtensions + { + public static . IsNotSigned(this .<.Assembly> source) { } + } + public static class IsNotSingleByteEncodingAssertionExtensions + { + public static . IsNotSingleByte(this .<.Encoding> source) { } + } + public static class IsNotSuccessStatusCodeAssertionExtensions + { + public static . IsNotSuccess(this .<.HttpStatusCode> source) { } + } + public static class IsNotSurrogateAssertionExtensions + { public static . IsNotSurrogate(this . source) { } + } + public static class IsNotSymbolAssertionExtensions + { public static . IsNotSymbol(this . source) { } + } + public static class IsNotTodayAssertionExtensions + { + public static . IsNotToday(this .<> source) { } + } + public static class IsNotUTF8EncodingAssertionExtensions + { + public static .8EncodingAssertion IsNotUTF8(this .<.Encoding> source) { } + } + public static class IsNotUpperAssertionExtensions + { public static . IsNotUpper(this . source) { } + } + public static class IsNotUtcAssertionExtensions + { + public static . IsNotUtc(this .<> source) { } + } + public static class IsNotWhiteSpaceAssertionExtensions + { public static . IsNotWhiteSpace(this . source) { } + } + public static class IsNumberAssertionExtensions + { public static . IsNumber(this . source) { } + } + public static class IsPunctuationAssertionExtensions + { public static . IsPunctuation(this . source) { } - public static . IsSeparator(this . source) { } - public static . IsSurrogate(this . source) { } - public static . IsSymbol(this . source) { } - public static . IsUpper(this . source) { } - public static . IsWhiteSpace(this . source) { } } - public static class CultureInfoAssertionExtensions + public static class IsReadOnlyCultureAssertionExtensions { - public static . IsEnglish(this .<.CultureInfo> source) { } - public static . IsInvariant(this .<.CultureInfo> source) { } - public static . IsLeftToRight(this .<.CultureInfo> source) { } - public static . IsNeutralCulture(this .<.CultureInfo> source) { } - public static . IsNotEnglish(this .<.CultureInfo> source) { } - public static . IsNotInvariant(this .<.CultureInfo> source) { } - public static . IsNotNeutralCulture(this .<.CultureInfo> source) { } public static . IsReadOnly(this .<.CultureInfo> source) { } + } + public static class IsRedirectionStatusCodeAssertionExtensions + { + public static . IsRedirection(this .<.HttpStatusCode> source) { } + } + public static class IsReleaseBuildAssertionExtensions + { + public static . IsReleaseBuild(this .<.Assembly> source) { } + } + public static class IsRightToLeftCultureAssertionExtensions + { public static . IsRightToLeft(this .<.CultureInfo> source) { } } - public static class DateTimeAssertionExtensions + public static class IsSeparatorAssertionExtensions { - public static . EqualsExact(this .<> source, expected, [.("expected")] string? expression = null) { } - public static . IsDaylightSavingTime(this .<> source) { } - public static . IsLeapYear(this .<> source) { } - public static . IsNotDaylightSavingTime(this .<> source) { } - public static . IsNotLeapYear(this .<> source) { } - public static . IsNotToday(this .<> source) { } - public static . IsNotUtc(this .<> source) { } - public static . IsToday(this .<> source) { } - public static . IsUtc(this .<> source) { } + public static . IsSeparator(this . source) { } } - public static class EncodingAssertionExtensions + public static class IsServerErrorStatusCodeAssertionExtensions + { + public static . IsServerError(this .<.HttpStatusCode> source) { } + } + public static class IsSignedAssertionExtensions + { + public static . IsSigned(this .<.Assembly> source) { } + } + public static class IsSingleByteEncodingAssertionExtensions { - public static . IsASCII(this .<.Encoding> source) { } - public static . IsBigEndianUnicode(this .<.Encoding> source) { } - public static . IsNotSingleByte(this .<.Encoding> source) { } - public static .8EncodingAssertion IsNotUTF8(this .<.Encoding> source) { } public static . IsSingleByte(this .<.Encoding> source) { } + } + public static class IsSuccessStatusCodeAssertionExtensions + { + public static . IsSuccess(this .<.HttpStatusCode> source) { } + } + public static class IsSurrogateAssertionExtensions + { + public static . IsSurrogate(this . source) { } + } + public static class IsSymbolAssertionExtensions + { + public static . IsSymbol(this . source) { } + } + public static class IsTodayAssertionExtensions + { + public static . IsToday(this .<> source) { } + } + public static class IsUTF32EncodingAssertionExtensions + { public static .32EncodingAssertion IsUTF32(this .<.Encoding> source) { } + } + public static class IsUTF8EncodingAssertionExtensions + { public static .8EncodingAssertion IsUTF8(this .<.Encoding> source) { } + } + public static class IsUnicodeEncodingAssertionExtensions + { public static . IsUnicode(this .<.Encoding> source) { } } - public static class FileSystemAssertionExtensions + public static class IsUpperAssertionExtensions { - public static . DoesNotExist(this .<.DirectoryInfo> source) { } - public static . DoesNotExist(this .<.FileInfo> source) { } - public static . Exists(this .<.DirectoryInfo> source) { } - public static . Exists(this .<.FileInfo> source) { } - public static . HasFiles(this .<.DirectoryInfo> source) { } - public static . HasNoSubdirectories(this .<.DirectoryInfo> source) { } - public static . IsNotEmpty(this .<.DirectoryInfo> source) { } - public static . IsNotEmpty(this .<.FileInfo> source) { } - public static . IsNotExecutable(this .<.FileInfo> source) { } - public static . IsNotHidden(this .<.FileInfo> source) { } - public static . IsNotReadOnly(this .<.FileInfo> source) { } - public static . IsNotSystem(this .<.FileInfo> source) { } + public static . IsUpper(this . source) { } } - public static class HttpStatusCodeAssertionExtensions + public static class IsUtcAssertionExtensions { - public static . IsClientError(this .<.HttpStatusCode> source) { } - public static . IsError(this .<.HttpStatusCode> source) { } - public static . IsInformational(this .<.HttpStatusCode> source) { } - public static . IsNotSuccess(this .<.HttpStatusCode> source) { } - public static . IsRedirection(this .<.HttpStatusCode> source) { } - public static . IsServerError(this .<.HttpStatusCode> source) { } - public static . IsSuccess(this .<.HttpStatusCode> source) { } + public static . IsUtc(this .<> source) { } + } + public static class IsWeekdayAssertionExtensions + { + public static . IsWeekday(this .<> source) { } + } + public static class IsWeekendAssertionExtensions + { + public static . IsWeekend(this .<> source) { } + } + public static class IsWhiteSpaceAssertionExtensions + { + public static . IsWhiteSpace(this . source) { } + } + public static class LessThanAssertionExtensions + { + public static . IsLessThan(this . source, TValue maximum, [.("maximum")] string? maximumExpression = null) + where TValue : { } + } + public static class LessThanOrEqualAssertionExtensions + { + public static . IsLessThanOrEqualTo(this . source, TValue maximum, [.("maximum")] string? maximumExpression = null) + where TValue : { } + } + public static class NotEqualsAssertionExtensions + { + public static . IsNotEqualTo(this . source, TValue notExpected, .? comparer = null, [.("notExpected")] string? notExpectedExpression = null, [.("comparer")] string? comparerExpression = null) { } + } + public static class NotNullAssertionExtensions + { + public static . IsNotNull(this . source) { } + } + public static class NullAssertionExtensions + { + public static . IsNull(this . source) { } } - public static class MiscellaneousAssertionExtensions + public static class StringBuilderHasExcessCapacityAssertionExtensions { public static . HasExcessCapacity(this .<.StringBuilder> source) { } - public static . HasInnerException(this .<> source) { } - public static . HasNoData(this .<> source) { } - public static . HasNoInnerException(this .<> source) { } - public static . HasStackTrace(this .<> source) { } - public static . IsAlive(this .<> source) { } - public static . IsDead(this .<> source) { } + } + public static class StringBuilderIsEmptyAssertionExtensions + { public static . IsEmpty(this .<.StringBuilder> source) { } - public static . IsFriday(this .<> source) { } - public static . IsMonday(this .<> source) { } + } + public static class StringBuilderIsNotEmptyAssertionExtensions + { public static . IsNotEmpty(this .<.StringBuilder> source) { } - public static . IsWeekday(this .<> source) { } - public static . IsWeekend(this .<> source) { } + } + public static class StringContainsAssertionExtensions + { + public static . Contains(this . source, string expected, [.("expected")] string? expectedExpression = null) { } + } + public static class StringDoesNotContainAssertionExtensions + { + public static . DoesNotContain(this . source, string expected, [.("expected")] string? expectedExpression = null) { } + } + public static class StringDoesNotMatchAssertionExtensions + { + public static . DoesNotMatch(this . source, . regex, [.("regex")] string? regexExpression = null) { } + public static . DoesNotMatch(this . source, string pattern, [.("pattern")] string? patternExpression = null) { } + } + public static class StringEndsWithAssertionExtensions + { + public static . EndsWith(this . source, string expected, [.("expected")] string? expectedExpression = null) { } + } + public static class StringIsEmptyAssertionExtensions + { + public static . IsEmpty(this . source) { } + } + public static class StringIsNotEmptyAssertionExtensions + { + public static . IsNotEmpty(this . source) { } + } + public static class StringIsNotNullOrEmptyAssertionExtensions + { + public static . IsNotNullOrEmpty(this . source) { } + } + public static class StringIsNullOrEmptyAssertionExtensions + { + public static . IsNullOrEmpty(this . source) { } + } + public static class StringIsNullOrWhitespaceAssertionExtensions + { + public static . IsNullOrWhitespace(this . source) { } + } + public static class StringMatchesAssertionExtensions + { + public static . Matches(this . source, . regex, [.("regex")] string? regexExpression = null) { } + public static . Matches(this . source, string pattern, [.("pattern")] string? patternExpression = null) { } + } + public static class StringStartsWithAssertionExtensions + { + public static . StartsWith(this . source, string expected, [.("expected")] string? expectedExpression = null) { } + } + public static class TrueAssertionExtensions + { + public static . IsTrue(this . source) { } } } namespace .Sources diff --git a/TUnit.PublicAPI/Tests.Assertions_Library_Has_No_API_Changes.DotNet9_0.verified.txt b/TUnit.PublicAPI/Tests.Assertions_Library_Has_No_API_Changes.DotNet9_0.verified.txt index a76ba0d6f6..6ee75cc4b8 100644 --- a/TUnit.PublicAPI/Tests.Assertions_Library_Has_No_API_Changes.DotNet9_0.verified.txt +++ b/TUnit.PublicAPI/Tests.Assertions_Library_Has_No_API_Changes.DotNet9_0.verified.txt @@ -145,6 +145,13 @@ namespace . } namespace .Attributes { + [(.Class, AllowMultiple=false)] + public class AssertionExtensionAttribute : + { + public AssertionExtensionAttribute(string methodName) { } + public string MethodName { get; } + public string? NegatedMethodName { get; set; } + } [(.Class, AllowMultiple=true)] public class CreateAssertionAttribute : { @@ -217,6 +224,7 @@ namespace .Conditions public TSelf WithMessageNotContaining(string notExpectedSubstring, comparison, [.("notExpectedSubstring")] string? expression = null) { } public TSelf WithParameterName(string expectedParameterName, [.("expectedParameterName")] string? expression = null) { } } + [.("IsBetween")] public class BetweenAssertion : . where TValue : { @@ -228,12 +236,14 @@ namespace .Conditions public . InclusiveMaximum() { } public . InclusiveMinimum() { } } + [.("CanBeCanceled")] public class CanBeCanceledAssertion : .<.CancellationToken> { public CanBeCanceledAssertion(.<.CancellationToken> context) { } protected override .<.> CheckAsync(.<.CancellationToken> metadata) { } protected override string GetExpectation() { } } + [.("CannotBeCanceled")] public class CannotBeCanceledAssertion : .<.CancellationToken> { public CannotBeCanceledAssertion(.<.CancellationToken> context) { } @@ -366,6 +376,7 @@ namespace .Conditions protected override string GetExpectation() { } public . Within( tolerance) { } } + [.("EqualsExact")] public class DateTimeEqualsExactAssertion : .<> { public DateTimeEqualsExactAssertion(.<> context, expected) { } @@ -391,30 +402,35 @@ namespace .Conditions protected override .<.> CheckAsync(.<.> metadata) { } protected override string GetExpectation() { } } + [.("DoesNotExist")] public class DirectoryDoesNotExistAssertion : .<.DirectoryInfo> { public DirectoryDoesNotExistAssertion(.<.DirectoryInfo> context) { } protected override .<.> CheckAsync(.<.DirectoryInfo> metadata) { } protected override string GetExpectation() { } } + [.("Exists")] public class DirectoryExistsAssertion : .<.DirectoryInfo> { public DirectoryExistsAssertion(.<.DirectoryInfo> context) { } protected override .<.> CheckAsync(.<.DirectoryInfo> metadata) { } protected override string GetExpectation() { } } + [.("HasFiles")] public class DirectoryHasFilesAssertion : .<.DirectoryInfo> { public DirectoryHasFilesAssertion(.<.DirectoryInfo> context) { } protected override .<.> CheckAsync(.<.DirectoryInfo> metadata) { } protected override string GetExpectation() { } } + [.("HasNoSubdirectories")] public class DirectoryHasNoSubdirectoriesAssertion : .<.DirectoryInfo> { public DirectoryHasNoSubdirectoriesAssertion(.<.DirectoryInfo> context) { } protected override .<.> CheckAsync(.<.DirectoryInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotEmpty")] public class DirectoryIsNotEmptyAssertion : .<.DirectoryInfo> { public DirectoryIsNotEmptyAssertion(.<.DirectoryInfo> context) { } @@ -445,54 +461,63 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsFalse")] public class FalseAssertion : . { public FalseAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("DoesNotExist")] public class FileDoesNotExistAssertion : .<.FileInfo> { public FileDoesNotExistAssertion(.<.FileInfo> context) { } protected override .<.> CheckAsync(.<.FileInfo> metadata) { } protected override string GetExpectation() { } } + [.("Exists")] public class FileExistsAssertion : .<.FileInfo> { public FileExistsAssertion(.<.FileInfo> context) { } protected override .<.> CheckAsync(.<.FileInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotEmpty")] public class FileIsNotEmptyAssertion : .<.FileInfo> { public FileIsNotEmptyAssertion(.<.FileInfo> context) { } protected override .<.> CheckAsync(.<.FileInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotExecutable")] public class FileIsNotExecutableAssertion : .<.FileInfo> { public FileIsNotExecutableAssertion(.<.FileInfo> context) { } protected override .<.> CheckAsync(.<.FileInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotHidden")] public class FileIsNotHiddenAssertion : .<.FileInfo> { public FileIsNotHiddenAssertion(.<.FileInfo> context) { } protected override .<.> CheckAsync(.<.FileInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotReadOnly")] public class FileIsNotReadOnlyAssertion : .<.FileInfo> { public FileIsNotReadOnlyAssertion(.<.FileInfo> context) { } protected override .<.> CheckAsync(.<.FileInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotSystem")] public class FileIsNotSystemAssertion : .<.FileInfo> { public FileIsNotSystemAssertion(.<.FileInfo> context) { } protected override .<.> CheckAsync(.<.FileInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsGreaterThan")] public class GreaterThanAssertion : . where TValue : { @@ -500,6 +525,7 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsGreaterThanOrEqualTo")] public class GreaterThanOrEqualAssertion : . where TValue : { @@ -514,6 +540,7 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("HasInnerException")] public class HasInnerExceptionAssertion : .<> { public HasInnerExceptionAssertion(.<> context) { } @@ -538,12 +565,14 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("HasNoData")] public class HasNoDataAssertion : .<> { public HasNoDataAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("HasNoInnerException")] public class HasNoInnerExceptionAssertion : .<> { public HasNoInnerExceptionAssertion(.<> context) { } @@ -557,96 +586,112 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("HasStackTrace")] public class HasStackTraceAssertion : .<> { public HasStackTraceAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsASCII")] public class IsASCIIEncodingAssertion : .<.Encoding> { public IsASCIIEncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsAlive")] public class IsAliveAssertion : .<> { public IsAliveAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } - public class IsAssignableToAssertion : . + [.("IsAssignableTo")] + public class IsAssignableToAssertion : . { public IsAssignableToAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsBigEndianUnicode")] public class IsBigEndianUnicodeEncodingAssertion : .<.Encoding> { public IsBigEndianUnicodeEncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsCancellationRequested")] public class IsCancellationRequestedAssertion : .<.CancellationToken> { public IsCancellationRequestedAssertion(.<.CancellationToken> context) { } protected override .<.> CheckAsync(.<.CancellationToken> metadata) { } protected override string GetExpectation() { } } + [.("IsClientError")] public class IsClientErrorStatusCodeAssertion : .<.HttpStatusCode> { public IsClientErrorStatusCodeAssertion(.<.HttpStatusCode> context) { } protected override .<.> CheckAsync(.<.HttpStatusCode> metadata) { } protected override string GetExpectation() { } } + [.("IsCollectible")] public class IsCollectibleAssertion : .<.Assembly> { public IsCollectibleAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsControl")] public class IsControlAssertion : . { public IsControlAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsDaylightSavingTime")] public class IsDaylightSavingTimeAssertion : .<> { public IsDaylightSavingTimeAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsDead")] public class IsDeadAssertion : .<> { public IsDeadAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsDebugBuild")] public class IsDebugBuildAssertion : .<.Assembly> { public IsDebugBuildAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsDefault")] public class IsDefaultAssertion : . { public IsDefaultAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsDigit")] public class IsDigitAssertion : . { public IsDigitAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsDynamic")] public class IsDynamicAssertion : .<.Assembly> { public IsDynamicAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsEnglish")] public class IsEnglishCultureAssertion : .<.CultureInfo> { public IsEnglishCultureAssertion(.<.CultureInfo> context) { } @@ -668,24 +713,28 @@ namespace .Conditions protected override string GetExpectation() { } public . Using(. comparer) { } } + [.("IsError")] public class IsErrorStatusCodeAssertion : .<.HttpStatusCode> { public IsErrorStatusCodeAssertion(.<.HttpStatusCode> context) { } protected override .<.> CheckAsync(.<.HttpStatusCode> metadata) { } protected override string GetExpectation() { } } + [.("IsFriday")] public class IsFridayAssertion : .<> { public IsFridayAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsFullyTrusted")] public class IsFullyTrustedAssertion : .<.Assembly> { public IsFullyTrustedAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsHighSurrogate")] public class IsHighSurrogateAssertion : . { public IsHighSurrogateAssertion(. context) { } @@ -699,132 +748,154 @@ namespace .Conditions protected override string GetExpectation() { } public . Using(. comparer) { } } + [.("IsInformational")] public class IsInformationalStatusCodeAssertion : .<.HttpStatusCode> { public IsInformationalStatusCodeAssertion(.<.HttpStatusCode> context) { } protected override .<.> CheckAsync(.<.HttpStatusCode> metadata) { } protected override string GetExpectation() { } } + [.("IsInvariant")] public class IsInvariantCultureAssertion : .<.CultureInfo> { public IsInvariantCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsLeapYear")] public class IsLeapYearAssertion : .<> { public IsLeapYearAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsLeftToRight")] public class IsLeftToRightCultureAssertion : .<.CultureInfo> { public IsLeftToRightCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsLetter")] public class IsLetterAssertion : . { public IsLetterAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsLetterOrDigit")] public class IsLetterOrDigitAssertion : . { public IsLetterOrDigitAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsLowSurrogate")] public class IsLowSurrogateAssertion : . { public IsLowSurrogateAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsLower")] public class IsLowerAssertion : . { public IsLowerAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsMonday")] public class IsMondayAssertion : .<> { public IsMondayAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsNeutralCulture")] public class IsNeutralCultureAssertion : .<.CultureInfo> { public IsNeutralCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNone")] public class IsNoneAssertion : .<.CancellationToken> { public IsNoneAssertion(.<.CancellationToken> context) { } protected override .<.> CheckAsync(.<.CancellationToken> metadata) { } protected override string GetExpectation() { } } - public class IsNotAssignableToAssertion : . + [.("IsNotAssignableTo")] + public class IsNotAssignableToAssertion : . { public IsNotAssignableToAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotCancellationRequested")] public class IsNotCancellationRequestedAssertion : .<.CancellationToken> { public IsNotCancellationRequestedAssertion(.<.CancellationToken> context) { } protected override .<.> CheckAsync(.<.CancellationToken> metadata) { } protected override string GetExpectation() { } } + [.("IsNotCollectible")] public class IsNotCollectibleAssertion : .<.Assembly> { public IsNotCollectibleAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsNotControl")] public class IsNotControlAssertion : . { public IsNotControlAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotDaylightSavingTime")] public class IsNotDaylightSavingTimeAssertion : .<> { public IsNotDaylightSavingTimeAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsNotDefault")] public class IsNotDefaultAssertion : . { public IsNotDefaultAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotDigit")] public class IsNotDigitAssertion : . { public IsNotDigitAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotDynamic")] public class IsNotDynamicAssertion : .<.Assembly> { public IsNotDynamicAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsNotEnglish")] public class IsNotEnglishCultureAssertion : .<.CultureInfo> { public IsNotEnglishCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotFullyTrusted")] public class IsNotFullyTrustedAssertion : .<.Assembly> { public IsNotFullyTrustedAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsNotHighSurrogate")] public class IsNotHighSurrogateAssertion : . { public IsNotHighSurrogateAssertion(. context) { } @@ -838,210 +909,245 @@ namespace .Conditions protected override string GetExpectation() { } public . Using(. comparer) { } } + [.("IsNotInvariant")] public class IsNotInvariantCultureAssertion : .<.CultureInfo> { public IsNotInvariantCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotLeapYear")] public class IsNotLeapYearAssertion : .<> { public IsNotLeapYearAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsNotLetter")] public class IsNotLetterAssertion : . { public IsNotLetterAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotLetterOrDigit")] public class IsNotLetterOrDigitAssertion : . { public IsNotLetterOrDigitAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotLowSurrogate")] public class IsNotLowSurrogateAssertion : . { public IsNotLowSurrogateAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotLower")] public class IsNotLowerAssertion : . { public IsNotLowerAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotNeutralCulture")] public class IsNotNeutralCultureAssertion : .<.CultureInfo> { public IsNotNeutralCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotNone")] public class IsNotNoneAssertion : .<.CancellationToken> { public IsNotNoneAssertion(.<.CancellationToken> context) { } protected override .<.> CheckAsync(.<.CancellationToken> metadata) { } protected override string GetExpectation() { } } + [.("IsNotNumber")] public class IsNotNumberAssertion : . { public IsNotNumberAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotPunctuation")] public class IsNotPunctuationAssertion : . { public IsNotPunctuationAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotSeparator")] public class IsNotSeparatorAssertion : . { public IsNotSeparatorAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotSigned")] public class IsNotSignedAssertion : .<.Assembly> { public IsNotSignedAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsNotSingleByte")] public class IsNotSingleByteEncodingAssertion : .<.Encoding> { public IsNotSingleByteEncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsNotSuccess")] public class IsNotSuccessStatusCodeAssertion : .<.HttpStatusCode> { public IsNotSuccessStatusCodeAssertion(.<.HttpStatusCode> context) { } protected override .<.> CheckAsync(.<.HttpStatusCode> metadata) { } protected override string GetExpectation() { } } + [.("IsNotSurrogate")] public class IsNotSurrogateAssertion : . { public IsNotSurrogateAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotSymbol")] public class IsNotSymbolAssertion : . { public IsNotSymbolAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotToday")] public class IsNotTodayAssertion : .<> { public IsNotTodayAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsNotUTF8")] public class IsNotUTF8EncodingAssertion : .<.Encoding> { public IsNotUTF8EncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsNotUpper")] public class IsNotUpperAssertion : . { public IsNotUpperAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotUtc")] public class IsNotUtcAssertion : .<> { public IsNotUtcAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsNotWhiteSpace")] public class IsNotWhiteSpaceAssertion : . { public IsNotWhiteSpaceAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNumber")] public class IsNumberAssertion : . { public IsNumberAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsPunctuation")] public class IsPunctuationAssertion : . { public IsPunctuationAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsReadOnly")] public class IsReadOnlyCultureAssertion : .<.CultureInfo> { public IsReadOnlyCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsRedirection")] public class IsRedirectionStatusCodeAssertion : .<.HttpStatusCode> { public IsRedirectionStatusCodeAssertion(.<.HttpStatusCode> context) { } protected override .<.> CheckAsync(.<.HttpStatusCode> metadata) { } protected override string GetExpectation() { } } + [.("IsReleaseBuild")] public class IsReleaseBuildAssertion : .<.Assembly> { public IsReleaseBuildAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsRightToLeft")] public class IsRightToLeftCultureAssertion : .<.CultureInfo> { public IsRightToLeftCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsSeparator")] public class IsSeparatorAssertion : . { public IsSeparatorAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsServerError")] public class IsServerErrorStatusCodeAssertion : .<.HttpStatusCode> { public IsServerErrorStatusCodeAssertion(.<.HttpStatusCode> context) { } protected override .<.> CheckAsync(.<.HttpStatusCode> metadata) { } protected override string GetExpectation() { } } + [.("IsSigned")] public class IsSignedAssertion : .<.Assembly> { public IsSignedAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsSingleByte")] public class IsSingleByteEncodingAssertion : .<.Encoding> { public IsSingleByteEncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsSuccess")] public class IsSuccessStatusCodeAssertion : .<.HttpStatusCode> { public IsSuccessStatusCodeAssertion(.<.HttpStatusCode> context) { } protected override .<.> CheckAsync(.<.HttpStatusCode> metadata) { } protected override string GetExpectation() { } } + [.("IsSurrogate")] public class IsSurrogateAssertion : . { public IsSurrogateAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsSymbol")] public class IsSymbolAssertion : . { public IsSymbolAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsToday")] public class IsTodayAssertion : .<> { public IsTodayAssertion(.<> context) { } @@ -1054,54 +1160,63 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsUTF32")] public class IsUTF32EncodingAssertion : .<.Encoding> { public IsUTF32EncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsUTF8")] public class IsUTF8EncodingAssertion : .<.Encoding> { public IsUTF8EncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsUnicode")] public class IsUnicodeEncodingAssertion : .<.Encoding> { public IsUnicodeEncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsUpper")] public class IsUpperAssertion : . { public IsUpperAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsUtc")] public class IsUtcAssertion : .<> { public IsUtcAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsWeekday")] public class IsWeekdayAssertion : .<> { public IsWeekdayAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsWeekend")] public class IsWeekendAssertion : .<> { public IsWeekendAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsWhiteSpace")] public class IsWhiteSpaceAssertion : . { public IsWhiteSpaceAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsLessThan")] public class LessThanAssertion : . where TValue : { @@ -1109,6 +1224,7 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsLessThanOrEqualTo")] public class LessThanOrEqualAssertion : . where TValue : { @@ -1135,6 +1251,7 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotEqualTo")] public class NotEqualsAssertion : . { public NotEqualsAssertion(. context, TValue notExpected, .? comparer = null) { } @@ -1151,6 +1268,7 @@ namespace .Conditions protected override string GetExpectation() { } public . Using(. comparer) { } } + [.("IsNotNull")] public class NotNullAssertion : . { public NotNullAssertion(. context) { } @@ -1173,6 +1291,7 @@ namespace .Conditions public . IgnoringType() { } public . WithPartialEquivalency() { } } + [.("IsNull")] public class NullAssertion : . { public NullAssertion(. context) { } @@ -1191,24 +1310,28 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("HasExcessCapacity")] public class StringBuilderHasExcessCapacityAssertion : .<.StringBuilder> { public StringBuilderHasExcessCapacityAssertion(.<.StringBuilder> context) { } protected override .<.> CheckAsync(.<.StringBuilder> metadata) { } protected override string GetExpectation() { } } + [.("IsEmpty")] public class StringBuilderIsEmptyAssertion : .<.StringBuilder> { public StringBuilderIsEmptyAssertion(.<.StringBuilder> context) { } protected override .<.> CheckAsync(.<.StringBuilder> metadata) { } protected override string GetExpectation() { } } + [.("IsNotEmpty")] public class StringBuilderIsNotEmptyAssertion : .<.StringBuilder> { public StringBuilderIsNotEmptyAssertion(.<.StringBuilder> context) { } protected override .<.> CheckAsync(.<.StringBuilder> metadata) { } protected override string GetExpectation() { } } + [.("Contains")] public class StringContainsAssertion : . { public StringContainsAssertion(. context, string expected) { } @@ -1219,6 +1342,7 @@ namespace .Conditions public . WithComparison( comparison) { } public . WithTrimming() { } } + [.("DoesNotContain")] public class StringDoesNotContainAssertion : . { public StringDoesNotContainAssertion(. context, string expected) { } @@ -1227,6 +1351,7 @@ namespace .Conditions public . IgnoringCase() { } public . WithComparison( comparison) { } } + [.("DoesNotMatch")] public class StringDoesNotMatchAssertion : . { public StringDoesNotMatchAssertion(. context, . regex) { } @@ -1236,6 +1361,7 @@ namespace .Conditions public . IgnoringCase() { } public . WithOptions(. options) { } } + [.("EndsWith")] public class StringEndsWithAssertion : . { public StringEndsWithAssertion(. context, string expected) { } @@ -1255,30 +1381,35 @@ namespace .Conditions public . WithNullAndEmptyEquality() { } public . WithTrimming() { } } + [.("IsEmpty")] public class StringIsEmptyAssertion : . { public StringIsEmptyAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotEmpty")] public class StringIsNotEmptyAssertion : . { public StringIsNotEmptyAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotNullOrEmpty")] public class StringIsNotNullOrEmptyAssertion : . { public StringIsNotNullOrEmptyAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNullOrEmpty")] public class StringIsNullOrEmptyAssertion : . { public StringIsNullOrEmptyAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNullOrWhitespace")] public class StringIsNullOrWhitespaceAssertion : . { public StringIsNullOrWhitespaceAssertion(. context) { } @@ -1291,6 +1422,7 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("Matches")] public class StringMatchesAssertion : . { public StringMatchesAssertion(. context, . regex) { } @@ -1300,6 +1432,7 @@ namespace .Conditions public . IgnoringCase() { } public . WithOptions(. options) { } } + [.("StartsWith")] public class StringStartsWithAssertion : . { public StringStartsWithAssertion(. context, string expected) { } @@ -1346,6 +1479,7 @@ namespace .Conditions protected override string GetExpectation() { } public . Within( tolerance) { } } + [.("IsTrue")] public class TrueAssertion : . { public TrueAssertion(. context) { } @@ -1492,19 +1626,6 @@ namespace .Exceptions } namespace .Extensions { - public static class AssemblyAssertionExtensions - { - public static . IsCollectible(this .<.Assembly> source) { } - public static . IsDebugBuild(this .<.Assembly> source) { } - public static . IsDynamic(this .<.Assembly> source) { } - public static . IsFullyTrusted(this .<.Assembly> source) { } - public static . IsNotCollectible(this .<.Assembly> source) { } - public static . IsNotDynamic(this .<.Assembly> source) { } - public static . IsNotFullyTrusted(this .<.Assembly> source) { } - public static . IsNotSigned(this .<.Assembly> source) { } - public static . IsReleaseBuild(this .<.Assembly> source) { } - public static . IsSigned(this .<.Assembly> source) { } - } public static class AssertionExtensions { public static .<., TItem> All(this .<.> source) { } @@ -1517,7 +1638,6 @@ namespace .Extensions where TCollection : . { } public static . CompletesWithin(this . source, timeout, [.("timeout")] string? expression = null) { } public static . CompletesWithin(this . source, timeout, [.("timeout")] string? expression = null) { } - public static . Contains(this . source, string expected, [.("expected")] string? expression = null) { } public static .<., TItem> Contains(this .<.> source, predicate, [.("predicate")] string? expression = null) { } public static .<., TItem> Contains(this .<.> source, TItem expected, [.("expected")] string? expression = null) { } public static . Contains(this . source, TItem expected, [.("expected")] string? expression = null) @@ -1537,7 +1657,6 @@ namespace .Extensions public static .<., TItem> ContainsOnly(this .<.> source, predicate, [.("predicate")] string? expression = null) { } public static . ContainsOnly(this . source, predicate, [.("predicate")] string? expression = null) where TCollection : . { } - public static . DoesNotContain(this . source, string expected, [.("expected")] string? expression = null) { } public static .<., TItem> DoesNotContain(this .<.> source, predicate, [.("predicate")] string? expression = null) { } public static .<., TItem> DoesNotContain(this .<.> source, TItem expected, [.("expected")] string? expression = null) { } public static . DoesNotContain(this . source, predicate, [.("predicate")] string? expression = null) @@ -1553,9 +1672,6 @@ namespace .Extensions where TEnum : struct, { } public static ..DoesNotHaveSameValueAsAssertion DoesNotHaveSameValueAs(this . source, otherEnumValue, [.("otherEnumValue")] string? expression = null) where TEnum : struct, { } - public static . DoesNotMatch(this . source, . regex, [.("regex")] string? expression = null) { } - public static . DoesNotMatch(this . source, string pattern, [.("pattern")] string? expression = null) { } - public static . EndsWith(this . source, string expected, [.("expected")] string? expression = null) { } public static . EqualTo(this . source, TValue expected, [.("expected")] string? expression = null) { } public static ..CountWrapper HasCount(this . source) where TValue : .IEnumerable { } @@ -1566,6 +1682,7 @@ namespace .Extensions public static ..HasFlagAssertion HasFlag(this . source, TEnum expectedFlag, [.("expectedFlag")] string? expression = null) where TEnum : struct, { } public static ..LengthWrapper HasLength(this . source) { } + public static ..LengthWrapper HasLength(this . source) { } public static . HasLength(this . source, int expectedLength, [.("expectedLength")] string? expression = null) { } public static . HasMember(this . source, .<> memberSelector) { } public static . HasMessageContaining(this . source, string expectedSubstring) { } @@ -1593,14 +1710,10 @@ namespace .Extensions public static . HasSingleItem(this . source) where TValue : .IEnumerable { } public static .<> IsAfterOrEqualTo(this .<> source, expected, [.("expected")] string? expression = null) { } - public static . IsAssignableTo(this . source) { } - public static . IsAssignableTo(this . source) { } - public static . IsBetween(this . source, TValue minimum, TValue maximum, [.("minimum")] string? minExpr = null, [.("maximum")] string? maxExpr = null) - where TValue : { } - public static . IsDefault(this . source) { } + public static . IsAssignableTo(this . source) { } + public static . IsAssignableTo(this . source) { } public static ..IsDefinedAssertion IsDefined(this . source) where TEnum : struct, { } - public static . IsEmpty(this . source) { } public static . IsEmpty(this . source) where TValue : .IEnumerable { } public static . IsEqualTo(this .<> source, expected, [.("expected")] string? expression = null) { } @@ -1616,7 +1729,6 @@ namespace .Extensions public static . IsEqualTo(this . source, TValue expected, [.("expected")] string? expression = null) { } public static . IsEqualTo(this . source, TValue expected, [.("expected")] string? expression = null) { } public static . IsEqualTo(this . source, TValue expected, [.("expected")] string? expression = null) { } - public static . IsEqualTo(this . source, TValue expected, . comparer, [.("expected")] string? expression = null) { } public static . IsEquatableOrEqualTo(this . source, TValue expected, [.("expected")] string? expression = null) { } public static . IsEquivalentTo(this . source, object? expected, [.("expected")] string? expression = null) { } public static . IsEquivalentTo(this . source, . expected, [.("expected")] string? expression = null) @@ -1626,12 +1738,7 @@ namespace .Extensions public static . IsEquivalentTo(this . source, . expected, . ordering, [.("expected")] string? expression = null) where TCollection : . { } public static . IsFalse(this . source) { } - public static . IsFalse(this . source) { } public static . IsFalse(this . source) { } - public static . IsGreaterThan(this . source, TValue minimum, [.("minimum")] string? expression = null) - where TValue : { } - public static . IsGreaterThanOrEqualTo(this . source, TValue minimum, [.("minimum")] string? expression = null) - where TValue : { } public static . IsIn(this . source, params TValue[] collection) { } public static . IsIn(this . source, . collection, [.("collection")] string? expression = null) { } public static .<., TItem> IsInDescendingOrder(this .<.> source) @@ -1644,24 +1751,16 @@ namespace .Extensions public static . IsInOrder(this . source) where TCollection : . where TItem : { } - public static . IsLessThan(this . source, TValue maximum, [.("maximum")] string? expression = null) - where TValue : { } - public static . IsLessThanOrEqualTo(this . source, TValue maximum, [.("maximum")] string? expression = null) - where TValue : { } public static . IsNegative(this . source) where TValue : { } public static . IsNegative(this . source) where TValue : struct, { } - public static . IsNotAssignableTo(this . source) { } - public static . IsNotAssignableTo(this . source) { } - public static . IsNotDefault(this . source) { } + public static . IsNotAssignableTo(this . source) { } public static ..IsNotDefinedAssertion IsNotDefined(this . source) where TEnum : struct, { } - public static . IsNotEmpty(this . source) { } public static . IsNotEmpty(this . source) where TValue : .IEnumerable { } public static . IsNotEqualTo(this . source, TValue expected, [.("expected")] string? expression = null) { } - public static . IsNotEqualTo(this . source, TValue notExpected, [.("notExpected")] string? expression = null) { } public static . IsNotEqualTo(this . source, TValue expected, [.("expected")] string? expression = null) { } public static . IsNotEquivalentTo(this . source, object? expected, [.("expected")] string? expression = null) { } public static . IsNotEquivalentTo(this . source, . expected, [.("expected")] string? expression = null) @@ -1672,15 +1771,13 @@ namespace .Extensions where TCollection : . { } public static . IsNotIn(this . source, params TValue[] collection) { } public static . IsNotIn(this . source, . collection, [.("collection")] string? expression = null) { } - public static . IsNotNull(this . source) { } - public static . IsNotNullOrEmpty(this . source) { } public static ..IsNotParsableIntoAssertion IsNotParsableInto<[.(..None | ..PublicMethods | ..Interfaces)] T>(this . source) { } public static . IsNotSameReferenceAs(this . source, object? expected, [.("expected")] string? expression = null) { } - public static . IsNull(this . source) { } public static . IsNullOrEmpty(this . source) { } - public static . IsNullOrEmpty(this . source) { } public static . IsNullOrEmpty(this . source) { } - public static . IsNullOrWhitespace(this . source) { } + public static . IsOfType(this . source, expectedType) { } + public static . IsOfType(this . source, expectedType) { } + public static . IsOfType(this . source, expectedType, [.("expectedType")] string? expression = null) { } public static ..IsParsableIntoAssertion IsParsableInto<[.(..None | ..PublicMethods | ..Interfaces)] T>(this . source) { } public static . IsPositive(this . source) where TValue : { } @@ -1688,19 +1785,12 @@ namespace .Extensions where TValue : struct, { } public static . IsSameReferenceAs(this . source, object? expected, [.("expected")] string? expression = null) { } public static . IsTrue(this . source) { } - public static . IsTrue(this . source) { } public static . IsTrue(this . source) { } - public static . IsTypeOf(this . source, expectedType) { } public static . IsTypeOf(this . source) { } - public static . IsTypeOf(this . source, expectedType) { } - public static . IsTypeOf(this . source, expectedType) { } - public static . IsTypeOf(this . source) { } - public static . Matches(this . source, . regex, [.("regex")] string? expression = null) { } - public static . Matches(this . source, string pattern, [.("pattern")] string? expression = null) { } + public static . IsTypeOf(this . source) { } public static . Satisfies(this . source, predicate, [.("predicate")] string? expression = null) { } public static . Satisfies(this . source, > selector, <., .?> assertions, [.("selector")] string? selectorExpression = null) { } public static . Satisfies(this . source, selector, <., .?> assertions, [.("selector")] string? selectorExpression = null) { } - public static . StartsWith(this . source, string expected, [.("expected")] string? expression = null) { } public static . Throws(this . source) where TException : { } public static . Throws(this . source) @@ -1723,121 +1813,520 @@ namespace .Extensions public static . WithMessageContaining(this . source, string expectedSubstring) { } public static . WithMessageContaining(this . source, string expectedSubstring, comparison) { } } - public static class CancellationTokenAssertionExtensions + public static class BetweenAssertionExtensions + { + public static . IsBetween(this . source, TValue minimum, TValue maximum, [.("minimum")] string? minimumExpression = null, [.("maximum")] string? maximumExpression = null) + where TValue : { } + } + public static class CanBeCanceledAssertionExtensions { public static . CanBeCanceled(this .<.CancellationToken> source) { } + } + public static class CannotBeCanceledAssertionExtensions + { public static . CannotBeCanceled(this .<.CancellationToken> source) { } + } + public static class DateTimeEqualsExactAssertionExtensions + { + public static . EqualsExact(this .<> source, expected, [.("expected")] string? expectedExpression = null) { } + } + public static class DirectoryDoesNotExistAssertionExtensions + { + public static . DoesNotExist(this .<.DirectoryInfo> source) { } + } + public static class DirectoryExistsAssertionExtensions + { + public static . Exists(this .<.DirectoryInfo> source) { } + } + public static class DirectoryHasFilesAssertionExtensions + { + public static . HasFiles(this .<.DirectoryInfo> source) { } + } + public static class DirectoryHasNoSubdirectoriesAssertionExtensions + { + public static . HasNoSubdirectories(this .<.DirectoryInfo> source) { } + } + public static class DirectoryIsNotEmptyAssertionExtensions + { + public static . IsNotEmpty(this .<.DirectoryInfo> source) { } + } + public static class FalseAssertionExtensions + { + public static . IsFalse(this . source) { } + } + public static class FileDoesNotExistAssertionExtensions + { + public static . DoesNotExist(this .<.FileInfo> source) { } + } + public static class FileExistsAssertionExtensions + { + public static . Exists(this .<.FileInfo> source) { } + } + public static class FileIsNotEmptyAssertionExtensions + { + public static . IsNotEmpty(this .<.FileInfo> source) { } + } + public static class FileIsNotExecutableAssertionExtensions + { + public static . IsNotExecutable(this .<.FileInfo> source) { } + } + public static class FileIsNotHiddenAssertionExtensions + { + public static . IsNotHidden(this .<.FileInfo> source) { } + } + public static class FileIsNotReadOnlyAssertionExtensions + { + public static . IsNotReadOnly(this .<.FileInfo> source) { } + } + public static class FileIsNotSystemAssertionExtensions + { + public static . IsNotSystem(this .<.FileInfo> source) { } + } + public static class GreaterThanAssertionExtensions + { + public static . IsGreaterThan(this . source, TValue minimum, [.("minimum")] string? minimumExpression = null) + where TValue : { } + } + public static class GreaterThanOrEqualAssertionExtensions + { + public static . IsGreaterThanOrEqualTo(this . source, TValue minimum, [.("minimum")] string? minimumExpression = null) + where TValue : { } + } + public static class HasInnerExceptionAssertionExtensions + { + public static . HasInnerException(this .<> source) { } + } + public static class HasNoDataAssertionExtensions + { + public static . HasNoData(this .<> source) { } + } + public static class HasNoInnerExceptionAssertionExtensions + { + public static . HasNoInnerException(this .<> source) { } + } + public static class HasStackTraceAssertionExtensions + { + public static . HasStackTrace(this .<> source) { } + } + public static class IsASCIIEncodingAssertionExtensions + { + public static . IsASCII(this .<.Encoding> source) { } + } + public static class IsAliveAssertionExtensions + { + public static . IsAlive(this .<> source) { } + } + public static class IsAssignableToAssertionExtensions + { + public static . IsAssignableTo(this . source) { } + } + public static class IsBigEndianUnicodeEncodingAssertionExtensions + { + public static . IsBigEndianUnicode(this .<.Encoding> source) { } + } + public static class IsCancellationRequestedAssertionExtensions + { public static . IsCancellationRequested(this .<.CancellationToken> source) { } - public static . IsNone(this .<.CancellationToken> source) { } - public static . IsNotCancellationRequested(this .<.CancellationToken> source) { } - public static . IsNotNone(this .<.CancellationToken> source) { } } - public static class CharAssertionExtensions + public static class IsClientErrorStatusCodeAssertionExtensions + { + public static . IsClientError(this .<.HttpStatusCode> source) { } + } + public static class IsCollectibleAssertionExtensions + { + public static . IsCollectible(this .<.Assembly> source) { } + } + public static class IsControlAssertionExtensions { public static . IsControl(this . source) { } + } + public static class IsDaylightSavingTimeAssertionExtensions + { + public static . IsDaylightSavingTime(this .<> source) { } + } + public static class IsDeadAssertionExtensions + { + public static . IsDead(this .<> source) { } + } + public static class IsDebugBuildAssertionExtensions + { + public static . IsDebugBuild(this .<.Assembly> source) { } + } + public static class IsDefaultAssertionExtensions + { + public static . IsDefault(this . source) { } + } + public static class IsDigitAssertionExtensions + { public static . IsDigit(this . source) { } + } + public static class IsDynamicAssertionExtensions + { + public static . IsDynamic(this .<.Assembly> source) { } + } + public static class IsEnglishCultureAssertionExtensions + { + public static . IsEnglish(this .<.CultureInfo> source) { } + } + public static class IsErrorStatusCodeAssertionExtensions + { + public static . IsError(this .<.HttpStatusCode> source) { } + } + public static class IsFridayAssertionExtensions + { + public static . IsFriday(this .<> source) { } + } + public static class IsFullyTrustedAssertionExtensions + { + public static . IsFullyTrusted(this .<.Assembly> source) { } + } + public static class IsHighSurrogateAssertionExtensions + { public static . IsHighSurrogate(this . source) { } + } + public static class IsInformationalStatusCodeAssertionExtensions + { + public static . IsInformational(this .<.HttpStatusCode> source) { } + } + public static class IsInvariantCultureAssertionExtensions + { + public static . IsInvariant(this .<.CultureInfo> source) { } + } + public static class IsLeapYearAssertionExtensions + { + public static . IsLeapYear(this .<> source) { } + } + public static class IsLeftToRightCultureAssertionExtensions + { + public static . IsLeftToRight(this .<.CultureInfo> source) { } + } + public static class IsLetterAssertionExtensions + { public static . IsLetter(this . source) { } + } + public static class IsLetterOrDigitAssertionExtensions + { public static . IsLetterOrDigit(this . source) { } + } + public static class IsLowSurrogateAssertionExtensions + { public static . IsLowSurrogate(this . source) { } + } + public static class IsLowerAssertionExtensions + { public static . IsLower(this . source) { } + } + public static class IsMondayAssertionExtensions + { + public static . IsMonday(this .<> source) { } + } + public static class IsNeutralCultureAssertionExtensions + { + public static . IsNeutralCulture(this .<.CultureInfo> source) { } + } + public static class IsNoneAssertionExtensions + { + public static . IsNone(this .<.CancellationToken> source) { } + } + public static class IsNotAssignableToAssertionExtensions + { + public static . IsNotAssignableTo(this . source) { } + } + public static class IsNotCancellationRequestedAssertionExtensions + { + public static . IsNotCancellationRequested(this .<.CancellationToken> source) { } + } + public static class IsNotCollectibleAssertionExtensions + { + public static . IsNotCollectible(this .<.Assembly> source) { } + } + public static class IsNotControlAssertionExtensions + { public static . IsNotControl(this . source) { } + } + public static class IsNotDaylightSavingTimeAssertionExtensions + { + public static . IsNotDaylightSavingTime(this .<> source) { } + } + public static class IsNotDefaultAssertionExtensions + { + public static . IsNotDefault(this . source) { } + } + public static class IsNotDigitAssertionExtensions + { public static . IsNotDigit(this . source) { } + } + public static class IsNotDynamicAssertionExtensions + { + public static . IsNotDynamic(this .<.Assembly> source) { } + } + public static class IsNotEnglishCultureAssertionExtensions + { + public static . IsNotEnglish(this .<.CultureInfo> source) { } + } + public static class IsNotFullyTrustedAssertionExtensions + { + public static . IsNotFullyTrusted(this .<.Assembly> source) { } + } + public static class IsNotHighSurrogateAssertionExtensions + { public static . IsNotHighSurrogate(this . source) { } + } + public static class IsNotInvariantCultureAssertionExtensions + { + public static . IsNotInvariant(this .<.CultureInfo> source) { } + } + public static class IsNotLeapYearAssertionExtensions + { + public static . IsNotLeapYear(this .<> source) { } + } + public static class IsNotLetterAssertionExtensions + { public static . IsNotLetter(this . source) { } + } + public static class IsNotLetterOrDigitAssertionExtensions + { public static . IsNotLetterOrDigit(this . source) { } + } + public static class IsNotLowSurrogateAssertionExtensions + { public static . IsNotLowSurrogate(this . source) { } + } + public static class IsNotLowerAssertionExtensions + { public static . IsNotLower(this . source) { } + } + public static class IsNotNeutralCultureAssertionExtensions + { + public static . IsNotNeutralCulture(this .<.CultureInfo> source) { } + } + public static class IsNotNoneAssertionExtensions + { + public static . IsNotNone(this .<.CancellationToken> source) { } + } + public static class IsNotNumberAssertionExtensions + { public static . IsNotNumber(this . source) { } + } + public static class IsNotPunctuationAssertionExtensions + { public static . IsNotPunctuation(this . source) { } + } + public static class IsNotSeparatorAssertionExtensions + { public static . IsNotSeparator(this . source) { } + } + public static class IsNotSignedAssertionExtensions + { + public static . IsNotSigned(this .<.Assembly> source) { } + } + public static class IsNotSingleByteEncodingAssertionExtensions + { + public static . IsNotSingleByte(this .<.Encoding> source) { } + } + public static class IsNotSuccessStatusCodeAssertionExtensions + { + public static . IsNotSuccess(this .<.HttpStatusCode> source) { } + } + public static class IsNotSurrogateAssertionExtensions + { public static . IsNotSurrogate(this . source) { } + } + public static class IsNotSymbolAssertionExtensions + { public static . IsNotSymbol(this . source) { } + } + public static class IsNotTodayAssertionExtensions + { + public static . IsNotToday(this .<> source) { } + } + public static class IsNotUTF8EncodingAssertionExtensions + { + public static .8EncodingAssertion IsNotUTF8(this .<.Encoding> source) { } + } + public static class IsNotUpperAssertionExtensions + { public static . IsNotUpper(this . source) { } + } + public static class IsNotUtcAssertionExtensions + { + public static . IsNotUtc(this .<> source) { } + } + public static class IsNotWhiteSpaceAssertionExtensions + { public static . IsNotWhiteSpace(this . source) { } + } + public static class IsNumberAssertionExtensions + { public static . IsNumber(this . source) { } + } + public static class IsPunctuationAssertionExtensions + { public static . IsPunctuation(this . source) { } - public static . IsSeparator(this . source) { } - public static . IsSurrogate(this . source) { } - public static . IsSymbol(this . source) { } - public static . IsUpper(this . source) { } - public static . IsWhiteSpace(this . source) { } } - public static class CultureInfoAssertionExtensions + public static class IsReadOnlyCultureAssertionExtensions { - public static . IsEnglish(this .<.CultureInfo> source) { } - public static . IsInvariant(this .<.CultureInfo> source) { } - public static . IsLeftToRight(this .<.CultureInfo> source) { } - public static . IsNeutralCulture(this .<.CultureInfo> source) { } - public static . IsNotEnglish(this .<.CultureInfo> source) { } - public static . IsNotInvariant(this .<.CultureInfo> source) { } - public static . IsNotNeutralCulture(this .<.CultureInfo> source) { } public static . IsReadOnly(this .<.CultureInfo> source) { } + } + public static class IsRedirectionStatusCodeAssertionExtensions + { + public static . IsRedirection(this .<.HttpStatusCode> source) { } + } + public static class IsReleaseBuildAssertionExtensions + { + public static . IsReleaseBuild(this .<.Assembly> source) { } + } + public static class IsRightToLeftCultureAssertionExtensions + { public static . IsRightToLeft(this .<.CultureInfo> source) { } } - public static class DateTimeAssertionExtensions + public static class IsSeparatorAssertionExtensions { - public static . EqualsExact(this .<> source, expected, [.("expected")] string? expression = null) { } - public static . IsDaylightSavingTime(this .<> source) { } - public static . IsLeapYear(this .<> source) { } - public static . IsNotDaylightSavingTime(this .<> source) { } - public static . IsNotLeapYear(this .<> source) { } - public static . IsNotToday(this .<> source) { } - public static . IsNotUtc(this .<> source) { } - public static . IsToday(this .<> source) { } - public static . IsUtc(this .<> source) { } + public static . IsSeparator(this . source) { } } - public static class EncodingAssertionExtensions + public static class IsServerErrorStatusCodeAssertionExtensions + { + public static . IsServerError(this .<.HttpStatusCode> source) { } + } + public static class IsSignedAssertionExtensions + { + public static . IsSigned(this .<.Assembly> source) { } + } + public static class IsSingleByteEncodingAssertionExtensions { - public static . IsASCII(this .<.Encoding> source) { } - public static . IsBigEndianUnicode(this .<.Encoding> source) { } - public static . IsNotSingleByte(this .<.Encoding> source) { } - public static .8EncodingAssertion IsNotUTF8(this .<.Encoding> source) { } public static . IsSingleByte(this .<.Encoding> source) { } + } + public static class IsSuccessStatusCodeAssertionExtensions + { + public static . IsSuccess(this .<.HttpStatusCode> source) { } + } + public static class IsSurrogateAssertionExtensions + { + public static . IsSurrogate(this . source) { } + } + public static class IsSymbolAssertionExtensions + { + public static . IsSymbol(this . source) { } + } + public static class IsTodayAssertionExtensions + { + public static . IsToday(this .<> source) { } + } + public static class IsUTF32EncodingAssertionExtensions + { public static .32EncodingAssertion IsUTF32(this .<.Encoding> source) { } + } + public static class IsUTF8EncodingAssertionExtensions + { public static .8EncodingAssertion IsUTF8(this .<.Encoding> source) { } + } + public static class IsUnicodeEncodingAssertionExtensions + { public static . IsUnicode(this .<.Encoding> source) { } } - public static class FileSystemAssertionExtensions + public static class IsUpperAssertionExtensions { - public static . DoesNotExist(this .<.DirectoryInfo> source) { } - public static . DoesNotExist(this .<.FileInfo> source) { } - public static . Exists(this .<.DirectoryInfo> source) { } - public static . Exists(this .<.FileInfo> source) { } - public static . HasFiles(this .<.DirectoryInfo> source) { } - public static . HasNoSubdirectories(this .<.DirectoryInfo> source) { } - public static . IsNotEmpty(this .<.DirectoryInfo> source) { } - public static . IsNotEmpty(this .<.FileInfo> source) { } - public static . IsNotExecutable(this .<.FileInfo> source) { } - public static . IsNotHidden(this .<.FileInfo> source) { } - public static . IsNotReadOnly(this .<.FileInfo> source) { } - public static . IsNotSystem(this .<.FileInfo> source) { } + public static . IsUpper(this . source) { } } - public static class HttpStatusCodeAssertionExtensions + public static class IsUtcAssertionExtensions { - public static . IsClientError(this .<.HttpStatusCode> source) { } - public static . IsError(this .<.HttpStatusCode> source) { } - public static . IsInformational(this .<.HttpStatusCode> source) { } - public static . IsNotSuccess(this .<.HttpStatusCode> source) { } - public static . IsRedirection(this .<.HttpStatusCode> source) { } - public static . IsServerError(this .<.HttpStatusCode> source) { } - public static . IsSuccess(this .<.HttpStatusCode> source) { } + public static . IsUtc(this .<> source) { } + } + public static class IsWeekdayAssertionExtensions + { + public static . IsWeekday(this .<> source) { } + } + public static class IsWeekendAssertionExtensions + { + public static . IsWeekend(this .<> source) { } + } + public static class IsWhiteSpaceAssertionExtensions + { + public static . IsWhiteSpace(this . source) { } + } + public static class LessThanAssertionExtensions + { + public static . IsLessThan(this . source, TValue maximum, [.("maximum")] string? maximumExpression = null) + where TValue : { } + } + public static class LessThanOrEqualAssertionExtensions + { + public static . IsLessThanOrEqualTo(this . source, TValue maximum, [.("maximum")] string? maximumExpression = null) + where TValue : { } + } + public static class NotEqualsAssertionExtensions + { + public static . IsNotEqualTo(this . source, TValue notExpected, .? comparer = null, [.("notExpected")] string? notExpectedExpression = null, [.("comparer")] string? comparerExpression = null) { } + } + public static class NotNullAssertionExtensions + { + public static . IsNotNull(this . source) { } + } + public static class NullAssertionExtensions + { + public static . IsNull(this . source) { } } - public static class MiscellaneousAssertionExtensions + public static class StringBuilderHasExcessCapacityAssertionExtensions { public static . HasExcessCapacity(this .<.StringBuilder> source) { } - public static . HasInnerException(this .<> source) { } - public static . HasNoData(this .<> source) { } - public static . HasNoInnerException(this .<> source) { } - public static . HasStackTrace(this .<> source) { } - public static . IsAlive(this .<> source) { } - public static . IsDead(this .<> source) { } + } + public static class StringBuilderIsEmptyAssertionExtensions + { public static . IsEmpty(this .<.StringBuilder> source) { } - public static . IsFriday(this .<> source) { } - public static . IsMonday(this .<> source) { } + } + public static class StringBuilderIsNotEmptyAssertionExtensions + { public static . IsNotEmpty(this .<.StringBuilder> source) { } - public static . IsWeekday(this .<> source) { } - public static . IsWeekend(this .<> source) { } + } + public static class StringContainsAssertionExtensions + { + public static . Contains(this . source, string expected, [.("expected")] string? expectedExpression = null) { } + } + public static class StringDoesNotContainAssertionExtensions + { + public static . DoesNotContain(this . source, string expected, [.("expected")] string? expectedExpression = null) { } + } + public static class StringDoesNotMatchAssertionExtensions + { + public static . DoesNotMatch(this . source, . regex, [.("regex")] string? regexExpression = null) { } + public static . DoesNotMatch(this . source, string pattern, [.("pattern")] string? patternExpression = null) { } + } + public static class StringEndsWithAssertionExtensions + { + public static . EndsWith(this . source, string expected, [.("expected")] string? expectedExpression = null) { } + } + public static class StringIsEmptyAssertionExtensions + { + public static . IsEmpty(this . source) { } + } + public static class StringIsNotEmptyAssertionExtensions + { + public static . IsNotEmpty(this . source) { } + } + public static class StringIsNotNullOrEmptyAssertionExtensions + { + public static . IsNotNullOrEmpty(this . source) { } + } + public static class StringIsNullOrEmptyAssertionExtensions + { + public static . IsNullOrEmpty(this . source) { } + } + public static class StringIsNullOrWhitespaceAssertionExtensions + { + public static . IsNullOrWhitespace(this . source) { } + } + public static class StringMatchesAssertionExtensions + { + public static . Matches(this . source, . regex, [.("regex")] string? regexExpression = null) { } + public static . Matches(this . source, string pattern, [.("pattern")] string? patternExpression = null) { } + } + public static class StringStartsWithAssertionExtensions + { + public static . StartsWith(this . source, string expected, [.("expected")] string? expectedExpression = null) { } + } + public static class TrueAssertionExtensions + { + public static . IsTrue(this . source) { } } } namespace .Sources diff --git a/TUnit.PublicAPI/Tests.Assertions_Library_Has_No_API_Changes.Net4_7.verified.txt b/TUnit.PublicAPI/Tests.Assertions_Library_Has_No_API_Changes.Net4_7.verified.txt index 59ec537699..27ea9635cb 100644 --- a/TUnit.PublicAPI/Tests.Assertions_Library_Has_No_API_Changes.Net4_7.verified.txt +++ b/TUnit.PublicAPI/Tests.Assertions_Library_Has_No_API_Changes.Net4_7.verified.txt @@ -145,6 +145,13 @@ namespace . } namespace .Attributes { + [(.Class, AllowMultiple=false)] + public class AssertionExtensionAttribute : + { + public AssertionExtensionAttribute(string methodName) { } + public string MethodName { get; } + public string? NegatedMethodName { get; set; } + } [(.Class, AllowMultiple=true)] public class CreateAssertionAttribute : { @@ -217,6 +224,7 @@ namespace .Conditions public TSelf WithMessageNotContaining(string notExpectedSubstring, comparison, [.("notExpectedSubstring")] string? expression = null) { } public TSelf WithParameterName(string expectedParameterName, [.("expectedParameterName")] string? expression = null) { } } + [.("IsBetween")] public class BetweenAssertion : . where TValue : { @@ -228,12 +236,14 @@ namespace .Conditions public . InclusiveMaximum() { } public . InclusiveMinimum() { } } + [.("CanBeCanceled")] public class CanBeCanceledAssertion : .<.CancellationToken> { public CanBeCanceledAssertion(.<.CancellationToken> context) { } protected override .<.> CheckAsync(.<.CancellationToken> metadata) { } protected override string GetExpectation() { } } + [.("CannotBeCanceled")] public class CannotBeCanceledAssertion : .<.CancellationToken> { public CannotBeCanceledAssertion(.<.CancellationToken> context) { } @@ -359,6 +369,7 @@ namespace .Conditions protected override string GetExpectation() { } public . Within( tolerance) { } } + [.("EqualsExact")] public class DateTimeEqualsExactAssertion : .<> { public DateTimeEqualsExactAssertion(.<> context, expected) { } @@ -384,30 +395,35 @@ namespace .Conditions protected override .<.> CheckAsync(.<.> metadata) { } protected override string GetExpectation() { } } + [.("DoesNotExist")] public class DirectoryDoesNotExistAssertion : .<.DirectoryInfo> { public DirectoryDoesNotExistAssertion(.<.DirectoryInfo> context) { } protected override .<.> CheckAsync(.<.DirectoryInfo> metadata) { } protected override string GetExpectation() { } } + [.("Exists")] public class DirectoryExistsAssertion : .<.DirectoryInfo> { public DirectoryExistsAssertion(.<.DirectoryInfo> context) { } protected override .<.> CheckAsync(.<.DirectoryInfo> metadata) { } protected override string GetExpectation() { } } + [.("HasFiles")] public class DirectoryHasFilesAssertion : .<.DirectoryInfo> { public DirectoryHasFilesAssertion(.<.DirectoryInfo> context) { } protected override .<.> CheckAsync(.<.DirectoryInfo> metadata) { } protected override string GetExpectation() { } } + [.("HasNoSubdirectories")] public class DirectoryHasNoSubdirectoriesAssertion : .<.DirectoryInfo> { public DirectoryHasNoSubdirectoriesAssertion(.<.DirectoryInfo> context) { } protected override .<.> CheckAsync(.<.DirectoryInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotEmpty")] public class DirectoryIsNotEmptyAssertion : .<.DirectoryInfo> { public DirectoryIsNotEmptyAssertion(.<.DirectoryInfo> context) { } @@ -437,54 +453,63 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsFalse")] public class FalseAssertion : . { public FalseAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("DoesNotExist")] public class FileDoesNotExistAssertion : .<.FileInfo> { public FileDoesNotExistAssertion(.<.FileInfo> context) { } protected override .<.> CheckAsync(.<.FileInfo> metadata) { } protected override string GetExpectation() { } } + [.("Exists")] public class FileExistsAssertion : .<.FileInfo> { public FileExistsAssertion(.<.FileInfo> context) { } protected override .<.> CheckAsync(.<.FileInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotEmpty")] public class FileIsNotEmptyAssertion : .<.FileInfo> { public FileIsNotEmptyAssertion(.<.FileInfo> context) { } protected override .<.> CheckAsync(.<.FileInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotExecutable")] public class FileIsNotExecutableAssertion : .<.FileInfo> { public FileIsNotExecutableAssertion(.<.FileInfo> context) { } protected override .<.> CheckAsync(.<.FileInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotHidden")] public class FileIsNotHiddenAssertion : .<.FileInfo> { public FileIsNotHiddenAssertion(.<.FileInfo> context) { } protected override .<.> CheckAsync(.<.FileInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotReadOnly")] public class FileIsNotReadOnlyAssertion : .<.FileInfo> { public FileIsNotReadOnlyAssertion(.<.FileInfo> context) { } protected override .<.> CheckAsync(.<.FileInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotSystem")] public class FileIsNotSystemAssertion : .<.FileInfo> { public FileIsNotSystemAssertion(.<.FileInfo> context) { } protected override .<.> CheckAsync(.<.FileInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsGreaterThan")] public class GreaterThanAssertion : . where TValue : { @@ -492,6 +517,7 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsGreaterThanOrEqualTo")] public class GreaterThanOrEqualAssertion : . where TValue : { @@ -506,6 +532,7 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("HasInnerException")] public class HasInnerExceptionAssertion : .<> { public HasInnerExceptionAssertion(.<> context) { } @@ -530,12 +557,14 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("HasNoData")] public class HasNoDataAssertion : .<> { public HasNoDataAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("HasNoInnerException")] public class HasNoInnerExceptionAssertion : .<> { public HasNoInnerExceptionAssertion(.<> context) { } @@ -549,96 +578,112 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("HasStackTrace")] public class HasStackTraceAssertion : .<> { public HasStackTraceAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsASCII")] public class IsASCIIEncodingAssertion : .<.Encoding> { public IsASCIIEncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsAlive")] public class IsAliveAssertion : .<> { public IsAliveAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } - public class IsAssignableToAssertion : . + [.("IsAssignableTo")] + public class IsAssignableToAssertion : . { public IsAssignableToAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsBigEndianUnicode")] public class IsBigEndianUnicodeEncodingAssertion : .<.Encoding> { public IsBigEndianUnicodeEncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsCancellationRequested")] public class IsCancellationRequestedAssertion : .<.CancellationToken> { public IsCancellationRequestedAssertion(.<.CancellationToken> context) { } protected override .<.> CheckAsync(.<.CancellationToken> metadata) { } protected override string GetExpectation() { } } + [.("IsClientError")] public class IsClientErrorStatusCodeAssertion : .<.HttpStatusCode> { public IsClientErrorStatusCodeAssertion(.<.HttpStatusCode> context) { } protected override .<.> CheckAsync(.<.HttpStatusCode> metadata) { } protected override string GetExpectation() { } } + [.("IsCollectible")] public class IsCollectibleAssertion : .<.Assembly> { public IsCollectibleAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsControl")] public class IsControlAssertion : . { public IsControlAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsDaylightSavingTime")] public class IsDaylightSavingTimeAssertion : .<> { public IsDaylightSavingTimeAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsDead")] public class IsDeadAssertion : .<> { public IsDeadAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsDebugBuild")] public class IsDebugBuildAssertion : .<.Assembly> { public IsDebugBuildAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsDefault")] public class IsDefaultAssertion : . { public IsDefaultAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsDigit")] public class IsDigitAssertion : . { public IsDigitAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsDynamic")] public class IsDynamicAssertion : .<.Assembly> { public IsDynamicAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsEnglish")] public class IsEnglishCultureAssertion : .<.CultureInfo> { public IsEnglishCultureAssertion(.<.CultureInfo> context) { } @@ -660,24 +705,28 @@ namespace .Conditions protected override string GetExpectation() { } public . Using(. comparer) { } } + [.("IsError")] public class IsErrorStatusCodeAssertion : .<.HttpStatusCode> { public IsErrorStatusCodeAssertion(.<.HttpStatusCode> context) { } protected override .<.> CheckAsync(.<.HttpStatusCode> metadata) { } protected override string GetExpectation() { } } + [.("IsFriday")] public class IsFridayAssertion : .<> { public IsFridayAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsFullyTrusted")] public class IsFullyTrustedAssertion : .<.Assembly> { public IsFullyTrustedAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsHighSurrogate")] public class IsHighSurrogateAssertion : . { public IsHighSurrogateAssertion(. context) { } @@ -691,132 +740,154 @@ namespace .Conditions protected override string GetExpectation() { } public . Using(. comparer) { } } + [.("IsInformational")] public class IsInformationalStatusCodeAssertion : .<.HttpStatusCode> { public IsInformationalStatusCodeAssertion(.<.HttpStatusCode> context) { } protected override .<.> CheckAsync(.<.HttpStatusCode> metadata) { } protected override string GetExpectation() { } } + [.("IsInvariant")] public class IsInvariantCultureAssertion : .<.CultureInfo> { public IsInvariantCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsLeapYear")] public class IsLeapYearAssertion : .<> { public IsLeapYearAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsLeftToRight")] public class IsLeftToRightCultureAssertion : .<.CultureInfo> { public IsLeftToRightCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsLetter")] public class IsLetterAssertion : . { public IsLetterAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsLetterOrDigit")] public class IsLetterOrDigitAssertion : . { public IsLetterOrDigitAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsLowSurrogate")] public class IsLowSurrogateAssertion : . { public IsLowSurrogateAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsLower")] public class IsLowerAssertion : . { public IsLowerAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsMonday")] public class IsMondayAssertion : .<> { public IsMondayAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsNeutralCulture")] public class IsNeutralCultureAssertion : .<.CultureInfo> { public IsNeutralCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNone")] public class IsNoneAssertion : .<.CancellationToken> { public IsNoneAssertion(.<.CancellationToken> context) { } protected override .<.> CheckAsync(.<.CancellationToken> metadata) { } protected override string GetExpectation() { } } - public class IsNotAssignableToAssertion : . + [.("IsNotAssignableTo")] + public class IsNotAssignableToAssertion : . { public IsNotAssignableToAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotCancellationRequested")] public class IsNotCancellationRequestedAssertion : .<.CancellationToken> { public IsNotCancellationRequestedAssertion(.<.CancellationToken> context) { } protected override .<.> CheckAsync(.<.CancellationToken> metadata) { } protected override string GetExpectation() { } } + [.("IsNotCollectible")] public class IsNotCollectibleAssertion : .<.Assembly> { public IsNotCollectibleAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsNotControl")] public class IsNotControlAssertion : . { public IsNotControlAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotDaylightSavingTime")] public class IsNotDaylightSavingTimeAssertion : .<> { public IsNotDaylightSavingTimeAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsNotDefault")] public class IsNotDefaultAssertion : . { public IsNotDefaultAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotDigit")] public class IsNotDigitAssertion : . { public IsNotDigitAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotDynamic")] public class IsNotDynamicAssertion : .<.Assembly> { public IsNotDynamicAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsNotEnglish")] public class IsNotEnglishCultureAssertion : .<.CultureInfo> { public IsNotEnglishCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotFullyTrusted")] public class IsNotFullyTrustedAssertion : .<.Assembly> { public IsNotFullyTrustedAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsNotHighSurrogate")] public class IsNotHighSurrogateAssertion : . { public IsNotHighSurrogateAssertion(. context) { } @@ -830,210 +901,245 @@ namespace .Conditions protected override string GetExpectation() { } public . Using(. comparer) { } } + [.("IsNotInvariant")] public class IsNotInvariantCultureAssertion : .<.CultureInfo> { public IsNotInvariantCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotLeapYear")] public class IsNotLeapYearAssertion : .<> { public IsNotLeapYearAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsNotLetter")] public class IsNotLetterAssertion : . { public IsNotLetterAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotLetterOrDigit")] public class IsNotLetterOrDigitAssertion : . { public IsNotLetterOrDigitAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotLowSurrogate")] public class IsNotLowSurrogateAssertion : . { public IsNotLowSurrogateAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotLower")] public class IsNotLowerAssertion : . { public IsNotLowerAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotNeutralCulture")] public class IsNotNeutralCultureAssertion : .<.CultureInfo> { public IsNotNeutralCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsNotNone")] public class IsNotNoneAssertion : .<.CancellationToken> { public IsNotNoneAssertion(.<.CancellationToken> context) { } protected override .<.> CheckAsync(.<.CancellationToken> metadata) { } protected override string GetExpectation() { } } + [.("IsNotNumber")] public class IsNotNumberAssertion : . { public IsNotNumberAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotPunctuation")] public class IsNotPunctuationAssertion : . { public IsNotPunctuationAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotSeparator")] public class IsNotSeparatorAssertion : . { public IsNotSeparatorAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotSigned")] public class IsNotSignedAssertion : .<.Assembly> { public IsNotSignedAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsNotSingleByte")] public class IsNotSingleByteEncodingAssertion : .<.Encoding> { public IsNotSingleByteEncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsNotSuccess")] public class IsNotSuccessStatusCodeAssertion : .<.HttpStatusCode> { public IsNotSuccessStatusCodeAssertion(.<.HttpStatusCode> context) { } protected override .<.> CheckAsync(.<.HttpStatusCode> metadata) { } protected override string GetExpectation() { } } + [.("IsNotSurrogate")] public class IsNotSurrogateAssertion : . { public IsNotSurrogateAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotSymbol")] public class IsNotSymbolAssertion : . { public IsNotSymbolAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotToday")] public class IsNotTodayAssertion : .<> { public IsNotTodayAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsNotUTF8")] public class IsNotUTF8EncodingAssertion : .<.Encoding> { public IsNotUTF8EncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsNotUpper")] public class IsNotUpperAssertion : . { public IsNotUpperAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotUtc")] public class IsNotUtcAssertion : .<> { public IsNotUtcAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsNotWhiteSpace")] public class IsNotWhiteSpaceAssertion : . { public IsNotWhiteSpaceAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNumber")] public class IsNumberAssertion : . { public IsNumberAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsPunctuation")] public class IsPunctuationAssertion : . { public IsPunctuationAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsReadOnly")] public class IsReadOnlyCultureAssertion : .<.CultureInfo> { public IsReadOnlyCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsRedirection")] public class IsRedirectionStatusCodeAssertion : .<.HttpStatusCode> { public IsRedirectionStatusCodeAssertion(.<.HttpStatusCode> context) { } protected override .<.> CheckAsync(.<.HttpStatusCode> metadata) { } protected override string GetExpectation() { } } + [.("IsReleaseBuild")] public class IsReleaseBuildAssertion : .<.Assembly> { public IsReleaseBuildAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsRightToLeft")] public class IsRightToLeftCultureAssertion : .<.CultureInfo> { public IsRightToLeftCultureAssertion(.<.CultureInfo> context) { } protected override .<.> CheckAsync(.<.CultureInfo> metadata) { } protected override string GetExpectation() { } } + [.("IsSeparator")] public class IsSeparatorAssertion : . { public IsSeparatorAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsServerError")] public class IsServerErrorStatusCodeAssertion : .<.HttpStatusCode> { public IsServerErrorStatusCodeAssertion(.<.HttpStatusCode> context) { } protected override .<.> CheckAsync(.<.HttpStatusCode> metadata) { } protected override string GetExpectation() { } } + [.("IsSigned")] public class IsSignedAssertion : .<.Assembly> { public IsSignedAssertion(.<.Assembly> context) { } protected override .<.> CheckAsync(.<.Assembly> metadata) { } protected override string GetExpectation() { } } + [.("IsSingleByte")] public class IsSingleByteEncodingAssertion : .<.Encoding> { public IsSingleByteEncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsSuccess")] public class IsSuccessStatusCodeAssertion : .<.HttpStatusCode> { public IsSuccessStatusCodeAssertion(.<.HttpStatusCode> context) { } protected override .<.> CheckAsync(.<.HttpStatusCode> metadata) { } protected override string GetExpectation() { } } + [.("IsSurrogate")] public class IsSurrogateAssertion : . { public IsSurrogateAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsSymbol")] public class IsSymbolAssertion : . { public IsSymbolAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsToday")] public class IsTodayAssertion : .<> { public IsTodayAssertion(.<> context) { } @@ -1046,54 +1152,63 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsUTF32")] public class IsUTF32EncodingAssertion : .<.Encoding> { public IsUTF32EncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsUTF8")] public class IsUTF8EncodingAssertion : .<.Encoding> { public IsUTF8EncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsUnicode")] public class IsUnicodeEncodingAssertion : .<.Encoding> { public IsUnicodeEncodingAssertion(.<.Encoding> context) { } protected override .<.> CheckAsync(.<.Encoding> metadata) { } protected override string GetExpectation() { } } + [.("IsUpper")] public class IsUpperAssertion : . { public IsUpperAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsUtc")] public class IsUtcAssertion : .<> { public IsUtcAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsWeekday")] public class IsWeekdayAssertion : .<> { public IsWeekdayAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsWeekend")] public class IsWeekendAssertion : .<> { public IsWeekendAssertion(.<> context) { } protected override .<.> CheckAsync(.<> metadata) { } protected override string GetExpectation() { } } + [.("IsWhiteSpace")] public class IsWhiteSpaceAssertion : . { public IsWhiteSpaceAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsLessThan")] public class LessThanAssertion : . where TValue : { @@ -1101,6 +1216,7 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsLessThanOrEqualTo")] public class LessThanOrEqualAssertion : . where TValue : { @@ -1127,6 +1243,7 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotEqualTo")] public class NotEqualsAssertion : . { public NotEqualsAssertion(. context, TValue notExpected, .? comparer = null) { } @@ -1143,6 +1260,7 @@ namespace .Conditions protected override string GetExpectation() { } public . Using(. comparer) { } } + [.("IsNotNull")] public class NotNullAssertion : . { public NotNullAssertion(. context) { } @@ -1165,6 +1283,7 @@ namespace .Conditions public . IgnoringType() { } public . WithPartialEquivalency() { } } + [.("IsNull")] public class NullAssertion : . { public NullAssertion(. context) { } @@ -1183,24 +1302,28 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("HasExcessCapacity")] public class StringBuilderHasExcessCapacityAssertion : .<.StringBuilder> { public StringBuilderHasExcessCapacityAssertion(.<.StringBuilder> context) { } protected override .<.> CheckAsync(.<.StringBuilder> metadata) { } protected override string GetExpectation() { } } + [.("IsEmpty")] public class StringBuilderIsEmptyAssertion : .<.StringBuilder> { public StringBuilderIsEmptyAssertion(.<.StringBuilder> context) { } protected override .<.> CheckAsync(.<.StringBuilder> metadata) { } protected override string GetExpectation() { } } + [.("IsNotEmpty")] public class StringBuilderIsNotEmptyAssertion : .<.StringBuilder> { public StringBuilderIsNotEmptyAssertion(.<.StringBuilder> context) { } protected override .<.> CheckAsync(.<.StringBuilder> metadata) { } protected override string GetExpectation() { } } + [.("Contains")] public class StringContainsAssertion : . { public StringContainsAssertion(. context, string expected) { } @@ -1211,6 +1334,7 @@ namespace .Conditions public . WithComparison( comparison) { } public . WithTrimming() { } } + [.("DoesNotContain")] public class StringDoesNotContainAssertion : . { public StringDoesNotContainAssertion(. context, string expected) { } @@ -1219,6 +1343,7 @@ namespace .Conditions public . IgnoringCase() { } public . WithComparison( comparison) { } } + [.("DoesNotMatch")] public class StringDoesNotMatchAssertion : . { public StringDoesNotMatchAssertion(. context, . regex) { } @@ -1228,6 +1353,7 @@ namespace .Conditions public . IgnoringCase() { } public . WithOptions(. options) { } } + [.("EndsWith")] public class StringEndsWithAssertion : . { public StringEndsWithAssertion(. context, string expected) { } @@ -1247,30 +1373,35 @@ namespace .Conditions public . WithNullAndEmptyEquality() { } public . WithTrimming() { } } + [.("IsEmpty")] public class StringIsEmptyAssertion : . { public StringIsEmptyAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotEmpty")] public class StringIsNotEmptyAssertion : . { public StringIsNotEmptyAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNotNullOrEmpty")] public class StringIsNotNullOrEmptyAssertion : . { public StringIsNotNullOrEmptyAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNullOrEmpty")] public class StringIsNullOrEmptyAssertion : . { public StringIsNullOrEmptyAssertion(. context) { } protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsNullOrWhitespace")] public class StringIsNullOrWhitespaceAssertion : . { public StringIsNullOrWhitespaceAssertion(. context) { } @@ -1283,6 +1414,7 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("Matches")] public class StringMatchesAssertion : . { public StringMatchesAssertion(. context, . regex) { } @@ -1292,6 +1424,7 @@ namespace .Conditions public . IgnoringCase() { } public . WithOptions(. options) { } } + [.("StartsWith")] public class StringStartsWithAssertion : . { public StringStartsWithAssertion(. context, string expected) { } @@ -1331,6 +1464,7 @@ namespace .Conditions protected override .<.> CheckAsync(. metadata) { } protected override string GetExpectation() { } } + [.("IsTrue")] public class TrueAssertion : . { public TrueAssertion(. context) { } @@ -1477,19 +1611,6 @@ namespace .Exceptions } namespace .Extensions { - public static class AssemblyAssertionExtensions - { - public static . IsCollectible(this .<.Assembly> source) { } - public static . IsDebugBuild(this .<.Assembly> source) { } - public static . IsDynamic(this .<.Assembly> source) { } - public static . IsFullyTrusted(this .<.Assembly> source) { } - public static . IsNotCollectible(this .<.Assembly> source) { } - public static . IsNotDynamic(this .<.Assembly> source) { } - public static . IsNotFullyTrusted(this .<.Assembly> source) { } - public static . IsNotSigned(this .<.Assembly> source) { } - public static . IsReleaseBuild(this .<.Assembly> source) { } - public static . IsSigned(this .<.Assembly> source) { } - } public static class AssertionExtensions { public static .<., TItem> All(this .<.> source) { } @@ -1502,7 +1623,6 @@ namespace .Extensions where TCollection : . { } public static . CompletesWithin(this . source, timeout, [.("timeout")] string? expression = null) { } public static . CompletesWithin(this . source, timeout, [.("timeout")] string? expression = null) { } - public static . Contains(this . source, string expected, [.("expected")] string? expression = null) { } public static .<., TItem> Contains(this .<.> source, predicate, [.("predicate")] string? expression = null) { } public static .<., TItem> Contains(this .<.> source, TItem expected, [.("expected")] string? expression = null) { } public static . Contains(this . source, TItem expected, [.("expected")] string? expression = null) @@ -1522,7 +1642,6 @@ namespace .Extensions public static .<., TItem> ContainsOnly(this .<.> source, predicate, [.("predicate")] string? expression = null) { } public static . ContainsOnly(this . source, predicate, [.("predicate")] string? expression = null) where TCollection : . { } - public static . DoesNotContain(this . source, string expected, [.("expected")] string? expression = null) { } public static .<., TItem> DoesNotContain(this .<.> source, predicate, [.("predicate")] string? expression = null) { } public static .<., TItem> DoesNotContain(this .<.> source, TItem expected, [.("expected")] string? expression = null) { } public static . DoesNotContain(this . source, predicate, [.("predicate")] string? expression = null) @@ -1538,9 +1657,6 @@ namespace .Extensions where TEnum : struct, { } public static ..DoesNotHaveSameValueAsAssertion DoesNotHaveSameValueAs(this . source, otherEnumValue, [.("otherEnumValue")] string? expression = null) where TEnum : struct, { } - public static . DoesNotMatch(this . source, . regex, [.("regex")] string? expression = null) { } - public static . DoesNotMatch(this . source, string pattern, [.("pattern")] string? expression = null) { } - public static . EndsWith(this . source, string expected, [.("expected")] string? expression = null) { } public static . EqualTo(this . source, TValue expected, [.("expected")] string? expression = null) { } public static ..CountWrapper HasCount(this . source) where TValue : .IEnumerable { } @@ -1551,6 +1667,7 @@ namespace .Extensions public static ..HasFlagAssertion HasFlag(this . source, TEnum expectedFlag, [.("expectedFlag")] string? expression = null) where TEnum : struct, { } public static ..LengthWrapper HasLength(this . source) { } + public static ..LengthWrapper HasLength(this . source) { } public static . HasLength(this . source, int expectedLength, [.("expectedLength")] string? expression = null) { } public static . HasMember(this . source, .<> memberSelector) { } public static . HasMessageContaining(this . source, string expectedSubstring) { } @@ -1578,14 +1695,10 @@ namespace .Extensions public static . HasSingleItem(this . source) where TValue : .IEnumerable { } public static .<> IsAfterOrEqualTo(this .<> source, expected, [.("expected")] string? expression = null) { } - public static . IsAssignableTo(this . source) { } - public static . IsAssignableTo(this . source) { } - public static . IsBetween(this . source, TValue minimum, TValue maximum, [.("minimum")] string? minExpr = null, [.("maximum")] string? maxExpr = null) - where TValue : { } - public static . IsDefault(this . source) { } + public static . IsAssignableTo(this . source) { } + public static . IsAssignableTo(this . source) { } public static ..IsDefinedAssertion IsDefined(this . source) where TEnum : struct, { } - public static . IsEmpty(this . source) { } public static . IsEmpty(this . source) where TValue : .IEnumerable { } public static . IsEqualTo(this .<> source, expected, [.("expected")] string? expression = null) { } @@ -1599,7 +1712,6 @@ namespace .Extensions public static . IsEqualTo(this . source, TValue expected, [.("expected")] string? expression = null) { } public static . IsEqualTo(this . source, TValue expected, [.("expected")] string? expression = null) { } public static . IsEqualTo(this . source, TValue expected, [.("expected")] string? expression = null) { } - public static . IsEqualTo(this . source, TValue expected, . comparer, [.("expected")] string? expression = null) { } public static . IsEquatableOrEqualTo(this . source, TValue expected, [.("expected")] string? expression = null) { } public static . IsEquivalentTo(this . source, object? expected, [.("expected")] string? expression = null) { } public static . IsEquivalentTo(this . source, . expected, [.("expected")] string? expression = null) @@ -1609,12 +1721,7 @@ namespace .Extensions public static . IsEquivalentTo(this . source, . expected, . ordering, [.("expected")] string? expression = null) where TCollection : . { } public static . IsFalse(this . source) { } - public static . IsFalse(this . source) { } public static . IsFalse(this . source) { } - public static . IsGreaterThan(this . source, TValue minimum, [.("minimum")] string? expression = null) - where TValue : { } - public static . IsGreaterThanOrEqualTo(this . source, TValue minimum, [.("minimum")] string? expression = null) - where TValue : { } public static . IsIn(this . source, params TValue[] collection) { } public static . IsIn(this . source, . collection, [.("collection")] string? expression = null) { } public static .<., TItem> IsInDescendingOrder(this .<.> source) @@ -1627,24 +1734,16 @@ namespace .Extensions public static . IsInOrder(this . source) where TCollection : . where TItem : { } - public static . IsLessThan(this . source, TValue maximum, [.("maximum")] string? expression = null) - where TValue : { } - public static . IsLessThanOrEqualTo(this . source, TValue maximum, [.("maximum")] string? expression = null) - where TValue : { } public static . IsNegative(this . source) where TValue : { } public static . IsNegative(this . source) where TValue : struct, { } - public static . IsNotAssignableTo(this . source) { } - public static . IsNotAssignableTo(this . source) { } - public static . IsNotDefault(this . source) { } + public static . IsNotAssignableTo(this . source) { } public static ..IsNotDefinedAssertion IsNotDefined(this . source) where TEnum : struct, { } - public static . IsNotEmpty(this . source) { } public static . IsNotEmpty(this . source) where TValue : .IEnumerable { } public static . IsNotEqualTo(this . source, TValue expected, [.("expected")] string? expression = null) { } - public static . IsNotEqualTo(this . source, TValue notExpected, [.("notExpected")] string? expression = null) { } public static . IsNotEqualTo(this . source, TValue expected, [.("expected")] string? expression = null) { } public static . IsNotEquivalentTo(this . source, object? expected, [.("expected")] string? expression = null) { } public static . IsNotEquivalentTo(this . source, . expected, [.("expected")] string? expression = null) @@ -1655,15 +1754,13 @@ namespace .Extensions where TCollection : . { } public static . IsNotIn(this . source, params TValue[] collection) { } public static . IsNotIn(this . source, . collection, [.("collection")] string? expression = null) { } - public static . IsNotNull(this . source) { } - public static . IsNotNullOrEmpty(this . source) { } public static ..IsNotParsableIntoAssertion IsNotParsableInto(this . source) { } public static . IsNotSameReferenceAs(this . source, object? expected, [.("expected")] string? expression = null) { } - public static . IsNull(this . source) { } public static . IsNullOrEmpty(this . source) { } - public static . IsNullOrEmpty(this . source) { } public static . IsNullOrEmpty(this . source) { } - public static . IsNullOrWhitespace(this . source) { } + public static . IsOfType(this . source, expectedType) { } + public static . IsOfType(this . source, expectedType) { } + public static . IsOfType(this . source, expectedType, [.("expectedType")] string? expression = null) { } public static ..IsParsableIntoAssertion IsParsableInto(this . source) { } public static . IsPositive(this . source) where TValue : { } @@ -1671,19 +1768,12 @@ namespace .Extensions where TValue : struct, { } public static . IsSameReferenceAs(this . source, object? expected, [.("expected")] string? expression = null) { } public static . IsTrue(this . source) { } - public static . IsTrue(this . source) { } public static . IsTrue(this . source) { } - public static . IsTypeOf(this . source, expectedType) { } public static . IsTypeOf(this . source) { } - public static . IsTypeOf(this . source, expectedType) { } - public static . IsTypeOf(this . source, expectedType) { } - public static . IsTypeOf(this . source) { } - public static . Matches(this . source, . regex, [.("regex")] string? expression = null) { } - public static . Matches(this . source, string pattern, [.("pattern")] string? expression = null) { } + public static . IsTypeOf(this . source) { } public static . Satisfies(this . source, predicate, [.("predicate")] string? expression = null) { } public static . Satisfies(this . source, > selector, <., .?> assertions, [.("selector")] string? selectorExpression = null) { } public static . Satisfies(this . source, selector, <., .?> assertions, [.("selector")] string? selectorExpression = null) { } - public static . StartsWith(this . source, string expected, [.("expected")] string? expression = null) { } public static . Throws(this . source) where TException : { } public static . Throws(this . source) @@ -1706,121 +1796,520 @@ namespace .Extensions public static . WithMessageContaining(this . source, string expectedSubstring) { } public static . WithMessageContaining(this . source, string expectedSubstring, comparison) { } } - public static class CancellationTokenAssertionExtensions + public static class BetweenAssertionExtensions + { + public static . IsBetween(this . source, TValue minimum, TValue maximum, [.("minimum")] string? minimumExpression = null, [.("maximum")] string? maximumExpression = null) + where TValue : { } + } + public static class CanBeCanceledAssertionExtensions { public static . CanBeCanceled(this .<.CancellationToken> source) { } + } + public static class CannotBeCanceledAssertionExtensions + { public static . CannotBeCanceled(this .<.CancellationToken> source) { } + } + public static class DateTimeEqualsExactAssertionExtensions + { + public static . EqualsExact(this .<> source, expected, [.("expected")] string? expectedExpression = null) { } + } + public static class DirectoryDoesNotExistAssertionExtensions + { + public static . DoesNotExist(this .<.DirectoryInfo> source) { } + } + public static class DirectoryExistsAssertionExtensions + { + public static . Exists(this .<.DirectoryInfo> source) { } + } + public static class DirectoryHasFilesAssertionExtensions + { + public static . HasFiles(this .<.DirectoryInfo> source) { } + } + public static class DirectoryHasNoSubdirectoriesAssertionExtensions + { + public static . HasNoSubdirectories(this .<.DirectoryInfo> source) { } + } + public static class DirectoryIsNotEmptyAssertionExtensions + { + public static . IsNotEmpty(this .<.DirectoryInfo> source) { } + } + public static class FalseAssertionExtensions + { + public static . IsFalse(this . source) { } + } + public static class FileDoesNotExistAssertionExtensions + { + public static . DoesNotExist(this .<.FileInfo> source) { } + } + public static class FileExistsAssertionExtensions + { + public static . Exists(this .<.FileInfo> source) { } + } + public static class FileIsNotEmptyAssertionExtensions + { + public static . IsNotEmpty(this .<.FileInfo> source) { } + } + public static class FileIsNotExecutableAssertionExtensions + { + public static . IsNotExecutable(this .<.FileInfo> source) { } + } + public static class FileIsNotHiddenAssertionExtensions + { + public static . IsNotHidden(this .<.FileInfo> source) { } + } + public static class FileIsNotReadOnlyAssertionExtensions + { + public static . IsNotReadOnly(this .<.FileInfo> source) { } + } + public static class FileIsNotSystemAssertionExtensions + { + public static . IsNotSystem(this .<.FileInfo> source) { } + } + public static class GreaterThanAssertionExtensions + { + public static . IsGreaterThan(this . source, TValue minimum, [.("minimum")] string? minimumExpression = null) + where TValue : { } + } + public static class GreaterThanOrEqualAssertionExtensions + { + public static . IsGreaterThanOrEqualTo(this . source, TValue minimum, [.("minimum")] string? minimumExpression = null) + where TValue : { } + } + public static class HasInnerExceptionAssertionExtensions + { + public static . HasInnerException(this .<> source) { } + } + public static class HasNoDataAssertionExtensions + { + public static . HasNoData(this .<> source) { } + } + public static class HasNoInnerExceptionAssertionExtensions + { + public static . HasNoInnerException(this .<> source) { } + } + public static class HasStackTraceAssertionExtensions + { + public static . HasStackTrace(this .<> source) { } + } + public static class IsASCIIEncodingAssertionExtensions + { + public static . IsASCII(this .<.Encoding> source) { } + } + public static class IsAliveAssertionExtensions + { + public static . IsAlive(this .<> source) { } + } + public static class IsAssignableToAssertionExtensions + { + public static . IsAssignableTo(this . source) { } + } + public static class IsBigEndianUnicodeEncodingAssertionExtensions + { + public static . IsBigEndianUnicode(this .<.Encoding> source) { } + } + public static class IsCancellationRequestedAssertionExtensions + { public static . IsCancellationRequested(this .<.CancellationToken> source) { } - public static . IsNone(this .<.CancellationToken> source) { } - public static . IsNotCancellationRequested(this .<.CancellationToken> source) { } - public static . IsNotNone(this .<.CancellationToken> source) { } } - public static class CharAssertionExtensions + public static class IsClientErrorStatusCodeAssertionExtensions + { + public static . IsClientError(this .<.HttpStatusCode> source) { } + } + public static class IsCollectibleAssertionExtensions + { + public static . IsCollectible(this .<.Assembly> source) { } + } + public static class IsControlAssertionExtensions { public static . IsControl(this . source) { } + } + public static class IsDaylightSavingTimeAssertionExtensions + { + public static . IsDaylightSavingTime(this .<> source) { } + } + public static class IsDeadAssertionExtensions + { + public static . IsDead(this .<> source) { } + } + public static class IsDebugBuildAssertionExtensions + { + public static . IsDebugBuild(this .<.Assembly> source) { } + } + public static class IsDefaultAssertionExtensions + { + public static . IsDefault(this . source) { } + } + public static class IsDigitAssertionExtensions + { public static . IsDigit(this . source) { } + } + public static class IsDynamicAssertionExtensions + { + public static . IsDynamic(this .<.Assembly> source) { } + } + public static class IsEnglishCultureAssertionExtensions + { + public static . IsEnglish(this .<.CultureInfo> source) { } + } + public static class IsErrorStatusCodeAssertionExtensions + { + public static . IsError(this .<.HttpStatusCode> source) { } + } + public static class IsFridayAssertionExtensions + { + public static . IsFriday(this .<> source) { } + } + public static class IsFullyTrustedAssertionExtensions + { + public static . IsFullyTrusted(this .<.Assembly> source) { } + } + public static class IsHighSurrogateAssertionExtensions + { public static . IsHighSurrogate(this . source) { } + } + public static class IsInformationalStatusCodeAssertionExtensions + { + public static . IsInformational(this .<.HttpStatusCode> source) { } + } + public static class IsInvariantCultureAssertionExtensions + { + public static . IsInvariant(this .<.CultureInfo> source) { } + } + public static class IsLeapYearAssertionExtensions + { + public static . IsLeapYear(this .<> source) { } + } + public static class IsLeftToRightCultureAssertionExtensions + { + public static . IsLeftToRight(this .<.CultureInfo> source) { } + } + public static class IsLetterAssertionExtensions + { public static . IsLetter(this . source) { } + } + public static class IsLetterOrDigitAssertionExtensions + { public static . IsLetterOrDigit(this . source) { } + } + public static class IsLowSurrogateAssertionExtensions + { public static . IsLowSurrogate(this . source) { } + } + public static class IsLowerAssertionExtensions + { public static . IsLower(this . source) { } + } + public static class IsMondayAssertionExtensions + { + public static . IsMonday(this .<> source) { } + } + public static class IsNeutralCultureAssertionExtensions + { + public static . IsNeutralCulture(this .<.CultureInfo> source) { } + } + public static class IsNoneAssertionExtensions + { + public static . IsNone(this .<.CancellationToken> source) { } + } + public static class IsNotAssignableToAssertionExtensions + { + public static . IsNotAssignableTo(this . source) { } + } + public static class IsNotCancellationRequestedAssertionExtensions + { + public static . IsNotCancellationRequested(this .<.CancellationToken> source) { } + } + public static class IsNotCollectibleAssertionExtensions + { + public static . IsNotCollectible(this .<.Assembly> source) { } + } + public static class IsNotControlAssertionExtensions + { public static . IsNotControl(this . source) { } + } + public static class IsNotDaylightSavingTimeAssertionExtensions + { + public static . IsNotDaylightSavingTime(this .<> source) { } + } + public static class IsNotDefaultAssertionExtensions + { + public static . IsNotDefault(this . source) { } + } + public static class IsNotDigitAssertionExtensions + { public static . IsNotDigit(this . source) { } + } + public static class IsNotDynamicAssertionExtensions + { + public static . IsNotDynamic(this .<.Assembly> source) { } + } + public static class IsNotEnglishCultureAssertionExtensions + { + public static . IsNotEnglish(this .<.CultureInfo> source) { } + } + public static class IsNotFullyTrustedAssertionExtensions + { + public static . IsNotFullyTrusted(this .<.Assembly> source) { } + } + public static class IsNotHighSurrogateAssertionExtensions + { public static . IsNotHighSurrogate(this . source) { } + } + public static class IsNotInvariantCultureAssertionExtensions + { + public static . IsNotInvariant(this .<.CultureInfo> source) { } + } + public static class IsNotLeapYearAssertionExtensions + { + public static . IsNotLeapYear(this .<> source) { } + } + public static class IsNotLetterAssertionExtensions + { public static . IsNotLetter(this . source) { } + } + public static class IsNotLetterOrDigitAssertionExtensions + { public static . IsNotLetterOrDigit(this . source) { } + } + public static class IsNotLowSurrogateAssertionExtensions + { public static . IsNotLowSurrogate(this . source) { } + } + public static class IsNotLowerAssertionExtensions + { public static . IsNotLower(this . source) { } + } + public static class IsNotNeutralCultureAssertionExtensions + { + public static . IsNotNeutralCulture(this .<.CultureInfo> source) { } + } + public static class IsNotNoneAssertionExtensions + { + public static . IsNotNone(this .<.CancellationToken> source) { } + } + public static class IsNotNumberAssertionExtensions + { public static . IsNotNumber(this . source) { } + } + public static class IsNotPunctuationAssertionExtensions + { public static . IsNotPunctuation(this . source) { } + } + public static class IsNotSeparatorAssertionExtensions + { public static . IsNotSeparator(this . source) { } + } + public static class IsNotSignedAssertionExtensions + { + public static . IsNotSigned(this .<.Assembly> source) { } + } + public static class IsNotSingleByteEncodingAssertionExtensions + { + public static . IsNotSingleByte(this .<.Encoding> source) { } + } + public static class IsNotSuccessStatusCodeAssertionExtensions + { + public static . IsNotSuccess(this .<.HttpStatusCode> source) { } + } + public static class IsNotSurrogateAssertionExtensions + { public static . IsNotSurrogate(this . source) { } + } + public static class IsNotSymbolAssertionExtensions + { public static . IsNotSymbol(this . source) { } + } + public static class IsNotTodayAssertionExtensions + { + public static . IsNotToday(this .<> source) { } + } + public static class IsNotUTF8EncodingAssertionExtensions + { + public static .8EncodingAssertion IsNotUTF8(this .<.Encoding> source) { } + } + public static class IsNotUpperAssertionExtensions + { public static . IsNotUpper(this . source) { } + } + public static class IsNotUtcAssertionExtensions + { + public static . IsNotUtc(this .<> source) { } + } + public static class IsNotWhiteSpaceAssertionExtensions + { public static . IsNotWhiteSpace(this . source) { } + } + public static class IsNumberAssertionExtensions + { public static . IsNumber(this . source) { } + } + public static class IsPunctuationAssertionExtensions + { public static . IsPunctuation(this . source) { } - public static . IsSeparator(this . source) { } - public static . IsSurrogate(this . source) { } - public static . IsSymbol(this . source) { } - public static . IsUpper(this . source) { } - public static . IsWhiteSpace(this . source) { } } - public static class CultureInfoAssertionExtensions + public static class IsReadOnlyCultureAssertionExtensions { - public static . IsEnglish(this .<.CultureInfo> source) { } - public static . IsInvariant(this .<.CultureInfo> source) { } - public static . IsLeftToRight(this .<.CultureInfo> source) { } - public static . IsNeutralCulture(this .<.CultureInfo> source) { } - public static . IsNotEnglish(this .<.CultureInfo> source) { } - public static . IsNotInvariant(this .<.CultureInfo> source) { } - public static . IsNotNeutralCulture(this .<.CultureInfo> source) { } public static . IsReadOnly(this .<.CultureInfo> source) { } + } + public static class IsRedirectionStatusCodeAssertionExtensions + { + public static . IsRedirection(this .<.HttpStatusCode> source) { } + } + public static class IsReleaseBuildAssertionExtensions + { + public static . IsReleaseBuild(this .<.Assembly> source) { } + } + public static class IsRightToLeftCultureAssertionExtensions + { public static . IsRightToLeft(this .<.CultureInfo> source) { } } - public static class DateTimeAssertionExtensions + public static class IsSeparatorAssertionExtensions { - public static . EqualsExact(this .<> source, expected, [.("expected")] string? expression = null) { } - public static . IsDaylightSavingTime(this .<> source) { } - public static . IsLeapYear(this .<> source) { } - public static . IsNotDaylightSavingTime(this .<> source) { } - public static . IsNotLeapYear(this .<> source) { } - public static . IsNotToday(this .<> source) { } - public static . IsNotUtc(this .<> source) { } - public static . IsToday(this .<> source) { } - public static . IsUtc(this .<> source) { } + public static . IsSeparator(this . source) { } } - public static class EncodingAssertionExtensions + public static class IsServerErrorStatusCodeAssertionExtensions + { + public static . IsServerError(this .<.HttpStatusCode> source) { } + } + public static class IsSignedAssertionExtensions + { + public static . IsSigned(this .<.Assembly> source) { } + } + public static class IsSingleByteEncodingAssertionExtensions { - public static . IsASCII(this .<.Encoding> source) { } - public static . IsBigEndianUnicode(this .<.Encoding> source) { } - public static . IsNotSingleByte(this .<.Encoding> source) { } - public static .8EncodingAssertion IsNotUTF8(this .<.Encoding> source) { } public static . IsSingleByte(this .<.Encoding> source) { } + } + public static class IsSuccessStatusCodeAssertionExtensions + { + public static . IsSuccess(this .<.HttpStatusCode> source) { } + } + public static class IsSurrogateAssertionExtensions + { + public static . IsSurrogate(this . source) { } + } + public static class IsSymbolAssertionExtensions + { + public static . IsSymbol(this . source) { } + } + public static class IsTodayAssertionExtensions + { + public static . IsToday(this .<> source) { } + } + public static class IsUTF32EncodingAssertionExtensions + { public static .32EncodingAssertion IsUTF32(this .<.Encoding> source) { } + } + public static class IsUTF8EncodingAssertionExtensions + { public static .8EncodingAssertion IsUTF8(this .<.Encoding> source) { } + } + public static class IsUnicodeEncodingAssertionExtensions + { public static . IsUnicode(this .<.Encoding> source) { } } - public static class FileSystemAssertionExtensions + public static class IsUpperAssertionExtensions { - public static . DoesNotExist(this .<.DirectoryInfo> source) { } - public static . DoesNotExist(this .<.FileInfo> source) { } - public static . Exists(this .<.DirectoryInfo> source) { } - public static . Exists(this .<.FileInfo> source) { } - public static . HasFiles(this .<.DirectoryInfo> source) { } - public static . HasNoSubdirectories(this .<.DirectoryInfo> source) { } - public static . IsNotEmpty(this .<.DirectoryInfo> source) { } - public static . IsNotEmpty(this .<.FileInfo> source) { } - public static . IsNotExecutable(this .<.FileInfo> source) { } - public static . IsNotHidden(this .<.FileInfo> source) { } - public static . IsNotReadOnly(this .<.FileInfo> source) { } - public static . IsNotSystem(this .<.FileInfo> source) { } + public static . IsUpper(this . source) { } } - public static class HttpStatusCodeAssertionExtensions + public static class IsUtcAssertionExtensions { - public static . IsClientError(this .<.HttpStatusCode> source) { } - public static . IsError(this .<.HttpStatusCode> source) { } - public static . IsInformational(this .<.HttpStatusCode> source) { } - public static . IsNotSuccess(this .<.HttpStatusCode> source) { } - public static . IsRedirection(this .<.HttpStatusCode> source) { } - public static . IsServerError(this .<.HttpStatusCode> source) { } - public static . IsSuccess(this .<.HttpStatusCode> source) { } + public static . IsUtc(this .<> source) { } + } + public static class IsWeekdayAssertionExtensions + { + public static . IsWeekday(this .<> source) { } + } + public static class IsWeekendAssertionExtensions + { + public static . IsWeekend(this .<> source) { } + } + public static class IsWhiteSpaceAssertionExtensions + { + public static . IsWhiteSpace(this . source) { } + } + public static class LessThanAssertionExtensions + { + public static . IsLessThan(this . source, TValue maximum, [.("maximum")] string? maximumExpression = null) + where TValue : { } + } + public static class LessThanOrEqualAssertionExtensions + { + public static . IsLessThanOrEqualTo(this . source, TValue maximum, [.("maximum")] string? maximumExpression = null) + where TValue : { } + } + public static class NotEqualsAssertionExtensions + { + public static . IsNotEqualTo(this . source, TValue notExpected, .? comparer = null, [.("notExpected")] string? notExpectedExpression = null, [.("comparer")] string? comparerExpression = null) { } + } + public static class NotNullAssertionExtensions + { + public static . IsNotNull(this . source) { } + } + public static class NullAssertionExtensions + { + public static . IsNull(this . source) { } } - public static class MiscellaneousAssertionExtensions + public static class StringBuilderHasExcessCapacityAssertionExtensions { public static . HasExcessCapacity(this .<.StringBuilder> source) { } - public static . HasInnerException(this .<> source) { } - public static . HasNoData(this .<> source) { } - public static . HasNoInnerException(this .<> source) { } - public static . HasStackTrace(this .<> source) { } - public static . IsAlive(this .<> source) { } - public static . IsDead(this .<> source) { } + } + public static class StringBuilderIsEmptyAssertionExtensions + { public static . IsEmpty(this .<.StringBuilder> source) { } - public static . IsFriday(this .<> source) { } - public static . IsMonday(this .<> source) { } + } + public static class StringBuilderIsNotEmptyAssertionExtensions + { public static . IsNotEmpty(this .<.StringBuilder> source) { } - public static . IsWeekday(this .<> source) { } - public static . IsWeekend(this .<> source) { } + } + public static class StringContainsAssertionExtensions + { + public static . Contains(this . source, string expected, [.("expected")] string? expectedExpression = null) { } + } + public static class StringDoesNotContainAssertionExtensions + { + public static . DoesNotContain(this . source, string expected, [.("expected")] string? expectedExpression = null) { } + } + public static class StringDoesNotMatchAssertionExtensions + { + public static . DoesNotMatch(this . source, . regex, [.("regex")] string? regexExpression = null) { } + public static . DoesNotMatch(this . source, string pattern, [.("pattern")] string? patternExpression = null) { } + } + public static class StringEndsWithAssertionExtensions + { + public static . EndsWith(this . source, string expected, [.("expected")] string? expectedExpression = null) { } + } + public static class StringIsEmptyAssertionExtensions + { + public static . IsEmpty(this . source) { } + } + public static class StringIsNotEmptyAssertionExtensions + { + public static . IsNotEmpty(this . source) { } + } + public static class StringIsNotNullOrEmptyAssertionExtensions + { + public static . IsNotNullOrEmpty(this . source) { } + } + public static class StringIsNullOrEmptyAssertionExtensions + { + public static . IsNullOrEmpty(this . source) { } + } + public static class StringIsNullOrWhitespaceAssertionExtensions + { + public static . IsNullOrWhitespace(this . source) { } + } + public static class StringMatchesAssertionExtensions + { + public static . Matches(this . source, . regex, [.("regex")] string? regexExpression = null) { } + public static . Matches(this . source, string pattern, [.("pattern")] string? patternExpression = null) { } + } + public static class StringStartsWithAssertionExtensions + { + public static . StartsWith(this . source, string expected, [.("expected")] string? expectedExpression = null) { } + } + public static class TrueAssertionExtensions + { + public static . IsTrue(this . source) { } } } namespace .Sources diff --git a/TUnit.TestProject/ExpectedArgumentTypeTests.cs b/TUnit.TestProject/ExpectedArgumentTypeTests.cs index 3c34065601..a663dc049b 100644 --- a/TUnit.TestProject/ExpectedArgumentTypeTests.cs +++ b/TUnit.TestProject/ExpectedArgumentTypeTests.cs @@ -20,7 +20,7 @@ public class ExpectedArgumentTypeTests [Arguments((ulong)0, typeof(ulong))] [Arguments(0UL, typeof(ulong))] public async Task TypedArguments(object value, Type expectedType) - => await Assert.That(value).IsTypeOf(expectedType); + => await Assert.That(value).IsOfType(expectedType); [Test] [Arguments(ByteEnum.Default, typeof(ByteEnum), typeof(byte))] @@ -33,7 +33,7 @@ public async Task TypedArguments(object value, Type expectedType) [Arguments(UInt64Enum.Default, typeof(UInt64Enum), typeof(ulong))] public async Task EnumTypes(object value, Type expectedValueType, Type expectedEnumUnderlyingType) { - await Assert.That(value).IsTypeOf(expectedValueType); + await Assert.That(value).IsOfType(expectedValueType); await Assert.That(Enum.IsDefined(expectedValueType, value)).IsTrue(); await Assert.That(Enum.GetUnderlyingType(expectedValueType)).IsEqualTo(expectedEnumUnderlyingType); } diff --git a/accept-snapshots.csx b/accept-snapshots.csx new file mode 100644 index 0000000000..9120689bff --- /dev/null +++ b/accept-snapshots.csx @@ -0,0 +1,15 @@ +using System.IO; + +var testDir = @"C:\git\TUnit\TUnit.Assertions.SourceGenerator.Tests"; +var receivedFiles = Directory.GetFiles(testDir, "*.received.txt"); + +Console.WriteLine($"Found {receivedFiles.Length} received files"); + +foreach (var file in receivedFiles) +{ + var verifiedFile = file.Replace(".received.txt", ".verified.txt"); + File.Move(file, verifiedFile, overwrite: true); + Console.WriteLine($"Moved: {Path.GetFileName(file)} -> {Path.GetFileName(verifiedFile)}"); +} + +Console.WriteLine("Done!");