コード例 #1
0
        public void RepeatingArray()
        {
            var testArray = new[] { 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, };
            var result    = SeekClosestToAverageClass.SeekClosestToAverage(testArray);

            Assert.AreEqual(2, result);
        }
コード例 #2
0
        public void SingleItemArray()
        {
            var testArray = new[] { 1 };
            var result    = SeekClosestToAverageClass.SeekClosestToAverage(testArray);

            Assert.AreEqual(1, result);
        }
コード例 #3
0
        public void GivenTestCase()
        {
            var testArray = new[] { 1, 2, 3, 5, -1, 7, 145, -33, 22, 14 };
            var result    = SeekClosestToAverageClass.SeekClosestToAverage(testArray);

            Assert.AreEqual(14, result);
        }
コード例 #4
0
 public void EmptyArray()
 {
     Assert.ThrowsException <Exception>(() => SeekClosestToAverageClass.SeekClosestToAverage(new int[0]));
 }