public void TestMethod1()
        {
            var test  = (2 + 3) / 2;
            var test1 = (0 + 3) / 2;
            var test2 = (0 + 1) / 2;

            Assert.AreEqual(3, SortedSearch.CountNumbers(new int[] { 1, 3, 5, 7, 8, 10, 12, 7 }, 6));
            Assert.AreEqual(1, SortedSearch.CountNumbers(new int[] { 1, 3 }, 2));
            Assert.AreEqual(1, SortedSearch.CountNumbers(new int[] { 1 }, 2));
            Assert.AreEqual(0, SortedSearch.CountNumbers(new int[] { 1 }, -1));
        }
        public void SortedSearch_CountNumbers()
        {
            // Arrange.
            SortedSearch sortedSearch = new SortedSearch();

            // Act.
            int actual = sortedSearch.CountNumbers(new int[] { 1, 3, 5, 7 }, 4);

            // Assert.
            Assert.AreEqual(2, actual);
        }
Beispiel #3
0
 public static void Main(string[] args)
 {
     Console.WriteLine(SortedSearch.CountNumbers(new int[]
     {
         1, 3, 5, 7, 8,
         9, 11, 13, 15, 20,
         25, 27, 28, 29, 30,
         45, 50, 51, 52, 55
     },
                                                 2));
     Console.Read();
 }
Beispiel #4
0
    public static void Main(string[] args)
    {
        Console.WriteLine(SortedSearch.CountNumbers(new int[] { 1, 2, 3, 4 }, 4));//Esta funcion busca si existen valores menores a lessThan=4 en el array={ 1,2,3,4 },y devuelve la cantidad de elemntos menores a 4 si los encuentra

        Console.ReadLine();
    }
Beispiel #5
0
 public static void Main(string[] args)
 {
     Console.WriteLine(SortedSearch.CountNumbers(new int[] { 1, 3, 5, 7 }, 4));
 }
        public void Count_should_count_number_less_than_correctly(int expected, int lessThan, params int[] args)
        {
            var result = SortedSearch.CountNumbers(args, lessThan);

            Assert.Equal(expected, result);
        }