annotate Limits/SimpleRoundedPercentageLimitTest.cs @ 6:9a860452ced0

Re #24: Add "limit" objects that can be used for numeric limits * Fix licenses for new files * Add tests for rounding down
author IBBoard <dev@ibboard.co.uk>
date Wed, 07 Oct 2009 18:40:54 +0000
parents abf657708a35
children a2cbd7cb6a5e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
9a860452ced0 Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents: 5
diff changeset
1 // This file (SimpleRoundedPercentageLimitTest.cs) is a part of the IBBoard.Tests project and is copyright 2009 IBBoard
4
a6b26fe532df Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2 //
6
9a860452ced0 Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents: 5
diff changeset
3 // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license.
4
a6b26fe532df Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4
a6b26fe532df Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 using System;
a6b26fe532df Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6 using NUnit.Framework;
a6b26fe532df Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
7
a6b26fe532df Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8 namespace IBBoard.Limits
a6b26fe532df Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 {
a6b26fe532df Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10 [TestFixture()]
5
abf657708a35 Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
11 public class SimpleRoundedPercentageLimitTest
4
a6b26fe532df Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12 {
a6b26fe532df Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13 [Test()]
6
9a860452ced0 Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents: 5
diff changeset
14 public void TestSimpleRoundingUpLimit ()
4
a6b26fe532df Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
15 {
5
abf657708a35 Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
16 SimpleRoundedPercentageLimit limit = new SimpleRoundedPercentageLimit(10, true);
abf657708a35 Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
17 Assert.AreEqual(10, limit.GetLimit(100));
abf657708a35 Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
18 Assert.AreEqual(1, limit.GetLimit(10));
abf657708a35 Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
19 Assert.AreEqual(1, limit.GetLimit(1));
4
a6b26fe532df Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
20 }
6
9a860452ced0 Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents: 5
diff changeset
21
9a860452ced0 Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents: 5
diff changeset
22 [Test()]
9a860452ced0 Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents: 5
diff changeset
23 public void TestSimpleRoundingDownLimit ()
9a860452ced0 Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents: 5
diff changeset
24 {
9a860452ced0 Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents: 5
diff changeset
25 SimpleRoundedPercentageLimit limit = new SimpleRoundedPercentageLimit(10, false);
9a860452ced0 Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents: 5
diff changeset
26 Assert.AreEqual(10, limit.GetLimit(100));
9a860452ced0 Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents: 5
diff changeset
27 Assert.AreEqual(1, limit.GetLimit(10));
9a860452ced0 Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents: 5
diff changeset
28 Assert.AreEqual(0, limit.GetLimit(1));
9a860452ced0 Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents: 5
diff changeset
29 }
4
a6b26fe532df Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
30 }
a6b26fe532df Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
31 }