示例#1
0
 public void BookCipherEncryptWithNullWordThrows()
 {
     BookCipher.Encrypt("fest", BookWithNullWord, ',', LetterSelection.FirstLetter);
 }
示例#2
0
        public void BookCipherEncryptWithAlphabetIsSuccessful()
        {
            var result = BookCipher.Encrypt("sphinx quartz fledgy bmw v jock", BookWithAllLetters, ',', LetterSelection.FirstLetter);

            Assert.AreEqual("1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26", result, "encrypt be 1..26");
        }
示例#3
0
 public void BookCipherEncryptWithMissingLetterThrows()
 {
     BookCipher.Encrypt("fart", Book1, ',', LetterSelection.FirstLetter);
 }
示例#4
0
 public void BookCipherWithNegativeWordIndexThrows()
 {
     BookCipher.Decrypt(new int[] { 1, 2, -1 }, TestWords, LetterSelection.FirstLetter, OutOfBoundsIndex.ThrowException);
 }
示例#5
0
        public void BookCipherEncryptBasicIsSuccessful()
        {
            var result = BookCipher.Encrypt("fest", Book1, ',', LetterSelection.FirstLetter);

            Assert.AreEqual("1,2,3,4", result, "encrypt be 1,2,3,4");
        }
示例#6
0
        public void BookCipherWithWordIndexOutOfRangeAndWrapOnWithModuloZeroWorks()
        {
            var result = BookCipher.Decrypt(new int[] { 1, 2, 10, 4, 5 }, TestWords, LetterSelection.FirstLetter, OutOfBoundsIndex.WrapUsingModulo);

            Assert.AreEqual("fsysy", result, "cipher should be fsysy");
        }
示例#7
0
 public void BookCipherWithEmptyWordThrows()
 {
     BookCipher.Decrypt(new int[] { 1, 2 }, new string[] { "1", "" }, LetterSelection.FirstLetter, OutOfBoundsIndex.ThrowException);
 }
示例#8
0
        public void BookCipherWithWordIndexOutOfRangeAndNoExceptionsSetWorks()
        {
            var result = BookCipher.Decrypt(new int[] { 1, 2, 8 }, TestWords, LetterSelection.FirstLetter, OutOfBoundsIndex.ReturnQMark);

            Assert.AreEqual("fs?", result, "cipher should be fs?");
        }
示例#9
0
 public void BookCipherWithWordIndexOutOfRangeThrows()
 {
     BookCipher.Decrypt(new int[] { 1, 2, 8 }, TestWords, LetterSelection.FirstLetter, OutOfBoundsIndex.ThrowException);
 }
示例#10
0
 public void BookCipherWithBadIntFormatStringThrows()
 {
     BookCipher.Decrypt(new string[] { "1", "2", "3", "abc" }, TestWords, LetterSelection.FirstLetter, OutOfBoundsIndex.ThrowException);
 }
示例#11
0
        public void BookCipherDecryptWithIntAsStringLastLetterIsSuccessful()
        {
            var result = BookCipher.Decrypt(new string[] { "1", "2", "3", "4" }, TestWords, LetterSelection.LastLetter, OutOfBoundsIndex.ThrowException);

            Assert.AreEqual("redn", result, "IntAsString should be redn");
        }
示例#12
0
        public void BookCipherDecryptBasicLastLetterIsSuccessful()
        {
            var result = BookCipher.Decrypt(new int[] { 1, 2, 3, 4 }, TestWords, LetterSelection.LastLetter, OutOfBoundsIndex.ThrowException);

            Assert.AreEqual("redn", result, "cipher last letter should be redn");
        }