public void TurnOver_RotorsMustRotateCorrectlyBasedOnTurnOverNotch(string inputText, string expectedOutputText) { //Arrange IEnigma enigma = new EnigmaI(); //Act string calculatedOutputText = string.Empty; for (var i = 0; i < inputText.Length; i++) { calculatedOutputText += enigma.Write(inputText[i]); } //Assert Assert.Equal(expectedOutputText, calculatedOutputText); }
public void DecryptSentence_II_I_III_MustBeAValidDecrypt(string inputText, string expectedOutputText) { //Arrange IEnigma enigma = new EnigmaI(new RotorII(), new RotorI(), new RotorIII(), new ReflectorB()); //Act string calculatedOutputText = string.Empty; for (var i = 0; i < inputText.Length; i++) { calculatedOutputText += enigma.Write(inputText[i]); } //Assert Assert.Equal(expectedOutputText, calculatedOutputText); }
public void AnotherRotorOrder_Rotors_I_III_II_MustConvertCorrectly(string inputText, string expectedOutputText) { //Arrange IEnigma enigma = new EnigmaI(new RotorI(), new RotorIII(), new RotorII(), new ReflectorB()); //Act string calculatedOutputText = string.Empty; for (var i = 0; i < inputText.Length; i++) { calculatedOutputText += enigma.Write(inputText[i]); } //Assert Assert.Equal(expectedOutputText, calculatedOutputText); }
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); }
public void PlugBoardConfigurationMustHaveValidConversion(string plugBoardJumpers, string inputText, string expectedOutputText) { //Arrange IEnigma enigma = new EnigmaI(); enigma.ConfigurePlugBoard(plugBoardJumpers); //Act string calculatedOutputText = string.Empty; for (var i = 0; i < inputText.Length; i++) { calculatedOutputText += enigma.Write(inputText[i]); } //Assert Assert.Equal(expectedOutputText, calculatedOutputText); }