You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
103 lines
2.5 KiB
103 lines
2.5 KiB
// <file> |
|
// <copyright see="prj:///doc/copyright.txt"/> |
|
// <license see="prj:///doc/license.txt"/> |
|
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/> |
|
// <version>$Revision$</version> |
|
// </file> |
|
|
|
using System; |
|
using System.Collections.Generic; |
|
|
|
using ICSharpCode.Core; |
|
using ICSharpCode.SharpDevelop; |
|
using ICSharpCode.SharpDevelop.Dom; |
|
using ICSharpCode.SharpDevelop.Project; |
|
using ICSharpCode.XmlEditor; |
|
using NUnit.Framework; |
|
using XmlEditor.Tests.Utils; |
|
|
|
namespace XmlEditor.Tests.Folding |
|
{ |
|
[TestFixture] |
|
public class AttributeTextInFoldIsXmlEncodedTestFixture |
|
{ |
|
XmlFoldParser parser; |
|
ICompilationUnit unit; |
|
DefaultXmlFileExtensions extensions; |
|
DefaultProjectContent projectContent; |
|
MockTextBuffer textBuffer; |
|
XmlEditorOptions options; |
|
|
|
[SetUp] |
|
public void Init() |
|
{ |
|
projectContent = new DefaultProjectContent(); |
|
extensions = new DefaultXmlFileExtensions(null); |
|
options = new XmlEditorOptions(new Properties()); |
|
parser = new XmlFoldParser(extensions, options); |
|
} |
|
|
|
void ParseWithShowAttributesSetToTrue(string xml) |
|
{ |
|
options.ShowAttributesWhenFolded = true; |
|
|
|
textBuffer = new MockTextBuffer(xml); |
|
unit = parser.Parse(projectContent, @"d:\projects\a.xml", textBuffer); |
|
} |
|
|
|
[Test] |
|
public void FoldAttributeTextHasSingleQuoteEncoded() |
|
{ |
|
string xml = |
|
"<root a='Single ' Quote'>\r\n" + |
|
"</root>"; |
|
ParseWithShowAttributesSetToTrue(xml); |
|
|
|
Assert.AreEqual("<root a='Single ' Quote'>", unit.FoldingRegions[0].Name); |
|
} |
|
|
|
[Test] |
|
public void FoldAttributeTextHasDoubleQuoteEncoded() |
|
{ |
|
string xml = |
|
"<root a=\"Double " Quote\">\r\n" + |
|
"</root>"; |
|
ParseWithShowAttributesSetToTrue(xml); |
|
|
|
Assert.AreEqual("<root a=\"Double " Quote\">", unit.FoldingRegions[0].Name); |
|
} |
|
|
|
[Test] |
|
public void FoldAttributeTextHasAmpersandEncoded() |
|
{ |
|
string xml = |
|
"<root a='Ampersand &'>\r\n" + |
|
"</root>"; |
|
ParseWithShowAttributesSetToTrue(xml); |
|
|
|
Assert.AreEqual("<root a='Ampersand &'>", unit.FoldingRegions[0].Name); |
|
} |
|
|
|
[Test] |
|
public void FoldAttributeTextHasLessThanTagEncoded() |
|
{ |
|
string xml = |
|
"<root a='<'>\r\n" + |
|
"</root>"; |
|
ParseWithShowAttributesSetToTrue(xml); |
|
|
|
Assert.AreEqual("<root a='<'>", unit.FoldingRegions[0].Name); |
|
} |
|
|
|
[Test] |
|
public void FoldAttributeTextHasGreaterThanTagEncoded() |
|
{ |
|
string xml = |
|
"<root a='>'>\r\n" + |
|
"</root>"; |
|
ParseWithShowAttributesSetToTrue(xml); |
|
|
|
Assert.AreEqual("<root a='>'>", unit.FoldingRegions[0].Name); |
|
} |
|
} |
|
}
|
|
|