Example #1
0
        public void ConfigureRingSettings_MustResetBeforeReconfigureInChainedConfigurations()
        {
            //Arrange
            char         firstInnerRingSetting  = 'B';
            string       firstExpectedSequence  = "KFLNGMHERWAOUPXZIYVTQBJCSD";
            char         secondInnerRingSetting = 'C';
            string       secondExpectedSequence = "ELGMOHNIFSXBPVQYAJZWURCKDT";
            IRotorEngine rotorEngine            = new RotorEngine(DEFAULT_RINGSETTINGS, DEFAULT_SEQUENCE, DEFAULT_WIREDSEQUENCE, DEFAULT_TURNOVER_NOTCH);

            //Act
            rotorEngine.ConfigureInnerRingSetting(firstInnerRingSetting);
            var firstCalculatedSequence = rotorEngine.WiredSequence;

            rotorEngine.ConfigureInnerRingSetting(secondInnerRingSetting);
            var secondCalculatedSequence = rotorEngine.WiredSequence;

            //Assert
            Assert.Equal(firstCalculatedSequence, firstExpectedSequence);
            Assert.Equal(secondCalculatedSequence, secondExpectedSequence);
        }
Example #2
0
        public void ConfigureRingSettings_LowerCaseCharMustbeValid(char innerRingSettingCharacter, string expectedSequence)
        {
            //Arrange
            IRotorEngine rotorEngine = new RotorEngine(DEFAULT_RINGSETTINGS, DEFAULT_SEQUENCE, DEFAULT_WIREDSEQUENCE, DEFAULT_TURNOVER_NOTCH);

            //Act
            rotorEngine.ConfigureInnerRingSetting(innerRingSettingCharacter);
            var calculatedSequence = rotorEngine.WiredSequence;

            //Assert
            Assert.Equal(calculatedSequence, expectedSequence);
        }