public void TestRotorsDoubleStepping() { var machine = new MyEnigmaMachine(); machine.SetCurrentRotorRingLetters(new [] { 'A', 'D', 'O' }); RepeatKey(machine, 'A', 6); char[] ringLetters = machine.GetCurrentRotorRingLetters(); Assert.AreEqual('B', ringLetters[0]); Assert.AreEqual('F', ringLetters[1]); Assert.AreEqual('U', ringLetters[2]); }
public void TestEncryptionRingStartingLettertSettings() { var machine = new MyEnigmaMachine(); machine.SetCurrentRotorRingLetters(new[] { 'F', 'R', 'Q' }); string cypher = machine.Encrypt("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); Assert.AreEqual("MHHKTNIROWJNYMNWKHMVEZQHWU", cypher); machine.ResetRotors(); cypher = machine.Encrypt("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); Assert.AreEqual("MHHKTNIROWJNYMNWKHMVEZQHWU", cypher); machine.ResetRotors(); cypher = machine.Encrypt("MHHKTNIROWJNYMNWKHMVEZQHWU"); Assert.AreEqual("ABCDEFGHIJKLMNOPQRSTUVWXYZ", cypher); }