40 lines
849 B
C#
40 lines
849 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Xunit;
|
|
using Shouldly;
|
|
using DotnetStreams;
|
|
|
|
namespace DotnetStreamsTests
|
|
{
|
|
public class ListTextSourceTests
|
|
{
|
|
[Fact]
|
|
public void ReadsFromList()
|
|
{
|
|
ITextSource reader = new ListTextSource(new[] { "1", "2", "", "3" });
|
|
string s0 = reader.Read();
|
|
s0.ShouldNotBeNull();
|
|
s0.ShouldBe("1");
|
|
reader.Eof().ShouldBe(false);
|
|
|
|
string s1 = reader.Read();
|
|
s1.ShouldNotBeNull();
|
|
s1.ShouldBe("2");
|
|
reader.Eof().ShouldBe(false);
|
|
|
|
string s2 = reader.Read();
|
|
s2.ShouldNotBeNull();
|
|
s2.ShouldBe(string.Empty);
|
|
reader.Eof().ShouldBe(false);
|
|
|
|
string s3 = reader.Read();
|
|
s3.ShouldNotBeNull();
|
|
s3.ShouldBe("3");
|
|
reader.Eof().ShouldBe(true);
|
|
}
|
|
}
|
|
}
|