Пример #1
0
        public void GenerateIV_GeneratesDifferentResult_EachTimeCalled()
        {
            //Arrange
            var iv = new RandomIV();
            int blockSize = 128;

            byte[] iv1;
            byte[] iv2;

            //Act
            iv1 = iv.GenerateIV(blockSize);
            iv2 = iv.GenerateIV(blockSize);

            //Assert
            Assert.IsFalse(iv1.SequenceEqual(iv2));
        }
Пример #2
0
        public void GenerateIV_ThrowsArgumentOutOfRangeException_WhenBlockSizeIsLessThanAByte()
        {
            //Arrange
            var iv = new RandomIV();
            int blockSize = 7;

            //Act
            //Assert
            iv.GenerateIV(blockSize);
        }
Пример #3
0
        public void GenerateIV_ReturnsNonZeroArray_WhenBlockSizeIsMoreThanOrEqualToOneByte()
        {
            //Arrange
            var iv = new RandomIV();
            int blockSize = 9;
            byte[] actual;

            //Act
            actual = iv.GenerateIV(blockSize);

            //Assert
            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Length > 0);
        }
Пример #4
0
        public void GenerateIV_Returns16ByteArray_WhenBlockSizeIs128()
        {
            //Arrange
            var iv = new RandomIV();
            int blockSize = 128;

            const int expected = 16;
            int actual;

            //Act
            actual = iv.GenerateIV(blockSize).Length;

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