Beispiel #1
0
 public TextIO(TextReader input, TextWriter output)
 {
     _input             = input ?? throw new ArgumentNullException(nameof(input));
     _output            = output ?? throw new ArgumentNullException(nameof(output));
     _stringTokenReader = TokenReader.ForStrings(this);
     _numberTokenReader = TokenReader.ForNumbers(this);
 }
Beispiel #2
0
    public void ReadTokens_Numeric_ReadingValuesHasExpectedPromptsAndResults(
        string prompt,
        uint tokenCount,
        string input,
        string expectedOutput,
        float[] expectedResult)
    {
        var sut = TokenReader.ForNumbers(new TextIO(new StringReader(input + NewLine), _outputWriter));

        var result = sut.ReadTokens(prompt, tokenCount);
        var output = _outputWriter.ToString();

        using var _ = new AssertionScope();
        output.Should().Be(expectedOutput);
        result.Select(t => t.Number).Should().BeEquivalentTo(expectedResult);
    }