Unit tests for a function that calculates demerit points for speeding I'm currently working on a unit testing course (NUnit 3.x). I've been tasked with a simple class to test all edge cases.

using System;

namespace TestNinja.Fundamentals
{
    public class DemeritPointsCalculator
    {
        private const int SpeedLimit = 65;
        private const int MaxSpeed = 300;

        public int CalculateDemeritPoints(int speed)
        {
            if (speed &lt; 0 || speed &gt; MaxSpeed) 
                throw new ArgumentOutOfRangeException();

            if (speed &lt;= SpeedLimit) return 0; 

            const int kmPerDemeritPoint = 5;
            var demeritPoints = (speed - SpeedLimit)/kmPerDemeritPoint;

            return demeritPoints;
        }        
    }
}


And -

using System;
using NUnit.Framework;
using TestNinja.Fundamentals;

namespace TestNinja.UnitTests
{
    [TestFixture]
    public class CalculateDemeritPointsTests
    {
        private DemeritPointsCalculator _demeritPointsCalculator;

        [SetUp]
        public void SetUp()
        {
            _demeritPointsCalculator = new DemeritPointsCalculator();
        }

        // my solutions
        [Test]
        [TestCase(65,0)]
        [TestCase(70,1)]
        [TestCase(75,2)]
        [TestCase(80,3)]
        [TestCase(0,0)]
        [TestCase(60,0)]
        [TestCase(66,0)]
        public void CalculateDemeritPoints_WhenCalled_ReturnsExpectedInt(int speed, int expectedResult)
        {
            var result = _demeritPointsCalculator.CalculateDemeritPoints(speed);
            Assert.That(result, Is.EqualTo(expectedResult));
        }

        [Test]
        public void CalculateDemeritPoints_SpeedLessThan0_ThrowsException()
        {
            Assert.That(() =&gt; _demeritPointsCalculator.CalculateDemeritPoints(-1), Throws.InstanceOf&lt;ArgumentOutOfRangeException&gt;());
        }

        [Test]
        public void CalculateDemeritPoints_SpeedGreaterThan300_ThrowsException()
        {
            Assert.That(() =&gt; _demeritPointsCalculator.CalculateDemeritPoints(301), Throws.InstanceOf&lt;ArgumentOutOfRangeException&gt;());
        }
    }
}



Am I using to many test cases for CalculateDemeritPoints_WhenCalled_ReturnsExpectedInt?

I was thinking about merging the final two tests into one as they would also work with test cases, but I wasn't sure if I was doing to many.
You probably want to 


add a constant for speed 0
create a test for MaxSpeed
create a test case for 64 (it's one edge of the partition class  0 &lt;= x &lt; speedlimit and it could replace 60 which is in the same partition class)


I would keep the 66 test case since it is and edge case.

Even though the edges are cut pretty clear with ints (compared to using float values) you might still want to test them explicitly.