Пример #1
0
        public void CheckPairsFirstElement()
        {
            var numbers = new int[] { 1, 9, 3, 4, 5, 6, 2, 9 };
            var pairs   = new HashSet <Tuple <int, int> >()
            {
                new Tuple <int, int>(1, 1), new Tuple <int, int>(9, 1),
                new Tuple <int, int>(9, 9), new Tuple <int, int>(9, 3),
                new Tuple <int, int>(3, 1), new Tuple <int, int>(3, 3),
                new Tuple <int, int>(4, 1), new Tuple <int, int>(4, 4),
                new Tuple <int, int>(4, 2), new Tuple <int, int>(5, 1),
                new Tuple <int, int>(5, 5), new Tuple <int, int>(6, 1),
                new Tuple <int, int>(6, 3), new Tuple <int, int>(6, 6),
                new Tuple <int, int>(6, 2), new Tuple <int, int>(2, 1),
                new Tuple <int, int>(2, 2)
            };

            Assert.True(pairs.FirstOrDefault().Item1 == ArrayWorker.CheckNotRepeatedDivisible(numbers).FirstOrDefault().Item1);
        }
Пример #2
0
        public void CheckCompletePairsCount()
        {
            var numbers = new int[] { 1, 9, 0, 3, 4, 5, 6, 2, 9 };
            var pairs   = new List <Tuple <int, int> >()
            {
                new Tuple <int, int>(1, 1), new Tuple <int, int>(9, 1),
                new Tuple <int, int>(9, 9), new Tuple <int, int>(9, 3),
                new Tuple <int, int>(9, 9), new Tuple <int, int>(3, 1),
                new Tuple <int, int>(3, 3), new Tuple <int, int>(4, 1),
                new Tuple <int, int>(4, 4), new Tuple <int, int>(4, 2),
                new Tuple <int, int>(5, 1), new Tuple <int, int>(5, 5),
                new Tuple <int, int>(6, 1), new Tuple <int, int>(6, 3),
                new Tuple <int, int>(6, 6), new Tuple <int, int>(6, 2),
                new Tuple <int, int>(2, 1), new Tuple <int, int>(2, 2),
                new Tuple <int, int>(9, 1), new Tuple <int, int>(9, 9),
                new Tuple <int, int>(9, 3), new Tuple <int, int>(9, 9)
            };

            Assert.True(pairs.Count == ArrayWorker.CheckDivisible(numbers).Count);
        }
Пример #3
0
 public void CheckCompletePairsFirstThrowable()
 {
     Assert.Throws <Exception>(() => ArrayWorker.CheckDivisible(null));
 }
Пример #4
0
 public void CheckPairsFirstThrowable()
 {
     Assert.Throws <Exception>(() => ArrayWorker.CheckNotRepeatedDivisible(null));
 }