Beispiel #1
0
        //[TestCase(new[] { 3, 2, 1 }, 2)]
        //[TestCase(new[] { 4, 3, 2, 1 }, 2.5)]
        //[TestCase(new[] { 1, 2, 3, 4, 5, 6 }, 3.5)]
        //[TestCase(new[] { 4, 3, 2, 6, 8 }, 4)]
        //[TestCase(new[] { 1, 1, 2, 6, 6, 9 }, 4)]
        //[TestCase(new[] { 2, 10, 21, 23, 23, 38, 38 }, 23)]
        //[TestCase(new[] { 2, 10, 21, 23, 23, 38, 38, 1027892 }, 23)]
        public void FindMedianTest(int[] input, double expected)
        {
            var algorithm = new FraudulentActivityNotifications();
            var buckets   = input.OrderBy(x => x).ToList();
            var result    = FraudulentActivityNotifications.FindMedian(buckets, input.Count());

            Assert.AreEqual(expected, result);
        }