Esempio n. 1
0
        public void Opg2a_Queue50_01_SizeOk()
        {
            // Arrange
            int expected = 50;

            // Act
            Queue <int> queue  = BAI_Afteken1.Opdr2aQueue50();
            int         actual = queue.Count;

            // Assert
            Assert.AreEqual(expected, actual);
        }
Esempio n. 2
0
        [TestCase(-50, -20, 10)] // negatieve upper en lower
        //[TestCase(100_000, 500_000, 400_001)]  // Veel getallen, keuze uit evenveel
        public void Opg3_02_UniqueNumbers(int lower, int upper, int count)
        {
            // Arrange
            Stack <int> stack;
            int         expected = count;

            // Act
            stack = BAI_Afteken1.Opdr3RandomNumbers(lower, upper, count);
            int actual = stack.Distinct().Count <int>();

            // Assert
            Assert.AreEqual(expected, actual);
        }
Esempio n. 3
0
        [TestCase(-50, -20, 10)] // negatieve upper en lower
        //[TestCase(100_000, 500_000, 400_001)]  // Veel getallen, keuze uit evenveel
        public void Opg3_01_SizeOk(int lower, int upper, int count)
        {
            // Arrange
            Stack <int> stack;
            int         expected = count;

            // Act
            stack = BAI_Afteken1.Opdr3RandomNumbers(lower, upper, count);
            int actual = stack.Count;

            // Assert
            Assert.AreEqual(expected, actual);
        }
Esempio n. 4
0
        public void Opg1(string input_str, string expected_str)
        {
            // Arrange
            List <int> input_list    = TestUtils.ListFromString(input_str);
            List <int> expected_list = TestUtils.ListFromString(expected_str);
            int        expected      = 0;

            // Act
            BAI_Afteken1.Opdr1FilterList(input_list);

            // Assert
            Assert.IsTrue(input_list.SequenceEqual(expected_list));
        }
Esempio n. 5
0
        [TestCase(-50, -20, 10)] // negatieve upper en lower
        //[TestCase(100_000, 500_000, 400_001)]  // Veel getallen, keuze uit evenveel
        public void Opg3_03_BoundsOk(int lower, int upper, int count)
        {
            // Arrange
            Stack <int> stack;
            int         expected = 0;

            // Act
            stack = BAI_Afteken1.Opdr3RandomNumbers(lower, upper, count);
            var out_bounds = stack.Where <int>(num => num <lower || num> upper);
            int actual     = out_bounds.Count <int>();

            // Assert
            Assert.AreEqual(expected, actual);
        }
Esempio n. 6
0
        public void Opg2a_Queue50_02_ContentsOk()
        {
            // Arrange

            // Act
            Queue <int> queue = BAI_Afteken1.Opdr2aQueue50();

            // Assert
            int expected = 1;

            while (queue.Count > 0)
            {
                int actual = queue.Dequeue();
                Assert.AreEqual(expected, actual);
                expected++;
            }
        }
Esempio n. 7
0
        public void Opg2b_StackFromQueue_01_ContentsOk(string input_str, string expected_str)
        {
            // Arrange
            Queue <int> queue         = new Queue <int>();
            List <int>  input_list    = TestUtils.ListFromString(input_str);
            List <int>  expected_list = TestUtils.ListFromString(expected_str);

            foreach (int x in input_list)
            {
                queue.Enqueue(x);
            }

            // Act
            Stack <int> stack = BAI_Afteken1.Opdr2bStackFromQueue(queue);

            // Assert
            Assert.IsTrue(stack.SequenceEqual(expected_list));
        }
Esempio n. 8
0
        public void Opg2b_StackFromQueue_02_QueueBecomesEmpty(string input_str)
        {
            // Arrange
            Queue <int> queue      = new Queue <int>();
            List <int>  input_list = TestUtils.ListFromString(input_str);

            foreach (int x in input_list)
            {
                queue.Enqueue(x);
            }
            int expected = 0;

            // Act
            Stack <int> stack  = BAI_Afteken1.Opdr2bStackFromQueue(queue);
            int         actual = queue.Count;

            // Assert
            Assert.AreEqual(expected, actual);
        }