public void GivenASingleIllegalValueShouldThrowArgumentOutOfRangeException() { var input = new[] { '!' }; // Call ToArray() to force evaluation of the enumerable, // as the underlying implementation is lazy. Assert.Throws<ArgumentOutOfRangeException>(() => input.DecodeToQuintets().ToArray()); }
public void GivenASingleLegalValueShouldReturnASingleDecodedValue() { var values = Constants.EncodingAlphabet.ToArray(); for (byte i = 0; i < values.Length; i++) { var input = new[] { values[i] }; var expected = new[] { i }; var actual = input.DecodeToQuintets(); CollectionAssert.AreEqual(expected, actual); } }
public void GivenANumberOfLegalValuesAndAtLeastOneIllegalValueShouldThrowArgumentOutOfRangeException() { var input = new[] { '2', 'o', 'z', '!', 'o' }; var actual = input.DecodeToQuintets(); Assert.Throws<ArgumentOutOfRangeException>(() => actual.ToArray()); }