Table of Contents

Method StartsWith

Namespace
Xunit
Assembly
xunit.v3.assert.dll

StartsWith(string?, string?)

Verifies that a string starts with a given string, using the current culture.

public static void StartsWith(string? expectedStartString, string? actualString)

Parameters

expectedStartString string

The string expected to be at the start of the string

actualString string

The string to be inspected

Exceptions

Thrown when the string does not start with the expected sub-string

StartsWith(string?, string?, StringComparison)

Verifies that a string starts with a given sub-string, using the given comparison type.

public static void StartsWith(string? expectedStartString, string? actualString, StringComparison comparisonType)

Parameters

expectedStartString string

The sub-string expected to be at the start of the string

actualString string

The string to be inspected

comparisonType StringComparison

The type of string comparison to perform

Exceptions

Thrown when the string does not start with the expected sub-string

StartsWith(Memory<char>, Memory<char>)

Verifies that a string starts with a given sub-string, using the current culture.

public static void StartsWith(Memory<char> expectedStartString, Memory<char> actualString)

Parameters

expectedStartString Memory<char>

The sub-string expected to be at the start of the string

actualString Memory<char>

The string to be inspected

Exceptions

Thrown when the string does not start with the expected sub-string

StartsWith(Memory<char>, ReadOnlyMemory<char>)

Verifies that a string starts with a given sub-string, using the current culture.

public static void StartsWith(Memory<char> expectedStartString, ReadOnlyMemory<char> actualString)

Parameters

expectedStartString Memory<char>

The sub-string expected to be at the start of the string

actualString ReadOnlyMemory<char>

The string to be inspected

Exceptions

Thrown when the string does not start with the expected sub-string

StartsWith(ReadOnlyMemory<char>, Memory<char>)

Verifies that a string starts with a given sub-string, using the current culture.

public static void StartsWith(ReadOnlyMemory<char> expectedStartString, Memory<char> actualString)

Parameters

expectedStartString ReadOnlyMemory<char>

The sub-string expected to be at the start of the string

actualString Memory<char>

The string to be inspected

Exceptions

Thrown when the string does not start with the expected sub-string

StartsWith(ReadOnlyMemory<char>, ReadOnlyMemory<char>)

Verifies that a string starts with a given sub-string, using the default StringComparison.CurrentCulture comparison type.

public static void StartsWith(ReadOnlyMemory<char> expectedStartString, ReadOnlyMemory<char> actualString)

Parameters

expectedStartString ReadOnlyMemory<char>

The sub-string expected to be at the start of the string

actualString ReadOnlyMemory<char>

The string to be inspected

Exceptions

Thrown when the string does not start with the expected sub-string

StartsWith(Memory<char>, Memory<char>, StringComparison)

Verifies that a string starts with a given sub-string, using the given comparison type.

public static void StartsWith(Memory<char> expectedStartString, Memory<char> actualString, StringComparison comparisonType = StringComparison.CurrentCulture)

Parameters

expectedStartString Memory<char>

The sub-string expected to be at the start of the string

actualString Memory<char>

The string to be inspected

comparisonType StringComparison

The type of string comparison to perform

Exceptions

Thrown when the string does not start with the expected sub-string

StartsWith(Memory<char>, ReadOnlyMemory<char>, StringComparison)

Verifies that a string starts with a given sub-string, using the given comparison type.

public static void StartsWith(Memory<char> expectedStartString, ReadOnlyMemory<char> actualString, StringComparison comparisonType = StringComparison.CurrentCulture)

Parameters

expectedStartString Memory<char>

The sub-string expected to be at the start of the string

actualString ReadOnlyMemory<char>

The string to be inspected

comparisonType StringComparison

The type of string comparison to perform

Exceptions

Thrown when the string does not start with the expected sub-string

StartsWith(ReadOnlyMemory<char>, Memory<char>, StringComparison)

Verifies that a string starts with a given sub-string, using the given comparison type.

public static void StartsWith(ReadOnlyMemory<char> expectedStartString, Memory<char> actualString, StringComparison comparisonType = StringComparison.CurrentCulture)

Parameters

expectedStartString ReadOnlyMemory<char>

The sub-string expected to be at the start of the string

actualString Memory<char>

The string to be inspected

comparisonType StringComparison

The type of string comparison to perform

Exceptions

Thrown when the string does not start with the expected sub-string

StartsWith(ReadOnlyMemory<char>, ReadOnlyMemory<char>, StringComparison)

Verifies that a string starts with a given sub-string, using the given comparison type.

public static void StartsWith(ReadOnlyMemory<char> expectedStartString, ReadOnlyMemory<char> actualString, StringComparison comparisonType = StringComparison.CurrentCulture)

Parameters

expectedStartString ReadOnlyMemory<char>

The sub-string expected to be at the start of the string

actualString ReadOnlyMemory<char>

The string to be inspected

comparisonType StringComparison

The type of string comparison to perform

Exceptions

Thrown when the string does not start with the expected sub-string

StartsWith(Span<char>, Span<char>)

Verifies that a string starts with a given sub-string, using the current culture.

public static void StartsWith(Span<char> expectedStartString, Span<char> actualString)

Parameters

expectedStartString Span<char>

The sub-string expected to be at the start of the string

actualString Span<char>

The string to be inspected

Exceptions

Thrown when the string does not start with the expected sub-string

StartsWith(Span<char>, ReadOnlySpan<char>)

Verifies that a string starts with a given sub-string, using the current culture.

public static void StartsWith(Span<char> expectedStartString, ReadOnlySpan<char> actualString)

Parameters

expectedStartString Span<char>

The sub-string expected to be at the start of the string

actualString ReadOnlySpan<char>

The string to be inspected

Exceptions

Thrown when the string does not start with the expected sub-string

StartsWith(ReadOnlySpan<char>, Span<char>)

Verifies that a string starts with a given sub-string, using the current culture.

public static void StartsWith(ReadOnlySpan<char> expectedStartString, Span<char> actualString)

Parameters

expectedStartString ReadOnlySpan<char>

The sub-string expected to be at the start of the string

actualString Span<char>

The string to be inspected

Exceptions

Thrown when the string does not start with the expected sub-string

StartsWith(ReadOnlySpan<char>, ReadOnlySpan<char>)

Verifies that a string starts with a given sub-string, using the current culture.

public static void StartsWith(ReadOnlySpan<char> expectedStartString, ReadOnlySpan<char> actualString)

Parameters

expectedStartString ReadOnlySpan<char>

The sub-string expected to be at the start of the string

actualString ReadOnlySpan<char>

The string to be inspected

Exceptions

Thrown when the string does not start with the expected sub-string

StartsWith(Span<char>, Span<char>, StringComparison)

Verifies that a string starts with a given sub-string, using the given comparison type.

public static void StartsWith(Span<char> expectedStartString, Span<char> actualString, StringComparison comparisonType = StringComparison.CurrentCulture)

Parameters

expectedStartString Span<char>

The sub-string expected to be at the start of the string

actualString Span<char>

The string to be inspected

comparisonType StringComparison

The type of string comparison to perform

Exceptions

Thrown when the string does not start with the expected sub-string

StartsWith(Span<char>, ReadOnlySpan<char>, StringComparison)

Verifies that a string starts with a given sub-string, using the given comparison type.

public static void StartsWith(Span<char> expectedStartString, ReadOnlySpan<char> actualString, StringComparison comparisonType = StringComparison.CurrentCulture)

Parameters

expectedStartString Span<char>

The sub-string expected to be at the start of the string

actualString ReadOnlySpan<char>

The string to be inspected

comparisonType StringComparison

The type of string comparison to perform

Exceptions

Thrown when the string does not start with the expected sub-string

StartsWith(ReadOnlySpan<char>, Span<char>, StringComparison)

Verifies that a string starts with a given sub-string, using the given comparison type.

public static void StartsWith(ReadOnlySpan<char> expectedStartString, Span<char> actualString, StringComparison comparisonType = StringComparison.CurrentCulture)

Parameters

expectedStartString ReadOnlySpan<char>

The sub-string expected to be at the start of the string

actualString Span<char>

The string to be inspected

comparisonType StringComparison

The type of string comparison to perform

Exceptions

Thrown when the string does not start with the expected sub-string

StartsWith(ReadOnlySpan<char>, ReadOnlySpan<char>, StringComparison)

Verifies that a string starts with a given sub-string, using the given comparison type.

public static void StartsWith(ReadOnlySpan<char> expectedStartString, ReadOnlySpan<char> actualString, StringComparison comparisonType = StringComparison.CurrentCulture)

Parameters

expectedStartString ReadOnlySpan<char>

The sub-string expected to be at the start of the string

actualString ReadOnlySpan<char>

The string to be inspected

comparisonType StringComparison

The type of string comparison to perform

Exceptions

Thrown when the string does not start with the expected sub-string