public void Array_row_is_correct(string alphabet, int rowIndex, string expected) { var sut = new AlphabetCipher(alphabet); var results = sut.GetSubstitutionArray().ToArray(); var result = results[rowIndex]; Assert.Equal(expected, result); }
public void Creates_array_with_correct_counts(string alphabet, int expected) { var sut = new AlphabetCipher(alphabet); var results = sut.GetSubstitutionArray().ToList(); Assert.Equal(expected, results.Count()); foreach (var result in results) { Assert.Equal(expected, result.Length); } }
public void Does_correct_substitution( string alphabet, char keyChar, char expected, char inputChar ) { var sut = new AlphabetCipher(alphabet); var result = sut.Decode(inputChar, keyChar); Assert.Equal(expected, result); }
public void Should_encode_message_with_given_keyword() { // Arrange const string expected = "egsgqwtahuiljgs"; var sut = new AlphabetCipher("scones"); // Act var actual = sut.Encode("meetmebythetree"); // Assert Assert.AreEqual(expected, actual); }
static int Main(string[] args) { if (args.Count() < 2) { Console.WriteLine("Usage: decode key input"); return(1); } var key = args[0].ToLower(); var input = args[1].ToLower(); var cipher = new AlphabetCipher(); Console.WriteLine(cipher.Decode(input, key)); return(0); }