public void CheckEntryWheelGivesCorrectInputValue() { EntryWheel e = new EntryWheel(LetterMapper.CreateLettersArray("QWERTZUIOASDFGHJKPYXCVBNML")); Letters result = e.GetInput(Letters.A); Assert.That(result, Is.EqualTo(Letters.Q)); }
public virtual Letters GetOutput(Letters input) { // rotate if required bool stepM = m_rotorR.InNotch; bool stepML = m_rotorM.InNotch; // left rotor always moves one step m_rotorR.Rotate(); // moving from left notch moves middle rotor on a step if (stepM) { m_rotorM.Rotate(); } // moving from middle notch moves middle and left rotor on a step (middle does a double step) if (stepML) { // double step middle rotor m_rotorM.Rotate(); m_rotorL.Rotate(); } // run through entry wheel input = m_entryWheel.GetInput(input); // right to left Letters rotorRleft = m_rotorR.GetLeft(input); Letters rotorMLeft = m_rotorM.GetLeft(rotorRleft); Letters rotorLLeft = m_rotorL.GetLeft(rotorMLeft); Letters rotorALeft = m_additionalRotor.GetLeft(rotorLLeft); // reflector rotorALeft = m_reflector.GetOutput(rotorALeft); // left to right rotorLLeft = m_additionalRotor.GetRight(rotorALeft); rotorMLeft = m_rotorL.GetRight(rotorLLeft); rotorRleft = m_rotorM.GetRight(rotorMLeft); Letters output = m_rotorR.GetRight(rotorRleft); // run through entry wheel output = m_entryWheel.GetOutput(output); return(output); }