예제 #1
0
        public void Encrypt_StartPosition0EncryptOOT_TRS()
        {
            var          machine = new RotorMachine(0);
            const string text    = "OOT";

            const string expected = "TRS";

            var actual = machine.Encrypt(text);

            Assert.Equal(expected, actual);
        }
예제 #2
0
        public void Encrypt_StartPosition4EncryptPOSTTOTOPOOPSSORRYSTOPROTOR_TRRYSSPRYRYROYTOPTOPTSPSPRS()
        {
            var          machine = new RotorMachine(4);
            const string text    = "POSTTOTOPOOPSSORRYSTOPROTOR";

            const string expected = "TRRYSSPRYRYROYTOPTOPTSPSPRS";

            var actual = machine.Encrypt(text);

            Assert.Equal(expected, actual);
        }
예제 #3
0
        public void Decrypt_StartPosition4DecryptTRRYSSPRYRYROYTOPTOPTSPSPRS_POSTTOTOPOOPSSORRYSTOPROTOR()
        {
            var          machine = new RotorMachine(4);
            const string text    = "TRRYSSPRYRYROYTOPTOPTSPSPRS";

            const string expected = "POSTTOTOPOOPSSORRYSTOPROTOR";

            var actual = machine.Decrypt(text);

            Assert.Equal(expected, actual);
            Assert.Equal(4, machine.CurrentPosition);
        }
예제 #4
0
        public void Decrypt_StartPosition0DecryptTRS_OOT()
        {
            var          machine = new RotorMachine(0);
            const string text    = "TRS";

            const string expected = "OOT";

            var actual = machine.Decrypt(text);

            Assert.Equal(expected, actual);
            Assert.Equal(0, machine.CurrentPosition);
        }