Exemple #1
0
        public void TestDeferredExecution()
        {
            ExecutionCounter ec = new ExecutionCounter();

            Assert.AreEqual(0, ec.Count, "Execution Counter incorrectly initialized.");
            Log.ValidLevels = LoggingLevels.AtLeastError;
            Log.Add(LoggingLevel.Error, () => ec.Increment());
            Assert.AreEqual(1, ec.Count, "The resource lambda was not executed.");
            Log.Add(LoggingLevel.Debugging, () => ec.Increment());
            Assert.AreEqual(1, ec.Count, "The resource lambda was executed when the logging level was too low.");
        }
Exemple #2
0
        public void AllProperties()
        {
            var n = new DependencyNode();
            var e = new Entity {
                Child = new Entity()
            };

            n.Subscribe(e);
            var c = new ExecutionCounter();

            n.AddPropertyDependency("*", s => c.Execute(), "x");

            e.Name    = "abc";
            e.Number2 = 4;
            //e.Collection.Add(new Entity());

            c.Counter.ShouldEqual(2);
        }
 public void TestDeferredExecution()
 {
     ExecutionCounter ec = new ExecutionCounter();
     Assert.AreEqual(0, ec.Count, "Execution Counter incorrectly initialized.");
     Log.ValidLevels = LoggingLevels.AtLeastError;
     Log.Add(LoggingLevel.Error, () => ec.Increment());
     Assert.AreEqual(1, ec.Count, "The resource lambda was not executed.");
     Log.Add(LoggingLevel.Debugging, () => ec.Increment());
     Assert.AreEqual(1, ec.Count, "The resource lambda was executed when the logging level was too low.");
 }