Exemple #1
0
        public void Nesting()
        {
            IScope s = new DelayedScope(() => "Name", (provider, level, message) =>
            {
                Assert.AreEqual("Name.Child", provider());
                Assert.AreEqual(level, RuleLevel.Warn);
                Assert.AreEqual("Message", message);
            });

            using (var child = s.Create("Child"))
            {
                child.Warn("Message");
                Assert.AreEqual(RuleLevel.Warn, child.Level);
            }
            Assert.AreEqual(RuleLevel.Warn, s.Level);
        }
        public void Nesting()
        {
            IScope s = new DelayedScope(() => "Name", (provider, level, message) =>
                {
                    Assert.AreEqual("Name.Child", provider());
                    Assert.AreEqual(level, RuleLevel.Warn);
                    Assert.AreEqual("Message", message);
                });

            using (var child = s.Create("Child"))
            {
                child.Warn("Message");
                Assert.AreEqual(RuleLevel.Warn, child.Level);
            }
            Assert.AreEqual(RuleLevel.Warn, s.Level);
        }
Exemple #3
0
        public void Test()
        {
            int           nameCounter = 0;
            int           runCounter  = 0;
            Func <string> func        = () => (nameCounter++).ToString();

            var t = new DelayedScope(func, (func1, level, s) =>
            {
                func1();
                runCounter++;
            });

            Assert.AreEqual(0, nameCounter);
            ScopeTestHelper.RunNesting(0, t);
            Assert.AreEqual(1, nameCounter);
            Assert.AreEqual(6, runCounter);
        }
        public void Test()
        {
            int nameCounter = 0;
            int runCounter = 0;
            Func<string> func = () => (nameCounter++).ToString();

            var t = new DelayedScope(func, (func1, level, s) =>
                {
                    func1();
                    runCounter++;
                });

            Assert.AreEqual(0, nameCounter);
            ScopeTestHelper.RunNesting(0, t);
            Assert.AreEqual(1, nameCounter);
            Assert.AreEqual(6, runCounter);
        }