public void OnContextAcquired() { // arrange var output = new StringBuilderTextileFormatter(); output.Begin(); var fnfs = new FootNoteFormatterState(new TextileFormatter(output)); fnfs.m_tag = "fn42"; // act fnfs.OnContextAcquired(); // assert Assert.AreEqual(42, fnfs.m_noteID); }
public void Enter() { // arrange var output = new StringBuilderTextileFormatter(); output.Begin(); var fnfs = new FootNoteFormatterState(new TextileFormatter(output)); fnfs.m_noteID = 1; fnfs.m_alignNfo = String.Empty; fnfs.m_attNfo = "{color:red}"; // act fnfs.Enter(); // assert Assert.AreEqual("<p id=\"fn1\" style=\"color:red;\"><sup>1</sup> ", output.GetFormattedText()); }
public void OnContextAcquired() { // arrange var output = new StringBuilderTextileFormatter (); output.Begin(); var fnfs = new FootNoteFormatterState(new TextileFormatter(output)); var expression = SimpleBlockFormatterState.PatternBegin + @"fn[0-9]+" + SimpleBlockFormatterState.PatternEnd; var input = "fn1{color:red}. This is the footnote"; Match m = Regex.Match(input, expression); fnfs.Consume (input, m); // act // do nothing, since Consume() already caused OnContextAcquired() to be called // assert Assert.AreEqual(1, fnfs.m_noteID); }
public void EnterAndOnContextAcquired() { // arrange var output = new StringBuilderTextileFormatter(); output.Begin(); var fnfs = new FootNoteFormatterState(new TextileFormatter(output)); var expression = SimpleBlockFormatterState.PatternBegin + @"fn[0-9]+" + SimpleBlockFormatterState.PatternEnd; var input = "fn1{color:red}. This is the footnote"; Match m = Regex.Match(input, expression); fnfs.Consume(input, m); // act // do nothing, since Consume() already caused OnContextAcquired() and Enter() to be called // assert Assert.AreEqual("<p id=\"fn1\" style=\"color:red;\"><sup>1</sup> ", output.GetFormattedText()); }