Beispiel #1
0
        public void ContextKeeperTest()
        {
            Console.WriteLine(@"ContextKeeperTest");
            IContextKeeper keeper = new ContextKeeper();

            Assert.IsFalse(keeper.ContainsContext("ContextName"));
            keeper.CreateNewContext("ContextName");
            Assert.IsTrue(keeper.ContainsContext("ContextName"));
        }
Beispiel #2
0
        public void ContextKeeperRemoveTest()
        {
            Console.WriteLine(@"ContextKeeperRemoveTest");
            var     keeper  = new ContextKeeper();
            Context context = keeper.CreateNewContext("ContextName");

            Assert.AreEqual("ContextName", context.ContextName);
            Assert.IsTrue(keeper.ContainsContext("ContextName"));
            keeper.Remove("ContextName");
            Assert.IsFalse(keeper.ContainsContext("ContextName"));
        }
Beispiel #3
0
        public void ContextKeeperUsingTest()
        {
            Console.WriteLine(@"ContextKeeperUsingTest");
            IContextKeeper keeper = new ContextKeeper();

            using (keeper.CreateNewContext("ContextName"))
            {
                Assert.IsTrue(keeper.ContainsContext("ContextName"));
                keeper.CreateNewContext(ContextValue.DefineBinding);
                using (keeper.CreateNewContext("ContextName"))
                {
                    Assert.IsTrue(keeper.ContainsContext("ContextName"));
                }
                Assert.IsTrue(keeper.ContainsContext("ContextName"));
            }
            keeper.CreateNewContext(ContextValue.OpenEditor);
            Assert.IsFalse(keeper.ContainsContext("ContextName"));
        }