public void When_HasSingleCommentToken() { var section = new ConfigIniSection(); var token1 = new CommentToken(new[] { "; Hey", ";Whats", " ;Up?" }, LineEnding.None); section.Tokens.Add(token1); section.MergeConsecutiveTokens(); Assert.That(section.Tokens, Has.Count.EqualTo(1)); Assert.That(section.Tokens[0], Is.SameAs(token1)); Assert.That(token1.GetStringLines(), Is.EquivalentTo(new[] { "; Hey", ";Whats", " ;Up?" })); }
public void When_Has3NonConsecutiveTokens() { var section = new ConfigIniSection(); var token1 = new CommentToken(new[] { "; Hey", ";Whats", " ;Up?" }, LineEnding.None); var token2 = new WhitespaceToken(new[] { " ", "\t", "" }, LineEnding.None); var token3 = new CommentToken(new[] { ";Baz" }, LineEnding.None); section.Tokens.Add(token1); section.Tokens.Add(token2); section.Tokens.Add(token3); section.MergeConsecutiveTokens(); Assert.That(section.Tokens, Has.Count.EqualTo(3)); Assert.That(section.Tokens[0], Is.SameAs(token1)); Assert.That(section.Tokens[1], Is.SameAs(token2)); Assert.That(section.Tokens[2], Is.SameAs(token3)); Assert.That(token1.GetStringLines(), Is.EquivalentTo(new[] { "; Hey", ";Whats", " ;Up?" })); Assert.That(token2.GetStringLines(), Is.EquivalentTo(new[] { " ", "\t", "" })); Assert.That(token3.GetStringLines(), Is.EquivalentTo(new[] { ";Baz" })); }