Beispiel #1
0
        public void TurnOver_RotorsMustRotateCorrectlyBasedOnTurnOverNotchWithStartedOutterConfiguration(char slowRotorSetting, char middleRotorSetting, char fastRotorSetting, string inputText, string expectedOutputText)
        {
            //Arrange
            IEnigma enigma = new EnigmaI();

            enigma.ConfigureOutterRingSetting(slowRotorSetting, middleRotorSetting, fastRotorSetting);

            //Act
            string calculatedOutputText = string.Empty;

            for (var i = 0; i < inputText.Length; i++)
            {
                calculatedOutputText += enigma.Write(inputText[i]);
            }

            //Assert
            Assert.Equal(expectedOutputText, calculatedOutputText);
        }
Beispiel #2
0
        public void AnotherRotorOrder_Rotors_VI_VII_VIII_MustConvertCorrectly(string inputText, string expectedOutputText)
        {
            //Arrange
            IEnigma enigma = new EnigmaI(new RotorVI(), new RotorVII(), new RotorVIII(), new ReflectorB());

            enigma.ConfigureOutterRingSetting('A', 'L', 'M');

            //Act
            string calculatedOutputText = string.Empty;

            for (var i = 0; i < inputText.Length; i++)
            {
                calculatedOutputText += enigma.Write(inputText[i]);
            }

            //Assert
            Assert.Equal(expectedOutputText, calculatedOutputText);
        }