~ubuntu-branches/debian/sid/nunit/sid

« back to all changes in this revision

Viewing changes to src/NUnitFramework/framework/Constraints/LessThanConstraint.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2014-09-16 13:43:36 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20140916134336-kjxz48tty6lx2ja5
Tags: 2.6.3+dfsg-1
* [c7bd1b5] Imported Upstream version 2.6.3+dfsg
* [bcb4bf8] Move nunit-console-runner to GAC-installed libnunit2.6, 
  don't treat it as a private lib. This lib is signed, and treated 
  as a GAC lib by consumers such as MonoDevelop.
* [7f08e99] Bump version to 2.6.3 as required
* [84535eb] Refreshed patches
* [8479f61] Split package up into per-assembly packages. This makes 
  ABI tracking easier in the future, as we can meaningfully have GAC 
  policy for cases where ABI isn't truly bumped, and no policy for 
  cases where it is. For example, if nunit.framework bumps ABI but 
  nunit.core does not, previously we would need to rebuild everything 
  using NUnit, but under the new split packaging, that rebuild would 
  not be needed for apps only using nunit.core.
* [17a7dc7] Add missing nunit.mocks.dll to nunit.pc

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
// ****************************************************************
6
 
 
7
 
using System;
8
 
 
9
 
namespace NUnit.Framework.Constraints
10
 
{
11
 
    /// <summary>
12
 
    /// Tests whether a value is less than the value supplied to its constructor
13
 
    /// </summary>
14
 
    public class LessThanConstraint : ComparisonConstraint
15
 
    {
16
 
        /// <summary>
17
 
        /// The value against which a comparison is to be made
18
 
        /// </summary>
19
 
        private object expected;
20
 
 
21
 
        /// <summary>
22
 
        /// Initializes a new instance of the <see cref="T:LessThanConstraint"/> class.
23
 
        /// </summary>
24
 
        /// <param name="expected">The expected value.</param>
25
 
        public LessThanConstraint(object expected) : base(expected) 
26
 
        {
27
 
            this.expected = expected;
28
 
        }
29
 
 
30
 
        /// <summary>
31
 
        /// Write the constraint description to a MessageWriter
32
 
        /// </summary>
33
 
        /// <param name="writer">The writer on which the description is displayed</param>
34
 
        public override void WriteDescriptionTo(MessageWriter writer)
35
 
        {
36
 
            writer.WritePredicate("less than");
37
 
            writer.WriteExpectedValue(expected);
38
 
        }
39
 
 
40
 
        /// <summary>
41
 
        /// Test whether the constraint is satisfied by a given value
42
 
        /// </summary>
43
 
        /// <param name="actual">The value to be tested</param>
44
 
        /// <returns>True for success, false for failure</returns>
45
 
        public override bool Matches(object actual)
46
 
        {
47
 
            this.actual = actual;
48
 
 
49
 
            if (expected == null || actual == null)
50
 
                throw new ArgumentException("Cannot compare using a null reference");
51
 
 
52
 
            return comparer.Compare(actual, expected) < 0;
53
 
        }
54
 
    }
55
 
}
 
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
// ****************************************************************
 
6
 
 
7
using System;
 
8
 
 
9
namespace NUnit.Framework.Constraints
 
10
{
 
11
    /// <summary>
 
12
    /// Tests whether a value is less than the value supplied to its constructor
 
13
    /// </summary>
 
14
    public class LessThanConstraint : ComparisonConstraint
 
15
    {
 
16
        /// <summary>
 
17
        /// The value against which a comparison is to be made
 
18
        /// </summary>
 
19
        private object expected;
 
20
 
 
21
        /// <summary>
 
22
        /// Initializes a new instance of the <see cref="T:LessThanConstraint"/> class.
 
23
        /// </summary>
 
24
        /// <param name="expected">The expected value.</param>
 
25
        public LessThanConstraint(object expected) : base(expected) 
 
26
        {
 
27
            this.expected = expected;
 
28
        }
 
29
 
 
30
        /// <summary>
 
31
        /// Write the constraint description to a MessageWriter
 
32
        /// </summary>
 
33
        /// <param name="writer">The writer on which the description is displayed</param>
 
34
        public override void WriteDescriptionTo(MessageWriter writer)
 
35
        {
 
36
            writer.WritePredicate("less than");
 
37
            writer.WriteExpectedValue(expected);
 
38
        }
 
39
 
 
40
        /// <summary>
 
41
        /// Test whether the constraint is satisfied by a given value
 
42
        /// </summary>
 
43
        /// <param name="actual">The value to be tested</param>
 
44
        /// <returns>True for success, false for failure</returns>
 
45
        public override bool Matches(object actual)
 
46
        {
 
47
            this.actual = actual;
 
48
 
 
49
            if (expected == null || actual == null)
 
50
                throw new ArgumentException("Cannot compare using a null reference");
 
51
 
 
52
            return comparer.Compare(actual, expected) < 0;
 
53
        }
 
54
    }
 
55
}