mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-09-20 03:17:57 +08:00
55 lines
1.3 KiB
C#
55 lines
1.3 KiB
C#
namespace UglyToad.PdfPig.Tests.Tokenization.Tokens
|
|
{
|
|
using System;
|
|
using PdfPig.Tokenization.Tokens;
|
|
using Xunit;
|
|
|
|
public class ArrayTokenTests
|
|
{
|
|
[Fact]
|
|
public void SetsData()
|
|
{
|
|
var token = new ArrayToken(new[]
|
|
{
|
|
OperatorToken.StartStream,
|
|
OperatorToken.EndStream
|
|
});
|
|
|
|
Assert.Equal(2, token.Data.Count);
|
|
|
|
Assert.Equal(OperatorToken.StartStream, token.Data[0]);
|
|
Assert.Equal(OperatorToken.EndStream, token.Data[1]);
|
|
}
|
|
|
|
[Fact]
|
|
public void SetsDataEmpty()
|
|
{
|
|
var token = new ArrayToken(new IToken[0]);
|
|
|
|
Assert.Empty(token.Data);
|
|
}
|
|
|
|
[Fact]
|
|
public void SetsDataNullThrows()
|
|
{
|
|
// ReSharper disable once ObjectCreationAsStatement
|
|
Action action = () => new ArrayToken(null);
|
|
|
|
Assert.Throws<ArgumentNullException>(action);
|
|
}
|
|
|
|
[Fact]
|
|
public void ToStringCorrect()
|
|
{
|
|
var token = new ArrayToken(new IToken[]
|
|
{
|
|
new StringToken("hedgehog"),
|
|
new NumericToken(7),
|
|
OperatorToken.StartObject
|
|
});
|
|
|
|
Assert.Equal("[ (hedgehog), 7, obj ]", token.ToString());
|
|
}
|
|
}
|
|
}
|