public void Count_GetsNumberOfItemsInBufffer() { WktTokensBuffer target = new WktTokensBuffer(); target.Add(_testData); Assert.Equal(_testData.Length, target.Count); }
public void GetToken_IgnoreWhitespace_ReturnsWhitespaceIfIgnoreWhitespaceIsFalseAndNextTokenIsWhitespace() { WktToken whitespaceToken = new WktToken() { Type = TokenType.WHITESPACE, Value = " " }; WktTokensBuffer target = new WktTokensBuffer(); target.Add(whitespaceToken); target.Add(_testData[0]); var result = target.GetToken(false); Assert.Equal(whitespaceToken, result); Assert.Equal(1, target.Count); }
public void Add_WktToken_AddsItemToTheCollection() { WktTokensBuffer target = new WktTokensBuffer(); target.Add(_testData[0]); Assert.Equal(1, target.Count()); Assert.Contains(_testData[0], target); }
public void Add_WktToken_AddsItemToTheCollection() { WktTokensBuffer target = new WktTokensBuffer(); target.Add(_testData[0]); Assert.Single(target); Assert.Contains(_testData[0], target); }
public void Clear_RemovesAllItemsFromCollection() { WktTokensBuffer target = new WktTokensBuffer(); target.Add(_testData); target.Clear(); Assert.Empty(target); }
public void GetToken_IgnoreWhitespace_IgnoresWhitespacesBeforeTokenIfIgnoreTokenIsTrue() { WktTokensBuffer target = new WktTokensBuffer(); target.Add(new WktToken() { Type = TokenType.WHITESPACE, Value = " " }); target.Add(new WktToken() { Type = TokenType.WHITESPACE, Value = " " }); target.Add(_testData[0]); var result = target.GetToken(true); Assert.Equal(_testData[0], result); Assert.Equal(0, target.Count); }
public void GetToken_IgnoreWhitespace_GetsNextTokenFromBufferAndRemoveIt() { WktTokensBuffer target = new WktTokensBuffer(); target.Add(_testData[0]); var result = target.GetToken(false); Assert.Equal(_testData[0], result); Assert.DoesNotContain(_testData[0], target); }
public void Add_IEnumerable_AddsItemsToTheCollection() { WktTokensBuffer target = new WktTokensBuffer(); target.Add(_testData); Assert.Equal(_testData.Length, target.Count()); for (int i = 0; i < _testData.Length; i++) { Assert.Equal(_testData[i], target.ToArray()[i]); } }
public void Peek_IgnoreWhitespace_GetsNextTokenFromBufferAndLeavesItThere() { WktTokensBuffer target = new WktTokensBuffer(); target.Add(_testData[0]); var result = target.Peek(false); Assert.Equal(_testData[0], result); Assert.Contains(_testData[0], target); }
public void Peek_IgnoreWhitespace_ReturnsEndOfDataTokenIfOnlyWhitespaceTokensAreAvailalbleAndIgnoreWhitespaceIsTrue() { WktToken whitespaceToken = new WktToken() { Type = TokenType.WHITESPACE, Value = " " }; WktTokensBuffer target = new WktTokensBuffer(); target.Add(whitespaceToken); var result = target.Peek(true); Assert.Equal(WktToken.EndOfDataToken, result); }
public void Peek_IgnoreWhitespace_ReturnsWhitespaceIfIgnoreWhitespaceIsFalseAndNextTokenIsWhitespace() { WktToken whitespaceToken = new WktToken() { Type = TokenType.WHITESPACE, Value = " " }; WktTokensBuffer target = new WktTokensBuffer(); target.Add(whitespaceToken); target.Add(_testData[0]); var result = target.Peek(false); Assert.Equal(whitespaceToken, result); Assert.Equal(2, target.Count); }