Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public InitializationState(ITestFrameworkAdapter testFramework)
public void Throw(string message) => _testFramework.Throw(message);
}

private class FallbackTestFramework : ITestFrameworkAdapter
private sealed class FallbackTestFramework : ITestFrameworkAdapter
{
#region ITestFrameworkAdapter Members

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public ExpectationResult ApplyTo<TExpectation>(TExpectation actual)

public static object? GetPropertyValue(object? obj, string propertyPath)
{
if (propertyPath.IndexOf(".", StringComparison.Ordinal) < 0)
if (propertyPath.IndexOf('.', StringComparison.Ordinal) < 0)
{
Type? objType = obj?.GetType();
return objType?.GetProperty(propertyPath)?.GetValue(obj, null);
Expand Down
16 changes: 8 additions & 8 deletions Source/Testably.Expectations/Core/ShouldVerb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public abstract class ShouldVerb
{
private readonly IExpectationBuilderStart _expectationBuilder;

internal ShouldVerb(IExpectationBuilderStart expectationBuilder)
private protected ShouldVerb(IExpectationBuilderStart expectationBuilder)
{
_expectationBuilder = expectationBuilder;
}
Expand Down Expand Up @@ -40,17 +40,17 @@ public ExpectationWhichShould<T1, T2> WithExpectation<T1, T2>(

#pragma warning disable CS0809
/// <inheritdoc />
[Obsolete]
[Obsolete("Equals is not part of Testably.Expectations.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object? obj)
=> throw new NotSupportedException(
"Equals is not part of Testably.Expectations.");
// ReSharper disable once BaseObjectEqualsIsObjectEquals
=> base.Equals(obj);

/// <inheritdoc />
[Obsolete]
[Obsolete("Equals is not part of Testably.Expectations.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public override int GetHashCode()
=> throw new NotSupportedException(
"Equals is not part of Testably.Expectations.");
#pragma warning restore CS0809
// ReSharper disable once BaseObjectGetHashCodeCallInGetHashCode
=> base.GetHashCode();
#pragma warning restore CS0809
}
28 changes: 28 additions & 0 deletions Source/Testably.Expectations/Polyfills/StringExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#if NETSTANDARD2_0
using System;
using System.Diagnostics.CodeAnalysis;

namespace Testably.Expectations.Polyfills;

/// <summary>
/// Provides extension methods to simplify writing platform independent tests.
/// </summary>
[ExcludeFromCodeCoverage]
internal static class StringExtensionMethods
{
/// <summary>
/// Reports the zero-based index of the first occurrence of the specified Unicode character in this string. A parameter
/// specifies the type of search to use for the specified character.
/// </summary>
/// <returns>
/// The zero-based index of <paramref name="value" /> if that character is found, or <c>-1</c> if it is not.
/// </returns>
internal static int IndexOf(
this string @this,
char value,
StringComparison comparisonType)
{
return @this.IndexOf($"{value}", comparisonType);
}
}
#endif
3 changes: 3 additions & 0 deletions Source/Testably.Expectations/Usings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#if NETSTANDARD2_0 || NETSTANDARD2_1
global using Testably.Expectations.Polyfills;
#endif