Exemple #1
0
    public async Task Stream_ReadLinesAsync(string response, params string[] expected)
    {
        // Arrange
        var bytes = Encoding.UTF8.GetBytes(response);

        await using var stream = new MemoryStream(bytes);

        // Act
        var actual = await IOExtensions.ReadLinesAsync(stream).Take(expected.Length).ToListAsync();

        // Assert
        Assert.Equal(expected.Length, actual.Count);
        Assert.Equal(expected, actual);
    }