Exemple #1
0
        public void Clear_ClearRingBufferWithSomeNumbersShouldWork()
        {
            // Arrange
            RingBufferArray <int> sut = new RingBufferArray <int>(10);
            int expected = 0;

            // Act
            sut.Add(int.MaxValue);
            sut.Add(int.MinValue);
            sut.Add(42);
            sut.Clear();
            int actual = sut.Size();

            // Assert
            Assert.Equal(expected, actual);
        }
Exemple #2
0
        public void Get_GetAllNumbersFromRingBufferShouldWork()
        {
            // Arrange
            RingBufferArray <int> sut = new RingBufferArray <int>(10);
            int expected = 0;

            // Act
            for (int i = 0; i < 20; i++)
            {
                sut.Add(i);
            }
            for (int i = 0; i <= 10; i++)
            {
                sut.Get();
            }
            int actual = sut.Size();

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