public void Clear_DeletesAllItems() { // Arrange var content = new BufferedHtmlContent(); content.Append(new TestHtmlContent("hello")); content.Append("Test"); // Act content.Clear(); // Assert Assert.Equal(0, content.Entries.Count); }
public void CanAppendMultipleItems() { // Arrange var content = new BufferedHtmlContent(); // Act content.Append(new TestHtmlContent("hello")); content.Append("Test"); // Assert Assert.Equal(2, content.Entries.Count); Assert.Equal("Written from TestHtmlContent: hello", content.Entries[0].ToString()); Assert.Equal("Test", content.Entries[1]); }
public void WriteTo_WritesAllItems() { // Arrange var content = new BufferedHtmlContent(); var writer = new StringWriter(); content.Append(new TestHtmlContent("Hello")); content.Append("Test"); // Act content.WriteTo(writer, new CommonTestEncoder()); // Assert Assert.Equal(2, content.Entries.Count); Assert.Equal("Written from TestHtmlContent: HelloHtmlEncode[[Test]]", writer.ToString()); }
public void AppendString_AppendsAString() { // Arrange var content = new BufferedHtmlContent(); // Act content.Append("Hello"); // Assert var result = Assert.Single(content.Entries); Assert.IsType<string>(result); }
public void AppendString_AppendsAString() { // Arrange var content = new BufferedHtmlContent(); // Act content.Append("Hello"); // Assert var result = Assert.Single(content.Entries); Assert.IsType <string>(result); }
public void AppendString_WrittenAsEncoded() { // Arrange var content = new BufferedHtmlContent(); content.Append("Hello"); var writer = new StringWriter(); // Act content.WriteTo(writer, new CommonTestEncoder()); // Assert Assert.Equal("HtmlEncode[[Hello]]", writer.ToString()); }
public void AppendIHtmlContent_AppendsAsIs() { // Arrange var content = new BufferedHtmlContent(); var writer = new StringWriter(); // Act content.Append(new TestHtmlContent("Hello")); // Assert var result = Assert.Single(content.Entries); var testHtmlContent = Assert.IsType<TestHtmlContent>(result); testHtmlContent.WriteTo(writer, new CommonTestEncoder()); Assert.Equal("Written from TestHtmlContent: Hello", writer.ToString()); }
public void AppendIHtmlContent_AppendsAsIs() { // Arrange var content = new BufferedHtmlContent(); var writer = new StringWriter(); // Act content.Append(new TestHtmlContent("Hello")); // Assert var result = Assert.Single(content.Entries); var testHtmlContent = Assert.IsType <TestHtmlContent>(result); testHtmlContent.WriteTo(writer, new CommonTestEncoder()); Assert.Equal("Written from TestHtmlContent: Hello", writer.ToString()); }