Inheritance: NodeObserver
Esempio n. 1
0
        public void NodeEvent_CreatingModifying()
        {
            ContentType.GetByName("Folder");

            Node node = NodeType.CreateInstance("Folder", _testRoot);

            node.Creating  += new CancellableNodeEventHandler(Node_Creating);
            node.Created   += new EventHandler <NodeEventArgs>(Node_Created);
            node.Modifying += new CancellableNodeEventHandler(Node_Modifying);
            node.Modified  += new EventHandler <NodeEventArgs>(Node_Modified);

            _eventLog = new StringBuilder();
            TestObserver.ResetLog();

            node.Save();
            node.Index = 2;
            node.Save();

            node.Creating  -= new CancellableNodeEventHandler(Node_Creating);
            node.Created   -= new EventHandler <NodeEventArgs>(Node_Created);
            node.Modifying -= new CancellableNodeEventHandler(Node_Modifying);
            node.Modified  -= new EventHandler <NodeEventArgs>(Node_Modified);

            string cr                = Environment.NewLine;
            string expectedLog       = String.Concat("Node_Creating", cr, "Node_Created", cr, "Node_Modifying", cr, "Node_Modified", cr);
            string expectedStaticLog = String.Concat("TestObserver.OnNodeCreating", cr, "TestObserver.OnNodeCreated", cr, "TestObserver.OnNodeModifying", cr, "TestObserver.OnNodeModified", cr);

            Assert.IsTrue(_eventLog.ToString() == expectedLog, "#1");
            Assert.IsTrue(TestObserver.GetLog() == expectedStaticLog, "#2");
        }
Esempio n. 2
0
		public TestObserver()
		{
			TestObserver._instance = this;
		}
Esempio n. 3
0
 public TestObserver()
 {
     TestObserver._instance = this;
 }