1
// ****************************************************************
2
// Copyright 2011, 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
// ****************************************************************
8
using System.Collections;
10
using System.Collections.Generic;
13
namespace NUnit.Framework.Constraints
16
/// Abstract base class for constraints that compare values to
17
/// determine if one is greater than, equal to or less than
18
/// the other. This class supplies the Using modifiers.
20
public abstract class ComparisonConstraint : Constraint
23
/// ComparisonAdapter to be used in making the comparison
25
protected ComparisonAdapter comparer = ComparisonAdapter.Default;
28
/// Initializes a new instance of the <see cref="T:ComparisonConstraint"/> class.
30
public ComparisonConstraint(object arg) : base(arg) { }
33
/// Initializes a new instance of the <see cref="T:ComparisonConstraint"/> class.
35
public ComparisonConstraint(object arg1, object arg2) : base(arg1, arg2) { }
38
/// Modifies the constraint to use an IComparer and returns self
40
public ComparisonConstraint Using(IComparer comparer)
42
this.comparer = ComparisonAdapter.For(comparer);
46
#if CLR_2_0 || CLR_4_0
48
/// Modifies the constraint to use an IComparer<T> and returns self
50
public ComparisonConstraint Using<T>(IComparer<T> comparer)
52
this.comparer = ComparisonAdapter.For(comparer);
57
/// Modifies the constraint to use a Comparison<T> and returns self
59
public ComparisonConstraint Using<T>(Comparison<T> comparer)
61
this.comparer = ComparisonAdapter.For(comparer);