public void ShiftAlphabetTest() { Action act = () => Decoder.DecodeAlphabet(-1); act.Should().Throw <InvalidOperationException>() .WithMessage("Shift must be greater or equal 0"); var shiftedAlphabet = Decoder.DecodeAlphabet(23); shiftedAlphabet.Length.Should().Be(26); shiftedAlphabet[0].Should().Be('X'); shiftedAlphabet[1].Should().Be('Y'); shiftedAlphabet[2].Should().Be('Z'); shiftedAlphabet[25].Should().Be('W'); }
public void DecodeAlphabetTest() { Action act = () => Decoder.DecodeAlphabet(-1); act.Should().Throw <InvalidOperationException>() .WithMessage("Shift must be greater or equal 0"); var decodedAlphabet = Decoder.DecodeAlphabet(23); decodedAlphabet.Length.Should().Be(26); decodedAlphabet[0].Should().Be('X'); decodedAlphabet[1].Should().Be('Y'); decodedAlphabet[2].Should().Be('Z'); decodedAlphabet[3].Should().Be('A'); decodedAlphabet[4].Should().Be('B'); decodedAlphabet[5].Should().Be('C'); decodedAlphabet[25].Should().Be('W'); Array.IndexOf(decodedAlphabet, 'Q').Should() .Be(Decoder.Alphabet.IndexOf('T')); decodedAlphabet.Contains(Char.ToUpper('q')).Should().BeTrue(); }