StringAssert
Basic Asserts on strings.
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace NUnit.Framework.Legacy
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
public abstract class StringAssert : AssertBase
{
[System.Runtime.CompilerServices.NullableContext(2)]
[EditorBrowsable(EditorBrowsableState.Never)]
public new static bool Equals(object a, object b)
{
throw new InvalidOperationException("StringAssert.Equals should not be used. Use StringAssert.AreEqualIgnoringCase or Assert.AreEqual instead.");
}
[System.Runtime.CompilerServices.NullableContext(2)]
[EditorBrowsable(EditorBrowsableState.Never)]
public new static void ReferenceEquals(object a, object b)
{
throw new InvalidOperationException("StringAssert.ReferenceEquals should not be used.");
}
public static void Contains(string expected, string actual, string message, [System.Runtime.CompilerServices.Nullable(2)] params object[] args)
{
Assert.That(actual, Does.Contain(expected), () => AssertBase.ConvertMessageWithArgs(message, args), "actual", "Does.Contain(expected)");
}
public static void Contains(string expected, string actual)
{
Contains(expected, actual, string.Empty, null);
}
public static void DoesNotContain(string expected, string actual, string message, [System.Runtime.CompilerServices.Nullable(2)] params object[] args)
{
Assert.That(actual, Does.Not.Contain(expected), () => AssertBase.ConvertMessageWithArgs(message, args), "actual", "Does.Not.Contain(expected)");
}
public static void DoesNotContain(string expected, string actual)
{
DoesNotContain(expected, actual, string.Empty, null);
}
public static void StartsWith(string expected, string actual, string message, [System.Runtime.CompilerServices.Nullable(2)] params object[] args)
{
Assert.That(actual, Does.StartWith(expected), () => AssertBase.ConvertMessageWithArgs(message, args), "actual", "Does.StartWith(expected)");
}
public static void StartsWith(string expected, string actual)
{
StartsWith(expected, actual, string.Empty, null);
}
public static void DoesNotStartWith(string expected, string actual, string message, [System.Runtime.CompilerServices.Nullable(2)] params object[] args)
{
Assert.That(actual, Does.Not.StartWith(expected), () => AssertBase.ConvertMessageWithArgs(message, args), "actual", "Does.Not.StartWith(expected)");
}
public static void DoesNotStartWith(string expected, string actual)
{
DoesNotStartWith(expected, actual, string.Empty, null);
}
public static void EndsWith(string expected, string actual, string message, [System.Runtime.CompilerServices.Nullable(2)] params object[] args)
{
Assert.That(actual, Does.EndWith(expected), () => AssertBase.ConvertMessageWithArgs(message, args), "actual", "Does.EndWith(expected)");
}
public static void EndsWith(string expected, string actual)
{
EndsWith(expected, actual, string.Empty, null);
}
public static void DoesNotEndWith(string expected, string actual, string message, [System.Runtime.CompilerServices.Nullable(2)] params object[] args)
{
Assert.That(actual, Does.Not.EndWith(expected), () => AssertBase.ConvertMessageWithArgs(message, args), "actual", "Does.Not.EndWith(expected)");
}
public static void DoesNotEndWith(string expected, string actual)
{
DoesNotEndWith(expected, actual, string.Empty, null);
}
public static void AreEqualIgnoringCase(string expected, string actual, string message, [System.Runtime.CompilerServices.Nullable(2)] params object[] args)
{
Assert.That(actual, Is.EqualTo(expected).IgnoreCase, () => AssertBase.ConvertMessageWithArgs(message, args), "actual", "Is.EqualTo(expected).IgnoreCase");
}
public static void AreEqualIgnoringCase(string expected, string actual)
{
AreEqualIgnoringCase(expected, actual, string.Empty, null);
}
public static void AreNotEqualIgnoringCase(string expected, string actual, string message, [System.Runtime.CompilerServices.Nullable(2)] params object[] args)
{
Assert.That(actual, Is.Not.EqualTo(expected).IgnoreCase, () => AssertBase.ConvertMessageWithArgs(message, args), "actual", "Is.Not.EqualTo(expected).IgnoreCase");
}
public static void AreNotEqualIgnoringCase(string expected, string actual)
{
AreNotEqualIgnoringCase(expected, actual, string.Empty, null);
}
public static void IsMatch(string pattern, string actual, string message, [System.Runtime.CompilerServices.Nullable(2)] params object[] args)
{
Assert.That(actual, Does.Match(pattern), () => AssertBase.ConvertMessageWithArgs(message, args), "actual", "Does.Match(pattern)");
}
public static void IsMatch(string pattern, string actual)
{
IsMatch(pattern, actual, string.Empty, null);
}
public static void DoesNotMatch(string pattern, string actual, string message, [System.Runtime.CompilerServices.Nullable(2)] params object[] args)
{
Assert.That(actual, Does.Not.Match(pattern), () => AssertBase.ConvertMessageWithArgs(message, args), "actual", "Does.Not.Match(pattern)");
}
public static void DoesNotMatch(string pattern, string actual)
{
DoesNotMatch(pattern, actual, string.Empty, null);
}
}
}