Fix decoder tests
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
8403fd8d0f
commit
e2d93c593c
|
@ -60,7 +60,7 @@ namespace IrcTokens
|
||||||
_buffer = _buffer == null ? Array.Empty<byte>() : _buffer.Concat(data.Take(bytesReceived)).ToArray();
|
_buffer = _buffer == null ? Array.Empty<byte>() : _buffer.Concat(data.Take(bytesReceived)).ToArray();
|
||||||
|
|
||||||
var listLines = _buffer.Split((byte) '\n').Select(l => l.Trim((byte) '\r')).ToList();
|
var listLines = _buffer.Split((byte) '\n').Select(l => l.Trim((byte) '\r')).ToList();
|
||||||
_buffer = listLines.Last();
|
_buffer = listLines.LastOrDefault() ?? Array.Empty<byte>();
|
||||||
|
|
||||||
var decodeLines = new List<Line>();
|
var decodeLines = new List<Line>();
|
||||||
foreach (var line in listLines.SkipLast(1).Select(l => l.ToArray()))
|
foreach (var line in listLines.SkipLast(1).Select(l => l.ToArray()))
|
||||||
|
|
|
@ -66,7 +66,7 @@ namespace IrcTokens.Tests
|
||||||
public void TestEmpty()
|
public void TestEmpty()
|
||||||
{
|
{
|
||||||
var lines = _decoder.Push(string.Empty);
|
var lines = _decoder.Push(string.Empty);
|
||||||
Assert.IsNull(lines);
|
Assert.AreEqual(0, lines.Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
@ -74,7 +74,7 @@ namespace IrcTokens.Tests
|
||||||
{
|
{
|
||||||
_decoder.Push("PRIVMSG #channel hello");
|
_decoder.Push("PRIVMSG #channel hello");
|
||||||
var lines = _decoder.Push(string.Empty);
|
var lines = _decoder.Push(string.Empty);
|
||||||
Assert.IsNull(lines);
|
Assert.AreEqual(0, lines.Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
|
Loading…
Reference in New Issue