-
Notifications
You must be signed in to change notification settings - Fork 53
Member based
NFluent allows to perform checks using specific fields/properties from the sut. It simplifies several testing scenarii such as DTO testing. Or typeless TDD.
Considering() allows you to specify which members should be evaluated/considered for the check. It will be followed by one or more member selectors.
Check.That(sut).Considering()...
Those keywords can be used to specify the desired members' visibility. If not specified, Considering() assumes Public visibility.
Specifies you are interested in public members. In C#, a member is considered public if it is declared as: public, protected or internal.
Check.That(sut).Considering().Public....
Specifies you are interested in non public members. In C#, a member is considered nonpublic if it is declared as: private.
Check.That(sut).Considering().NonPublic...
Specifies you are interested in all public members, public or not.
Check.That(sut).Considering().All...
Specifies you are interested in fields.
// specify you want to consider only public fields in the comparison
Check.That(sut).Considering().Fields.IsEqualTo(...);
// verbose syntax
Check.That(sut).Considering().Public.Fields.IsEqualTo(...);
Specifies you are interested in properties.
// specify you want to consider only public properties in the comparison
Check.That(sut).Considering().Properties.IsEqualTo(...);
// verbose syntax
Check.That(sut).Considering().Public.Properties.IsEqualTo(...);
Allows to chain selection criteria.
// specify you want to consider both public properties and fields in the comparison
Check.That(sut).Considering().Properties.And.Fields.IsEqualTo(...);
// complex selection
Check.That(sut).Considering().Public.Fields.And.Private.Properties.IsEqualTo(...);
Allows to give the name of members that must be excluded from the checks. You can use dotted name to list sub members.
// specify you do not want some fields
Check.That(sut).Considering().Fields.Excluding("someField", "member.someOtherField").IsEqualTo(...);
- Welcome
- How to start
- Customising error messages
-
Check.That
- All (Equality, Type)
- Reference types
- Members based
- IEnumerable (Properties, Content, Elements)
- String (Properties, Content, RegExp )
- Numeric Type(Properties, Comparisons, Floating)
- Dictionary
- Char (Properties, Value)
- IComparable
- DateTime
- DateTimeOffset
- Misc: Boolean, TimeSpan, Stream, Enum, EventWaitHandle
- Check.ThatCode
- Check.ThatDynamic
- Extensibility
- Auxiliary types (TimeUnit)
- Mocks