public void Pop_NullString_ReturnsNullChar() { using (var scanner = new ListStream <char>(null)) { Assert.Equal('\0', scanner.Pop()); } }
public void Pop_NullString_ReturnsEmptySequence() { using (var scanner = new ListStream <char>(null)) { var buffer = new StringBuilder(); while (!scanner.IsCompleted) { buffer.Append(scanner.Pop()); } Assert.Equal(String.Empty, buffer.ToString()); } }
public void Peek_LongString_ReturnsSameAsPop() { const string input = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; using (var scanner = new ListStream <char>(input.ToCharArray())) { while (!scanner.IsCompleted) { char ch = scanner.Peek(); Assert.Equal(scanner.Pop(), ch); } Assert.Equal(true, scanner.IsCompleted); } }
public void Pop_UnicodeString_ReturnsSameSequence() { const string input = "私が日本語を話すことはありません。"; using (var scanner = new ListStream <char>(input.ToCharArray())) { var buffer = new StringBuilder(); while (!scanner.IsCompleted) { buffer.Append(scanner.Pop()); } Assert.Equal(input, buffer.ToString()); } }
public void Pop_LongString_ReturnsSameSequence() { const string input = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; using (var scanner = new ListStream <char>(input.ToCharArray())) { var buffer = new StringBuilder(); while (!scanner.IsCompleted) { buffer.Append(scanner.Pop()); } Assert.Equal(input, buffer.ToString()); } }
public void Pop_EmptyString_ReturnsEmptySequence() { const string input = ""; using (var scanner = new ListStream <char>(input.ToCharArray())) { var buffer = new StringBuilder(); while (!scanner.IsCompleted) { buffer.Append(scanner.Pop()); } Assert.Equal(input, buffer.ToString()); } }
public void Pop_EscapedSequence_ReturnsSameSequence() { const string input = @"""\\\b\f\n\r\t\u0123\u4567\u89AB\uCDEF\uabcd\uef4A\"""""; using (var scanner = new ListStream <char>(input.ToCharArray())) { var buffer = new StringBuilder(); while (!scanner.IsCompleted) { buffer.Append(scanner.Pop()); scanner.Peek(); } Assert.Equal(input, buffer.ToString()); } }