public void Sum_PassValidNumber()
        {
            var target = new Problem1();
            Assert.AreEqual(15, target.Sum(5));
            Assert.AreEqual(1, target.Sum(1));

            // now for some fancy randomized testing.
            var random = new Random();

            // test three different random numbers between 1 and 10000.
            var x = random.Next(1, 10000);
            Assert.AreEqual((x * (x + 1)) / 2, target.Sum(x));
            x = random.Next(1, 10000);
            Assert.AreEqual((x * (x + 1)) / 2, target.Sum(x));
            x = random.Next(1, 10000);
            Assert.AreEqual((x * (x + 1)) / 2, target.Sum(x));
        }
 public void Sum_PassZero()
 {
     var target = new Problem1();
     Assert.AreEqual(0, target.Sum(0));
 }
 public void Sum_PassNegativeNumber()
 {
     var target = new Problem1();
     target.Sum(-3);
 }