本文整理汇总了C#中CoreXml.Test.XLinq.EventsHelper.Verify方法的典型用法代码示例。如果您正苦于以下问题:C# EventsHelper.Verify方法的具体用法?C# EventsHelper.Verify怎么用?C# EventsHelper.Verify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CoreXml.Test.XLinq.EventsHelper
的用法示例。
在下文中一共展示了EventsHelper.Verify方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DocTypeVariation
//[Variation(Priority = 0, Desc = "XDocumentType - Name")]
public void DocTypeVariation()
{
XDocumentType toChange = new XDocumentType("root", "", "", "");
XDocumentType original = new XDocumentType(toChange);
using (EventsHelper eHelper = new EventsHelper(toChange))
{
toChange.Name = "newName";
TestLog.Compare(toChange.Name.Equals("newName"), "Name did not change");
eHelper.Verify(XObjectChange.Name, toChange);
}
}
示例2: PIVariation
//[Variation(Priority = 0, Desc = "XProcessingInstruction - Name")]
public void PIVariation()
{
XProcessingInstruction toChange = new XProcessingInstruction("target", "data");
XProcessingInstruction original = new XProcessingInstruction(toChange);
using (UndoManager undo = new UndoManager(toChange))
{
undo.Group();
using (EventsHelper eHelper = new EventsHelper(toChange))
{
toChange.Target = "newTarget";
TestLog.Compare(toChange.Target.Equals("newTarget"), "Name did not change");
eHelper.Verify(XObjectChange.Name, toChange);
}
undo.Undo();
TestLog.Compare(XNode.DeepEquals(toChange, original), "Undo did not work");
}
}
示例3: ExecuteXDocumentVariation
public void ExecuteXDocumentVariation()
{
XNode toReplace = Variation.Params[0] as XNode;
XNode newValue = Variation.Params[1] as XNode;
XDocument xDoc = new XDocument(toReplace);
XDocument xDocOriginal = new XDocument(xDoc);
using (UndoManager undo = new UndoManager(xDoc))
{
undo.Group();
using (EventsHelper docHelper = new EventsHelper(xDoc))
{
toReplace.ReplaceWith(newValue);
docHelper.Verify(new XObjectChange[] { XObjectChange.Remove, XObjectChange.Add }, new XObject[] { toReplace, newValue });
}
undo.Undo();
TestLog.Compare(XNode.DeepEquals(xDoc, xDocOriginal), "Undo did not work!");
}
}
示例4: ExecuteXDocumentVariation
public void ExecuteXDocumentVariation()
{
XNode[] content = Variation.Params[0] as XNode[];
int index = (int)Variation.Params[1];
XDocument xDoc = new XDocument(content);
XDocument xDocOriginal = new XDocument(xDoc);
XNode toRemove = xDoc.Nodes().ElementAt(index);
using (UndoManager undo = new UndoManager(xDoc))
{
undo.Group();
using (EventsHelper docHelper = new EventsHelper(xDoc))
{
toRemove.Remove();
docHelper.Verify(XObjectChange.Remove, toRemove);
}
undo.Undo();
TestLog.Compare(XNode.DeepEquals(xDoc, xDocOriginal), "Undo did not work!");
}
}
示例5: ExecuteXElementVariation
public void ExecuteXElementVariation()
{
XElement toChange = Variation.Params[0] as XElement;
XName newName = (XName)Variation.Params[1];
XElement original = new XElement(toChange);
using (UndoManager undo = new UndoManager(toChange))
{
undo.Group();
using (EventsHelper eHelper = new EventsHelper(toChange))
{
toChange.Name = newName;
TestLog.Compare(newName.Namespace == toChange.Name.Namespace, "Namespace did not change");
TestLog.Compare(newName.LocalName == toChange.Name.LocalName, "LocalName did not change");
eHelper.Verify(XObjectChange.Name, toChange);
}
undo.Undo();
TestLog.Compare(XNode.DeepEquals(toChange, original), "Undo did not work");
}
}
示例6: ExecuteXElementVariation
public void ExecuteXElementVariation()
{
XNode toReplace = Variation.Params[0] as XNode;
XNode newValue = Variation.Params[1] as XNode;
XElement xElem = new XElement("root", toReplace);
XElement xElemOriginal = new XElement(xElem);
using (UndoManager undo = new UndoManager(xElem))
{
undo.Group();
using (EventsHelper eHelper = new EventsHelper(xElem))
{
toReplace.ReplaceWith(newValue);
xElem.Verify();
eHelper.Verify(new XObjectChange[] { XObjectChange.Remove, XObjectChange.Add }, new XObject[] { toReplace, newValue });
}
undo.Undo();
TestLog.Compare(xElem.Nodes().SequenceEqual(xElemOriginal.Nodes(), XNode.EqualityComparer), "Undo did not work!");
TestLog.Compare(xElem.Attributes().EqualsAllAttributes(xElemOriginal.Attributes(), Helpers.MyAttributeComparer), "Undo did not work!");
}
}
示例7: ExecuteXDocumentVariation
public void ExecuteXDocumentVariation()
{
XNode[] toAdd = Variation.Params[0] as XNode[];
XNode contextNode = Variation.Params[1] as XNode;
IEnumerable<XNode> toAddList = toAdd.OfType<XNode>();
XDocument xDoc = new XDocument(contextNode);
XDocument xDocOriginal = new XDocument(xDoc);
using (UndoManager undo = new UndoManager(xDoc))
{
undo.Group();
using (EventsHelper docHelper = new EventsHelper(xDoc))
{
using (EventsHelper nodeHelper = new EventsHelper(contextNode))
{
contextNode.AddBeforeSelf(toAdd);
TestLog.Compare(toAddList.SequenceEqual(contextNode.NodesBeforeSelf(), XNode.EqualityComparer), "Nodes not added correctly!");
nodeHelper.Verify(0);
}
docHelper.Verify(XObjectChange.Add, toAdd);
}
undo.Undo();
TestLog.Compare(XNode.DeepEquals(xDoc, xDocOriginal), "Undo did not work!");
}
}
示例8: XCommentValue
//[Variation(Priority = 0, Desc = "XComment - change value")]
public void XCommentValue()
{
XComment toChange = new XComment("Original Value");
String newValue = "New Value";
XElement xElem = new XElement("root", toChange);
XElement xElemOriginal = new XElement(xElem);
using (UndoManager undo = new UndoManager(xElem))
{
undo.Group();
using (EventsHelper eHelper = new EventsHelper(xElem))
{
using (EventsHelper comHelper = new EventsHelper(toChange))
{
toChange.Value = newValue;
TestLog.Compare(toChange.Value.Equals(newValue), "Value did not change");
xElem.Verify();
comHelper.Verify(XObjectChange.Value, toChange);
}
eHelper.Verify(XObjectChange.Value, toChange);
}
undo.Undo();
TestLog.Compare(XNode.DeepEquals(xElem, xElemOriginal), "Undo did not work!");
}
}
示例9: XElementAddRemoveEventListners
//[Variation(Priority = 1, Desc = "Add and remove event listners")]
public void XElementAddRemoveEventListners()
{
XDocument xDoc = new XDocument(InputSpace.GetElement(10, 10));
EventsHelper docHelper = new EventsHelper(xDoc);
EventsHelper eHelper = new EventsHelper(xDoc.Root);
xDoc.Root.Add(new XElement("Add", "Me"));
docHelper.Verify(XObjectChange.Add);
eHelper.Verify(XObjectChange.Add);
eHelper.RemoveListners();
xDoc.Root.Add(new XComment("Comment"));
eHelper.Verify(0);
docHelper.Verify(XObjectChange.Add);
}
示例10: AddNull
//[Variation(Priority = 1, Desc = "XElement-Add null")]
public void AddNull()
{
XElement xElem = new XElement("root", "text");
EventsHelper elemHelper = new EventsHelper(xElem);
xElem.LastNode.AddAfterSelf(null);
elemHelper.Verify(0);
}
示例11: WorkOnTextNodes2
//[Variation(Priority = 1, Desc = "XElement - Working on the text nodes 2.")]
public void WorkOnTextNodes2()
{
XElement elem = new XElement("A", "text2");
XNode n = elem.FirstNode;
using (UndoManager undo = new UndoManager(elem))
{
undo.Group();
using (EventsHelper eHelper = new EventsHelper(elem))
{
n.AddAfterSelf("text0", "text1");
TestLog.Compare(elem.Value, "text2text0text1", "Did not concat text nodes correctly");
eHelper.Verify(XObjectChange.Value);
}
undo.Undo();
TestLog.Compare(elem.Value, "text2", "Undo did not work");
}
}
示例12: XPIValue
//[Variation(Priority = 0, Desc = "XProcessingInstruction - change value")]
public void XPIValue()
{
XProcessingInstruction toChange = new XProcessingInstruction("target", "Original Value");
String newValue = "New Value";
XElement xElem = new XElement("root", toChange);
XElement xElemOriginal = new XElement(xElem);
using (UndoManager undo = new UndoManager(xElem))
{
undo.Group();
using (EventsHelper eHelper = new EventsHelper(xElem))
{
using (EventsHelper piHelper = new EventsHelper(toChange))
{
toChange.Data = newValue;
TestLog.Compare(toChange.Data.Equals(newValue), "Value did not change");
xElem.Verify();
piHelper.Verify(XObjectChange.Value, toChange);
}
eHelper.Verify(XObjectChange.Value, toChange);
}
undo.Undo();
TestLog.Compare(XNode.DeepEquals(xElem, xElemOriginal), "Undo did not work!");
}
}
示例13: RemoveNodesBug
//[Variation(Priority = 1, Desc = "XElement - empty element special case <A></A>")]
public void RemoveNodesBug()
{
XElement e = XElement.Parse(@"<A></A>");
EventsHelper eHelper = new EventsHelper(e);
e.RemoveNodes();
//eHelper.Verify(XObjectChange.Remove, e.Nodes());
eHelper.Verify(XObjectChange.Value);
}
示例14: ExecuteXAttributeVariation
public void ExecuteXAttributeVariation()
{
XAttribute[] toAdd = Variation.Params[0] as XAttribute[];
XAttribute contextNode = Variation.Params[1] as XAttribute;
IEnumerable<XAttribute> allNodes, toAddList = toAdd.OfType<XAttribute>();
XElement xElem = contextNode == null ? new XElement("root") : new XElement("root", contextNode);
XElement xElemOriginal = new XElement(xElem);
using (UndoManager undo = new UndoManager(xElem))
{
undo.Group();
using (EventsHelper elemHelper = new EventsHelper(xElem))
{
xElem.Add(toAdd);
allNodes = contextNode == null ? xElem.Attributes() : xElem.Attributes().Skip(1);
TestLog.Compare(toAddList.SequenceEqual(allNodes, Helpers.MyAttributeComparer), "Attributes not added correctly!");
elemHelper.Verify(XObjectChange.Add, toAdd);
}
undo.Undo();
TestLog.Compare(xElem.Nodes().SequenceEqual(xElemOriginal.Nodes(), XNode.EqualityComparer), "Undo did not work!");
TestLog.Compare(xElem.Attributes().EqualsAllAttributes(xElemOriginal.Attributes(), Helpers.MyAttributeComparer), "Undo did not work!");
}
}
示例15: XAttributeRemoveOneByOne
//[Variation(Priority = 1, Desc = "XAttribute - Remove one attribute at a time")]
public void XAttributeRemoveOneByOne()
{
XDocument xDoc = new XDocument(InputSpace.GetAttributeElement(1, 100));
XDocument xDocOriginal = new XDocument(xDoc);
using (UndoManager undo = new UndoManager(xDoc))
{
undo.Group();
using (EventsHelper docHelper = new EventsHelper(xDoc))
{
using (EventsHelper eHelper = new EventsHelper(xDoc.Root))
{
List<XAttribute> list = xDoc.Root.Attributes().ToList();
foreach (XAttribute x in list)
{
x.Remove();
eHelper.Verify(XObjectChange.Remove, x);
}
docHelper.Verify(XObjectChange.Remove, list.Count);
}
}
undo.Undo();
TestLog.Compare(XNode.DeepEquals(xDoc, xDocOriginal), "Undo did not work!");
}
}