Does
Helper class with properties and methods that supply
a number of constraints used in Asserts.
using NUnit.Framework.Constraints;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
namespace NUnit.Framework
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
public abstract class Does
{
public static ConstraintExpression Not => new ConstraintExpression().Not;
public static FileOrDirectoryExistsConstraint Exist => new FileOrDirectoryExistsConstraint();
public static SomeItemsConstraint Contain([System.Runtime.CompilerServices.Nullable(2)] object expected)
{
return new SomeItemsConstraint(new EqualConstraint(expected));
}
public static ContainsConstraint Contain([System.Runtime.CompilerServices.Nullable(2)] string expected)
{
return new ContainsConstraint(expected);
}
public static DictionaryContainsKeyConstraint ContainKey(object expected)
{
return Contains.Key(expected);
}
public static DictionaryContainsValueConstraint ContainValue([System.Runtime.CompilerServices.Nullable(2)] object expected)
{
return Contains.Value(expected);
}
public static StartsWithConstraint StartWith(string expected)
{
return new StartsWithConstraint(expected);
}
public static EndsWithConstraint EndWith(string expected)
{
return new EndsWithConstraint(expected);
}
public static RegexConstraint Match([StringSyntax("Regex")] string pattern)
{
return new RegexConstraint(pattern);
}
public static RegexConstraint Match(Regex regex)
{
return new RegexConstraint(regex);
}
}
}