public static void SortingFunctionPositiveTest(SortingFunctionTestCaseData caseData)
 {
     Assert.That(FindFunction.FindIndexes(caseData.Numbers, caseData.Target), Is.Not.Empty,
                 () => "No hits with current values!");
     Assert.That(FindFunction.FindIndexes(caseData.Numbers, caseData.Target).ElementAt(caseData.IndexData),
                 Is.EqualTo(caseData.ExpectedIndex));
 }
Exemple #2
0
        public static void PresentIndexes(int[] valueArray, int target)
        {
            var indexes = FindFunction.FindIndexes(valueArray, target).ToList();

            if (indexes.Any())
            {
                foreach (var index in indexes)
                {
                    if (index != null)
                    {
                        foreach (var i in index)
                        {
                            Console.WriteLine($"{i}");
                        }
                    }
                    else
                    {
                        throw new NullReferenceException();
                    }
                }
            }
            else
            {
                Console.WriteLine("No hits with current values!");
            }
        }
 public static void SortingFunctionNegativeTest(SortingFunctionTestCaseData caseData)
 {
     Assert.That(FindFunction.FindIndexes(caseData.Numbers, caseData.Target), Is.Not.Empty);
     Assert.That(FindFunction.FindIndexes(caseData.Numbers, caseData.Target).ElementAt(caseData.IndexData),
                 Is.Not.EqualTo(caseData.ExpectedIndex));
 }
Exemple #4
0
 // with delegate
 public static int DelegateSearcher(int[] array, int value, FindFunction function)
 {
     return(function(array, value));
 }
Exemple #5
0
 private void Awake()
 {
     player   = GameObject.FindWithTag("Player");
     instance = this;
 }