public void Fb2Element_AddContent_Works(Fb2Element fb2Element) { if (fb2Element is EmptyLine || fb2Element is SequenceInfo) { return; } fb2Element = fb2Element.AddContent("test content 1", " "); // 3 whitespaces fb2Element.Content.Should().Be(" test content 1"); fb2Element.ClearContent(); fb2Element.AddContent("test content 1"); // no separator fb2Element.Content.Should().Be("test content 1"); fb2Element.AddContent("test content 2", " "); fb2Element.Content.Should().Be("test content 1 test content 2"); fb2Element.AddContent("test content 3"); // no separator fb2Element.Content.Should().Be("test content 1 test content 2test content 3"); fb2Element.AddContent(() => $"test {Environment.NewLine} content 4", " _blah_ "); fb2Element .Content .Should() .Be("test content 1 test content 2test content 3 _blah_ test content 4"); fb2Element.AddContent(() => $"test {Environment.NewLine} content 5", " _blah_ "); fb2Element .Content .Should() .Be("test content 1 test content 2test content 3 _blah_ test content 4 _blah_ test content 5"); }
public void Fb2Element_AddContent_EscapesSeparator(Fb2Element fb2Element) { if (fb2Element is EmptyLine || fb2Element is SequenceInfo) { return; } fb2Element.AddContent("test Value content 1", "<sep/> "); fb2Element.Content.Should().Be("<sep/> test Value content 1"); fb2Element.ClearContent(); fb2Element.Content.Should().BeEmpty(); fb2Element.AddContent("testContent", @"<""sep&tv'2""> "); fb2Element.Content.Should().Be("<"sep&tv'2"> testContent"); fb2Element.ClearContent(); fb2Element.Content.Should().BeEmpty(); fb2Element.AddContent("test content", $"<test Value{Environment.NewLine}content 1 "); fb2Element.Content.Should().Be("<test Value content 1 test content"); }
public void Fb2Element_AddContent_EscapesValue(Fb2Element fb2Element) { if (fb2Element is EmptyLine || fb2Element is SequenceInfo) { return; } fb2Element.AddContent("<test Value content 1"); fb2Element.Content.Should().Be("<test Value content 1"); fb2Element.ClearContent(); fb2Element.Content.Should().BeEmpty(); fb2Element.AddContent(@"<""testValue&tv'2"">"); fb2Element.Content.Should().Be("<"testValue&tv'2">"); fb2Element.ClearContent(); fb2Element.Content.Should().BeEmpty(); fb2Element.AddContent($"<test Value{Environment.NewLine}content 1"); fb2Element.Content.Should().Be("<test Value content 1"); }