Пример #1
0
        public void PadColumn_PaddingHeightGreaterThanInputReturnsPaddedInput()
        {
            List <int?> input = new List <int?> {
                1, 2, 3, 4, 5
            };

            List <int?> expected = new List <int?> {
                1, 2, 3, 4, 5, null, null
            };

            List <int?> output = PinningModelBase.PadColumn(input, 7);

            if (output.Count != expected.Count)
            {
                Assert.Fail($"Output had length {output.Count} instead of {expected.Count}.");
            }

            for (int index = 0; index < output.Count; index++)
            {
                int?currentOutput   = output[index];
                int?currentExpected = expected[index];

                if (currentOutput != currentExpected)
                {
                    Assert.Fail($"Output value {currentOutput} at index {index} did not match expected value of {currentExpected}.");
                }
            }
        }
Пример #2
0
        public void PadColumn_EmptyInputReturnsColumnOfNulls()
        {
            List <int?> input = new List <int?>();

            List <int?> expected = new List <int?> {
                null, null, null, null, null
            };

            List <int?> output = PinningModelBase.PadColumn(input, 5);

            if (output.Count != expected.Count)
            {
                Assert.Fail($"Output had length {output.Count} instead of {expected.Count}.");
            }

            for (int index = 0; index < output.Count; index++)
            {
                int?currentOutput   = output[index];
                int?currentExpected = expected[index];

                if (currentOutput != currentExpected)
                {
                    Assert.Fail($"Output value {currentOutput} at index {index} did not match expected value of {currentExpected}.");
                }
            }
        }
Пример #3
0
        public void PadColumn_PaddingHeightLessThanInputThrowsException()
        {
            List <int?> input = new List <int?> {
                1, 2, 3, 4, 5
            };

            Assert.ThrowsException <ArgumentOutOfRangeException>(() => { PinningModelBase.PadColumn(input, 2); });
        }