AssignableToConstraint
AssignableToConstraint is used to test that an object
can be assigned to a given Type.
using System;
namespace NUnit.Framework.Constraints
{
public class AssignableToConstraint : TypeConstraint
{
public AssignableToConstraint(Type type)
: base(type, "assignable to ")
{
}
protected override bool Matches(object actual)
{
if (expectedType != (Type)null && actual != null)
return expectedType.IsInstanceOfType(actual);
return false;
}
}
}