public void Format_NonEmptySequenceToken_IsFormattedAsArray() { var output = new StringWriter(); var formater = new JsonPropertyFormatter(output); var token = new SequenceToken(new[] { new ScalarToken(1), new ScalarToken("foo") }); token.Render(formater); Assert.Equal("[1, \"foo\"]", output.ToString()); }
public void Format_EmptySequenceToken_IsFormattedAsArray() { var output = new StringWriter(); var formater = new JsonPropertyFormatter(output); var token = new SequenceToken(null); token.Render(formater); Assert.Equal("[]", output.ToString()); }
public void Render_SomeFormatter_FormatterIsCalled() { var formatterMock = new Mock <IPropertyFormatter>(); var formatter = formatterMock.Object; var sequence = new SequenceToken(null); sequence.Render(formatter); formatterMock.Verify(m => m.Format(sequence), Times.Once); }
public void Render_NullFormatter_ThrowsArgumentNullException() { var sequence = new SequenceToken(null); Assert.Throws <ArgumentNullException>(() => sequence.Render(null)); }