You could for example test ToString()
result of your AbstractCriterion
( which should be NotExpression with a nested private _criterion
)
Anyway, I don't see it as a good idea. I may be off-topic here, but I would rather test the behavior of the result than its structure, or the result of ToString()
. The main point being (IMHO) what the code does, more than its conformance to your knowledge of the target data-structure.
I guess it would be better to setup an in-memory database ( SqlLite comes to mind ) and test applying your restrictions on a test set. And it seems similar to (part of) the way NH is tested https://github.com/nhibernate/nhibernate-core/blob/master/src/NHibernate.Test/Criteria/CriteriaQueryTest.cs