Search Results for

    Show / Hide Table of Contents

    Attribute Constraint

    AttributeConstraint tests for the existence of an attribute on a Type and then applies a constraint to that attribute.

    Constructor

    AttributeConstraint(Type type, IConstraint baseConstraint)
    

    Syntax

    Has.Attribute(typeof(TestFixtureAttribute))...
    Has.Attribute<TestFixtureAttribute>()...
    

    Examples of Use

    Assert.That(someObject, Has.Attribute(typeof(TestFixtureAttribute))
        .Property("Description").EqualTo("My description"));
    Assert.That(someObject, Has.Attribute<TestFixtureAttribute>()
        .Property("Description").EqualTo("My description"));
    

    See also

    • AttributeExistsConstraint
    • Edit this page
    In this article
    Back to top Generated by DocFX | Copyright (c) 2018- The NUnit Project - Licensed under CC BY-NC-SA 4.0