Exemplo n.º 1
0
        public void PadKey_PaddingLengthEqualsKeyLengthReturnsUnmodifiedCuts()
        {
            KeyModel input = new KeyModel()
            {
                Cuts = "123456"
            };

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

            List <int?> output = PinningModelBase.PadKey(input, 6);

            if (output.Count != expected.Count)
            {
                Assert.Fail("Output has wrong length.");
            }

            for (int index = 0; index < output.Count; index++)
            {
                if (output[index] != expected[index])
                {
                    Assert.Fail($"Output has wrong value at index {index}");
                }
            }
        }
Exemplo n.º 2
0
        public void PadKey_EndStoppedRightPadsLeft()
        {
            KeyModel input = new KeyModel()
            {
                Cuts = "123456"
            };

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

            List <int?> output = PinningModelBase.PadKey(input, 9, false);

            if (output.Count != expected.Count)
            {
                Assert.Fail("Output has wrong length.");
            }

            for (int index = 0; index < output.Count; index++)
            {
                if (output[index] != expected[index])
                {
                    Assert.Fail($"Output has wrong value at index {index}");
                }
            }
        }
Exemplo n.º 3
0
        public void PadKey_ZeroPaddingLengthReturnsEmptyList()
        {
            KeyModel input = new KeyModel()
            {
                Cuts = "123456"
            };

            List <int?> output = PinningModelBase.PadKey(input, 0);

            if (output.Count != 0)
            {
                Assert.Fail($"Output has length {output.Count} instead of zero.");
            }
        }