PageRenderTime 42ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/src/NUnit/framework/Constraints/ResolvableConstraintExpression.cs

#
C# | 62 lines | 24 code | 6 blank | 32 comment | 0 complexity | 10f4900f595a78b298afb39b6705e86f MD5 | raw file
Possible License(s): GPL-2.0
  1. // ****************************************************************
  2. // Copyright 2008, Charlie Poole
  3. // This is free software licensed under the NUnit license. You may
  4. // obtain a copy of the license at http://nunit.org
  5. // ****************************************************************
  6. using System;
  7. namespace NUnit.Framework.Constraints
  8. {
  9. /// <summary>
  10. /// ResolvableConstraintExpression is used to represent a compound
  11. /// constraint being constructed at a point where the last operator
  12. /// may either terminate the expression or may have additional
  13. /// qualifying constraints added to it.
  14. ///
  15. /// It is used, for example, for a Property element or for
  16. /// an Exception element, either of which may be optionally
  17. /// followed by constraints that apply to the property or
  18. /// exception.
  19. /// </summary>
  20. public class ResolvableConstraintExpression : ConstraintExpression, IResolveConstraint
  21. {
  22. /// <summary>
  23. /// Create a new instance of ResolvableConstraintExpression
  24. /// </summary>
  25. public ResolvableConstraintExpression() { }
  26. /// <summary>
  27. /// Create a new instance of ResolvableConstraintExpression,
  28. /// passing in a pre-populated ConstraintBuilder.
  29. /// </summary>
  30. public ResolvableConstraintExpression(ConstraintBuilder builder)
  31. : base(builder) { }
  32. /// <summary>
  33. /// Appends an And Operator to the expression
  34. /// </summary>
  35. public ConstraintExpression And
  36. {
  37. get { return this.Append(new AndOperator()); }
  38. }
  39. /// <summary>
  40. /// Appends an Or operator to the expression.
  41. /// </summary>
  42. public ConstraintExpression Or
  43. {
  44. get { return this.Append(new OrOperator()); }
  45. }
  46. #region IResolveConstraint Members
  47. /// <summary>
  48. /// Resolve the current expression to a Constraint
  49. /// </summary>
  50. Constraint IResolveConstraint.Resolve()
  51. {
  52. return builder.Resolve();
  53. }
  54. #endregion
  55. }
  56. }